views

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: PostgreSQL Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ListDatabasesResponseMap is a map indexing the attribute names of
	// ListDatabasesResponse by view name.
	ListDatabasesResponseMap = map[string][]string{
		"default": {
			"databases",
		},
	}
	// DatabaseMap is a map indexing the attribute names of Database by view name.
	DatabaseMap = map[string][]string{
		"default": {
			"id",
			"tenant_id",
			"created_at",
			"updated_at",
			"state",
			"instances",
			"spec",
		},
		"abbreviated": {
			"id",
			"tenant_id",
			"created_at",
			"updated_at",
			"state",
			"instances",
		},
	}
	// DatabaseCollectionMap is a map indexing the attribute names of
	// DatabaseCollection by view name.
	DatabaseCollectionMap = map[string][]string{
		"default": {
			"id",
			"tenant_id",
			"created_at",
			"updated_at",
			"state",
			"instances",
			"spec",
		},
		"abbreviated": {
			"id",
			"tenant_id",
			"created_at",
			"updated_at",
			"state",
			"instances",
		},
	}
	// InstanceCollectionMap is a map indexing the attribute names of
	// InstanceCollection by view name.
	InstanceCollectionMap = map[string][]string{
		"default": {
			"id",
			"host_id",
			"node_name",
			"created_at",
			"updated_at",
			"status_updated_at",
			"state",
			"connection_info",
			"postgres",
			"spock",
			"error",
		},
		"abbreviated": {
			"id",
			"host_id",
			"node_name",
			"state",
		},
	}
	// InstanceMap is a map indexing the attribute names of Instance by view name.
	InstanceMap = map[string][]string{
		"default": {
			"id",
			"host_id",
			"node_name",
			"created_at",
			"updated_at",
			"status_updated_at",
			"state",
			"connection_info",
			"postgres",
			"spock",
			"error",
		},
		"abbreviated": {
			"id",
			"host_id",
			"node_name",
			"state",
		},
	}
)

Functions

func ValidateBackupConfigSpecView

func ValidateBackupConfigSpecView(result *BackupConfigSpecView) (err error)

ValidateBackupConfigSpecView runs the validations defined on BackupConfigSpecView.

func ValidateBackupRepositorySpecView

func ValidateBackupRepositorySpecView(result *BackupRepositorySpecView) (err error)

ValidateBackupRepositorySpecView runs the validations defined on BackupRepositorySpecView.

func ValidateBackupScheduleSpecView

func ValidateBackupScheduleSpecView(result *BackupScheduleSpecView) (err error)

ValidateBackupScheduleSpecView runs the validations defined on BackupScheduleSpecView.

func ValidateCreateDatabaseResponseView

func ValidateCreateDatabaseResponseView(result *CreateDatabaseResponseView) (err error)

ValidateCreateDatabaseResponseView runs the validations defined on CreateDatabaseResponseView.

func ValidateDatabase

func ValidateDatabase(result *Database) (err error)

ValidateDatabase runs the validations defined on the viewed result type Database.

func ValidateDatabaseCollectionView

func ValidateDatabaseCollectionView(result DatabaseCollectionView) (err error)

ValidateDatabaseCollectionView runs the validations defined on DatabaseCollectionView using the "default" view.

func ValidateDatabaseCollectionViewAbbreviated

func ValidateDatabaseCollectionViewAbbreviated(result DatabaseCollectionView) (err error)

ValidateDatabaseCollectionViewAbbreviated runs the validations defined on DatabaseCollectionView using the "abbreviated" view.

func ValidateDatabaseNodeSpecView

func ValidateDatabaseNodeSpecView(result *DatabaseNodeSpecView) (err error)

ValidateDatabaseNodeSpecView runs the validations defined on DatabaseNodeSpecView.

func ValidateDatabaseSpecView

func ValidateDatabaseSpecView(result *DatabaseSpecView) (err error)

ValidateDatabaseSpecView runs the validations defined on DatabaseSpecView.

func ValidateDatabaseUserSpecView

func ValidateDatabaseUserSpecView(result *DatabaseUserSpecView) (err error)

ValidateDatabaseUserSpecView runs the validations defined on DatabaseUserSpecView.

func ValidateDatabaseView

func ValidateDatabaseView(result *DatabaseView) (err error)

ValidateDatabaseView runs the validations defined on DatabaseView using the "default" view.

func ValidateDatabaseViewAbbreviated

func ValidateDatabaseViewAbbreviated(result *DatabaseView) (err error)

ValidateDatabaseViewAbbreviated runs the validations defined on DatabaseView using the "abbreviated" view.

func ValidateExtraNetworkSpecView

func ValidateExtraNetworkSpecView(result *ExtraNetworkSpecView) (err error)

ValidateExtraNetworkSpecView runs the validations defined on ExtraNetworkSpecView.

func ValidateExtraVolumesSpecView

func ValidateExtraVolumesSpecView(result *ExtraVolumesSpecView) (err error)

ValidateExtraVolumesSpecView runs the validations defined on ExtraVolumesSpecView.

func ValidateIdentifierView

func ValidateIdentifierView(result IdentifierView) (err error)

ValidateIdentifierView runs the validations defined on IdentifierView.

func ValidateInstanceCollectionView

func ValidateInstanceCollectionView(result InstanceCollectionView) (err error)

ValidateInstanceCollectionView runs the validations defined on InstanceCollectionView using the "default" view.

func ValidateInstanceCollectionViewAbbreviated

func ValidateInstanceCollectionViewAbbreviated(result InstanceCollectionView) (err error)

ValidateInstanceCollectionViewAbbreviated runs the validations defined on InstanceCollectionView using the "abbreviated" view.

func ValidateInstanceConnectionInfoView

func ValidateInstanceConnectionInfoView(result *InstanceConnectionInfoView) (err error)

ValidateInstanceConnectionInfoView runs the validations defined on InstanceConnectionInfoView.

func ValidateInstancePostgresStatusView

func ValidateInstancePostgresStatusView(result *InstancePostgresStatusView) (err error)

ValidateInstancePostgresStatusView runs the validations defined on InstancePostgresStatusView.

func ValidateInstanceSpockStatusView

func ValidateInstanceSpockStatusView(result *InstanceSpockStatusView) (err error)

ValidateInstanceSpockStatusView runs the validations defined on InstanceSpockStatusView.

func ValidateInstanceSubscriptionView

func ValidateInstanceSubscriptionView(result *InstanceSubscriptionView) (err error)

ValidateInstanceSubscriptionView runs the validations defined on InstanceSubscriptionView.

func ValidateInstanceView

func ValidateInstanceView(result *InstanceView) (err error)

ValidateInstanceView runs the validations defined on InstanceView using the "default" view.

func ValidateInstanceViewAbbreviated

func ValidateInstanceViewAbbreviated(result *InstanceView) (err error)

ValidateInstanceViewAbbreviated runs the validations defined on InstanceView using the "abbreviated" view.

func ValidateListDatabasesResponse

func ValidateListDatabasesResponse(result *ListDatabasesResponse) (err error)

ValidateListDatabasesResponse runs the validations defined on the viewed result type ListDatabasesResponse.

func ValidateListDatabasesResponseView

func ValidateListDatabasesResponseView(result *ListDatabasesResponseView) (err error)

ValidateListDatabasesResponseView runs the validations defined on ListDatabasesResponseView using the "default" view.

func ValidateOrchestratorOptsView

func ValidateOrchestratorOptsView(result *OrchestratorOptsView) (err error)

ValidateOrchestratorOptsView runs the validations defined on OrchestratorOptsView.

func ValidateRestoreConfigSpecView

func ValidateRestoreConfigSpecView(result *RestoreConfigSpecView) (err error)

ValidateRestoreConfigSpecView runs the validations defined on RestoreConfigSpecView.

func ValidateRestoreDatabaseResponseView

func ValidateRestoreDatabaseResponseView(result *RestoreDatabaseResponseView) (err error)

ValidateRestoreDatabaseResponseView runs the validations defined on RestoreDatabaseResponseView.

func ValidateRestoreRepositorySpecView

func ValidateRestoreRepositorySpecView(result *RestoreRepositorySpecView) (err error)

ValidateRestoreRepositorySpecView runs the validations defined on RestoreRepositorySpecView.

func ValidateSwarmOptsView

func ValidateSwarmOptsView(result *SwarmOptsView) (err error)

ValidateSwarmOptsView runs the validations defined on SwarmOptsView.

func ValidateTaskView

func ValidateTaskView(result *TaskView) (err error)

ValidateTaskView runs the validations defined on TaskView.

func ValidateUpdateDatabaseResponseView

func ValidateUpdateDatabaseResponseView(result *UpdateDatabaseResponseView) (err error)

ValidateUpdateDatabaseResponseView runs the validations defined on UpdateDatabaseResponseView.

Types

type BackupConfigSpecView

type BackupConfigSpecView struct {
	// The repositories for this backup configuration.
	Repositories []*BackupRepositorySpecView
	// The schedules for this backup configuration.
	Schedules []*BackupScheduleSpecView
}

BackupConfigSpecView is a type that runs validations on a projected type.

type BackupRepositorySpecView

type BackupRepositorySpecView struct {
	// The unique identifier of this repository.
	ID *IdentifierView
	// The type of this repository.
	Type *string
	// The S3 bucket name for this repository. Only applies when type = 's3'.
	S3Bucket *string
	// The region of the S3 bucket for this repository. Only applies when type =
	// 's3'.
	S3Region *string
	// The optional S3 endpoint for this repository. Only applies when type = 's3'.
	S3Endpoint *string
	// An optional AWS access key ID to use for this repository. If not provided,
	// pgbackrest will use the default credential provider chain. This field will
	// be excluded from the response of all endpoints. It can also be omitted from
	// update requests to keep the current value.
	S3Key *string
	// The corresponding secret for the AWS access key ID in s3_key. This field
	// will be excluded from the response of all endpoints. It can also be omitted
	// from update requests to keep the current value.
	S3KeySecret *string
	// The GCS bucket name for this repository. Only applies when type = 'gcs'.
	GcsBucket *string
	// The optional GCS endpoint for this repository. Only applies when type =
	// 'gcs'.
	GcsEndpoint *string
	// Optional base64-encoded private key data. If omitted, pgbackrest will use
	// the service account attached to the instance profile. This field will be
	// excluded from the response of all endpoints. It can also be omitted from
	// update requests to keep the current value.
	GcsKey *string
	// The Azure account name for this repository. Only applies when type = 'azure'.
	AzureAccount *string
	// The Azure container name for this repository. Only applies when type =
	// 'azure'.
	AzureContainer *string
	// The optional Azure endpoint for this repository. Only applies when type =
	// 'azure'.
	AzureEndpoint *string
	// The Azure storage account access key to use for this repository. This field
	// will be excluded from the response of all endpoints. It can also be omitted
	// from update requests to keep the current value.
	AzureKey *string
	// The count of full backups to retain or the time to retain full backups.
	RetentionFull *int
	// The type of measure used for retention_full.
	RetentionFullType *string
	// The base path within the repository to store backups. Required for type =
	// 'posix' and 'cifs'.
	BasePath *string
	// Additional options to apply to this repository.
	CustomOptions map[string]string
}

BackupRepositorySpecView is a type that runs validations on a projected type.

type BackupScheduleSpecView

type BackupScheduleSpecView struct {
	// The unique identifier for this backup schedule.
	ID *string
	// The type of backup to take on this schedule.
	Type *string
	// The cron expression for this schedule.
	CronExpression *string
}

BackupScheduleSpecView is a type that runs validations on a projected type.

type CreateDatabaseResponseView

type CreateDatabaseResponseView struct {
	// The task that will create this database.
	Task *TaskView
	// The database being created.
	Database *DatabaseView
}

CreateDatabaseResponseView is a type that runs validations on a projected type.

type Database

type Database struct {
	// Type to project
	Projected *DatabaseView
	// View to render
	View string
}

Database is the viewed result type that is projected based on a view.

type DatabaseCollectionView

type DatabaseCollectionView []*DatabaseView

DatabaseCollectionView is a type that runs validations on a projected type.

type DatabaseNodeSpecView

type DatabaseNodeSpecView struct {
	// The name of the database node.
	Name *string
	// The IDs of the hosts that should run this node. When multiple hosts are
	// specified, one host will chosen as a primary, and the others will be read
	// replicas.
	HostIds []IdentifierView
	// The Postgres version for this node in 'major.minor' format. Overrides the
	// Postgres version set in the DatabaseSpec.
	PostgresVersion *string
	// The port used by the Postgres database for this node. Overrides the Postgres
	// port set in the DatabaseSpec.
	Port *int
	// The number of CPUs to allocate for the database on this node and to use for
	// tuning Postgres. It can include the SI suffix 'm', e.g. '500m' for 500
	// millicpus. Cannot allocate units smaller than 1m. Defaults to the number of
	// available CPUs on the host if 0 or unspecified. Cannot allocate more CPUs
	// than are available on the host. Whether this limit is enforced depends on
	// the orchestrator.
	Cpus *string
	// The amount of memory in SI or IEC notation to allocate for the database on
	// this node and to use for tuning Postgres. Defaults to the total available
	// memory on the host. Whether this limit is enforced depends on the
	// orchestrator.
	Memory *string
	// Additional postgresql.conf settings for this particular node. Will be merged
	// with the settings provided by control-plane.
	PostgresqlConf map[string]any
	// The backup configuration for this node. Overrides the backup configuration
	// set in the DatabaseSpec.
	BackupConfig *BackupConfigSpecView
	// The restore configuration for this node. Overrides the restore configuration
	// set in the DatabaseSpec.
	RestoreConfig *RestoreConfigSpecView
	// Orchestrator-specific configuration options.
	OrchestratorOpts *OrchestratorOptsView
	// The name of the source node to use for sync. This is typically the node
	// (like 'n1') from which the data will be copied to initialize this new node.
	SourceNode *string
}

DatabaseNodeSpecView is a type that runs validations on a projected type.

type DatabaseSpecView

type DatabaseSpecView struct {
	// The name of the Postgres database.
	DatabaseName *string
	// The Postgres version in 'major.minor' format.
	PostgresVersion *string
	// The major version of the Spock extension.
	SpockVersion *string
	// The port used by the Postgres database. If the port is 0, each instance will
	// be assigned a random port. If the port is unspecified, the database will not
	// be exposed on any port, dependent on orchestrator support for that feature.
	Port *int
	// The number of CPUs to allocate for the database and to use for tuning
	// Postgres. Defaults to the number of available CPUs on the host. Can include
	// an SI suffix, e.g. '500m' for 500 millicpus. Whether this limit is enforced
	// depends on the orchestrator.
	Cpus *string
	// The amount of memory in SI or IEC notation to allocate for the database and
	// to use for tuning Postgres. Defaults to the total available memory on the
	// host. Whether this limit is enforced depends on the orchestrator.
	Memory *string
	// The Spock nodes for this database.
	Nodes []*DatabaseNodeSpecView
	// The users to create for this database.
	DatabaseUsers []*DatabaseUserSpecView
	// The backup configuration for this database.
	BackupConfig *BackupConfigSpecView
	// The restore configuration for this database.
	RestoreConfig *RestoreConfigSpecView
	// Additional postgresql.conf settings. Will be merged with the settings
	// provided by control-plane.
	PostgresqlConf map[string]any
	// Orchestrator-specific configuration options.
	OrchestratorOpts *OrchestratorOptsView
}

DatabaseSpecView is a type that runs validations on a projected type.

type DatabaseUserSpecView

type DatabaseUserSpecView struct {
	// The username for this database user.
	Username *string
	// The password for this database user. This field will be excluded from the
	// response of all endpoints. It can also be omitted from update requests to
	// keep the current value.
	Password *string
	// If true, this user will be granted database ownership.
	DbOwner *bool
	// The attributes to assign to this database user.
	Attributes []string
	// The roles to assign to this database user.
	Roles []string
}

DatabaseUserSpecView is a type that runs validations on a projected type.

type DatabaseView

type DatabaseView struct {
	// Unique identifier for the database.
	ID *IdentifierView
	// Unique identifier for the databases's owner.
	TenantID *IdentifierView
	// The time that the database was created.
	CreatedAt *string
	// The time that the database was last updated.
	UpdatedAt *string
	// Current state of the database.
	State *string
	// All of the instances in the database.
	Instances InstanceCollectionView
	// The user-provided specification for the database.
	Spec *DatabaseSpecView
}

DatabaseView is a type that runs validations on a projected type.

type ExtraNetworkSpecView

type ExtraNetworkSpecView struct {
	// The name or ID of the network to connect to.
	ID *string
	// Optional network-scoped aliases for the container.
	Aliases []string
	// Optional driver options for the network connection.
	DriverOpts map[string]string
}

ExtraNetworkSpecView is a type that runs validations on a projected type.

type ExtraVolumesSpecView

type ExtraVolumesSpecView struct {
	// The host path for the volume.
	HostPath *string
	// The path inside the container where the volume will be mounted.
	DestinationPath *string
}

ExtraVolumesSpecView is a type that runs validations on a projected type.

type IdentifierView

type IdentifierView string

IdentifierView is a type that runs validations on a projected type.

type InstanceCollectionView

type InstanceCollectionView []*InstanceView

InstanceCollectionView is a type that runs validations on a projected type.

type InstanceConnectionInfoView

type InstanceConnectionInfoView struct {
	// The hostname of the host that's running this instance.
	Hostname *string
	// The IPv4 address of the host that's running this instance.
	Ipv4Address *string
	// The host port that Postgres is listening on for this instance.
	Port *int
}

InstanceConnectionInfoView is a type that runs validations on a projected type.

type InstancePostgresStatusView

type InstancePostgresStatusView struct {
	// The version of Postgres for this instance.
	Version      *string
	PatroniState *string
	Role         *string
	// True if this instance has a pending restart from a configuration change.
	PendingRestart *bool
	// True if Patroni is paused for this instance.
	PatroniPaused *bool
}

InstancePostgresStatusView is a type that runs validations on a projected type.

type InstanceSpockStatusView

type InstanceSpockStatusView struct {
	// The current spock.readonly setting.
	ReadOnly *string
	// The version of Spock for this instance.
	Version *string
	// Status information for this instance's Spock subscriptions.
	Subscriptions []*InstanceSubscriptionView
}

InstanceSpockStatusView is a type that runs validations on a projected type.

type InstanceSubscriptionView

type InstanceSubscriptionView struct {
	// The Spock node name of the provider for this subscription.
	ProviderNode *string
	// The name of the subscription.
	Name *string
	// The current status of the subscription.
	Status *string
}

InstanceSubscriptionView is a type that runs validations on a projected type.

type InstanceView

type InstanceView struct {
	// Unique identifier for the instance.
	ID *string
	// The ID of the host this instance is running on.
	HostID *string
	// The Spock node name for this instance.
	NodeName *string
	// The time that the instance was created.
	CreatedAt *string
	// The time that the instance was last modified.
	UpdatedAt *string
	// The time that the instance status information was last updated.
	StatusUpdatedAt *string
	State           *string
	// Connection information for the instance.
	ConnectionInfo *InstanceConnectionInfoView
	// Postgres status information for the instance.
	Postgres *InstancePostgresStatusView
	// Spock status information for the instance.
	Spock *InstanceSpockStatusView
	// An error message if the instance is in an error state.
	Error *string
}

InstanceView is a type that runs validations on a projected type.

type ListDatabasesResponse

type ListDatabasesResponse struct {
	// Type to project
	Projected *ListDatabasesResponseView
	// View to render
	View string
}

ListDatabasesResponse is the viewed result type that is projected based on a view.

type ListDatabasesResponseView

type ListDatabasesResponseView struct {
	Databases DatabaseCollectionView
}

ListDatabasesResponseView is a type that runs validations on a projected type.

type OrchestratorOptsView

type OrchestratorOptsView struct {
	// Swarm-specific configuration.
	Swarm *SwarmOptsView
}

OrchestratorOptsView is a type that runs validations on a projected type.

type RestoreConfigSpecView

type RestoreConfigSpecView struct {
	// The ID of the database to restore this database from.
	SourceDatabaseID *IdentifierView
	// The name of the node to restore this database from.
	SourceNodeName *string
	// The name of the database in this repository. The database will be renamed to
	// the database_name in the DatabaseSpec after it's restored.
	SourceDatabaseName *string
	// The repository to restore this database from.
	Repository *RestoreRepositorySpecView
	// Additional options to use when restoring this database. If omitted, the
	// database will be restored to the latest point in the given repository.
	RestoreOptions map[string]string
}

RestoreConfigSpecView is a type that runs validations on a projected type.

type RestoreDatabaseResponseView

type RestoreDatabaseResponseView struct {
	// The task that will restore this database.
	Task *TaskView
	// The tasks that will restore each database node.
	NodeTasks []*TaskView
	// The database being restored.
	Database *DatabaseView
}

RestoreDatabaseResponseView is a type that runs validations on a projected type.

type RestoreRepositorySpecView

type RestoreRepositorySpecView struct {
	// The unique identifier of this repository.
	ID *IdentifierView
	// The type of this repository.
	Type *string
	// The S3 bucket name for this repository. Only applies when type = 's3'.
	S3Bucket *string
	// The region of the S3 bucket for this repository. Only applies when type =
	// 's3'.
	S3Region *string
	// The optional S3 endpoint for this repository. Only applies when type = 's3'.
	S3Endpoint *string
	// An optional AWS access key ID to use for this repository. If not provided,
	// pgbackrest will use the default credential provider chain.
	S3Key *string
	// The corresponding secret for the AWS access key ID in s3_key.
	S3KeySecret *string
	// The GCS bucket name for this repository. Only applies when type = 'gcs'.
	GcsBucket *string
	// The optional GCS endpoint for this repository. Only applies when type =
	// 'gcs'.
	GcsEndpoint *string
	// Optional base64-encoded private key data. If omitted, pgbackrest will use
	// the service account attached to the instance profile.
	GcsKey *string
	// The Azure account name for this repository. Only applies when type = 'azure'.
	AzureAccount *string
	// The Azure container name for this repository. Only applies when type =
	// 'azure'.
	AzureContainer *string
	// The optional Azure endpoint for this repository. Only applies when type =
	// 'azure'.
	AzureEndpoint *string
	// An optional Azure storage account access key to use for this repository. If
	// not provided, pgbackrest will use the VM's managed identity.
	AzureKey *string
	// The base path within the repository to store backups. Required for type =
	// 'posix' and 'cifs'.
	BasePath *string
	// Additional options to apply to this repository.
	CustomOptions map[string]string
}

RestoreRepositorySpecView is a type that runs validations on a projected type.

type SwarmOptsView

type SwarmOptsView struct {
	// A list of extra volumes to mount. Each entry defines a host and container
	// path.
	ExtraVolumes []*ExtraVolumesSpecView
	// A list of additional Docker Swarm networks to attach containers in this
	// database to.
	ExtraNetworks []*ExtraNetworkSpecView
	// Arbitrary labels to apply to the Docker Swarm service
	ExtraLabels map[string]string
}

SwarmOptsView is a type that runs validations on a projected type.

type TaskView

type TaskView struct {
	// The parent task ID of the task.
	ParentID *string
	// The database ID of the task.
	DatabaseID *string
	// The name of the node that the task is operating on.
	NodeName *string
	// The ID of the instance that the task is operating on.
	InstanceID *string
	// The ID of the host that the task is running on.
	HostID *string
	// The unique ID of the task.
	TaskID *string
	// The time when the task was created.
	CreatedAt *string
	// The time when the task was completed.
	CompletedAt *string
	// The type of the task.
	Type *string
	// The status of the task.
	Status *string
	// The error message if the task failed.
	Error *string
}

TaskView is a type that runs validations on a projected type.

type UpdateDatabaseResponseView

type UpdateDatabaseResponseView struct {
	// The task that will update this database.
	Task *TaskView
	// The database being updated.
	Database *DatabaseView
}

UpdateDatabaseResponseView is a type that runs validations on a projected type.

Jump to

Keyboard shortcuts

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