Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var APIError = g.Type("APIError", func() { g.Description("A Control Plane API error.") g.ErrorName("name", g.String, func() { g.Description("The name of the error.") g.Example("error_name") }) g.Attribute("message", g.String, func() { g.Description("The error message.") g.Example("A longer description of the error.") }) g.Required("name", "message") })
View Source
var BackupConfigSpec = g.Type("BackupConfigSpec", func() { g.Attribute("repositories", g.ArrayOf(BackupRepositorySpec), func() { g.Description("The repositories for this backup configuration.") g.MinLength(1) }) g.Attribute("schedules", g.ArrayOf(BackupScheduleSpec), func() { g.Description("The schedules for this backup configuration.") g.MaxLength(32) }) g.Required("repositories") })
View Source
var BackupDatabaseNodeResponse = g.Type("BackupDatabaseNodeResponse", func() { g.Attribute("task", Task, func() { g.Description("The task that will backup this database node.") }) g.Required("task") g.Example(map[string]any{ "task": map[string]any{ "created_at": "2025-06-18T17:54:28Z", "database_id": "storefront", "status": "pending", "task_id": "0197842d-9082-7496-b787-77bd2e11809f", "type": "node_backup", }, }) })
View Source
var BackupOptions = g.Type("BackupOptions", func() { g.Attribute("type", g.String, func() { g.Enum("full", "diff", "incr") g.Description("The type of backup.") g.Example("full") }) g.Attribute("annotations", g.MapOf(g.String, g.String), func() { g.Description("Annotations for the backup.") g.Example(map[string]string{ "key": "value", }) }) g.Attribute("backup_options", g.MapOf(g.String, g.String), func() { g.Description("Options for the backup.") g.Example(map[string]string{ "archive-check": "n", }) }) g.Required("type") g.Example("Full backup", func() { g.Description("Example of taking a full backup.") g.Value(map[string]any{ "type": "full", }) }) g.Example("Backup with annotations and options", func() { g.Description("Example of taking backup with annotations and additional backup options.") g.Value(map[string]any{ "type": "full", "annotations": map[string]string{ "initiated-by": "backup-cron-job", }, "backup_options": map[string]string{ "archive-check": "n", }, }) }) })
View Source
var BackupRepositorySpec = g.Type("BackupRepositorySpec", func() { g.Attribute("id", Identifier, func() { g.Description("The unique identifier of this repository.") g.Example("my-app-1") g.Example("f6b84a99-5e91-4203-be1e-131fe82e5984") }) g.Attribute("type", g.String, func() { g.Description("The type of this repository.") g.Enum("s3", "gcs", "azure", "posix", "cifs") g.Example("s3") }) g.Attribute("s3_bucket", g.String, func() { g.Description("The S3 bucket name for this repository. Only applies when type = 's3'.") g.MinLength(3) g.MaxLength(63) g.Example("pgedge-backups-9f81786f-373b-4ff2-afee-e054a06a96f1") }) g.Attribute("s3_region", g.String, func() { g.Description("The region of the S3 bucket for this repository. Only applies when type = 's3'.") g.MinLength(1) g.MaxLength(32) g.Example("us-east-1") }) g.Attribute("s3_endpoint", g.String, func() { g.Description("The optional S3 endpoint for this repository. Only applies when type = 's3'.") g.MinLength(3) g.MaxLength(128) g.Example("s3.us-east-1.amazonaws.com") }) g.Attribute("s3_key", g.String, func() { g.Description("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.") g.MaxLength(128) g.Example("AKIAIOSFODNN7EXAMPLE") }) g.Attribute("s3_key_secret", g.String, func() { g.Description("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.") g.MaxLength(128) g.Example("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY") }) g.Attribute("gcs_bucket", g.String, func() { g.Description("The GCS bucket name for this repository. Only applies when type = 'gcs'.") g.MinLength(3) g.MaxLength(63) g.Example("pgedge-backups-9f81786f-373b-4ff2-afee-e054a06a96f1") }) g.Attribute("gcs_endpoint", g.String, func() { g.Description("The optional GCS endpoint for this repository. Only applies when type = 'gcs'.") g.MinLength(3) g.MaxLength(128) g.Example("localhost") }) g.Attribute("gcs_key", g.String, func() { g.Description("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.") g.MaxLength(1024) g.Example("ZXhhbXBsZSBnY3Mga2V5Cg==") }) g.Attribute("azure_account", g.String, func() { g.Description("The Azure account name for this repository. Only applies when type = 'azure'.") g.MinLength(3) g.MaxLength(24) g.Example("pgedge-backups") }) g.Attribute("azure_container", g.String, func() { g.Description("The Azure container name for this repository. Only applies when type = 'azure'.") g.MinLength(3) g.MaxLength(63) g.Example("pgedge-backups-9f81786f-373b-4ff2-afee-e054a06a96f1") }) g.Attribute("azure_endpoint", g.String, func() { g.Description("The optional Azure endpoint for this repository. Only applies when type = 'azure'.") g.MinLength(3) g.MaxLength(128) g.Example("blob.core.usgovcloudapi.net") }) g.Attribute("azure_key", g.String, func() { g.Description("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.") g.MaxLength(128) g.Example("YXpLZXk=") }) g.Attribute("retention_full", g.Int, func() { g.Description("The count of full backups to retain or the time to retain full backups.") g.Minimum(1) g.Maximum(9999999) g.Example(2) }) g.Attribute("retention_full_type", g.String, func() { g.Description("The type of measure used for retention_full.") g.Enum("time", "count") g.Example("count") }) g.Attribute("base_path", g.String, func() { g.Description("The base path within the repository to store backups. Required for type = 'posix' and 'cifs'.") g.MaxLength(256) g.Example("/backups") }) g.Attribute("custom_options", g.MapOf(g.String, g.String), func() { g.Description("Additional options to apply to this repository.") g.Example(map[string]any{ "storage-upload-chunk-size": "5MiB", "s3-kms-key-id": "1234abcd-12ab-34cd-56ef-1234567890ab", }) }) g.Required("type") })
View Source
var BackupScheduleSpec = g.Type("BackupScheduleSpec", func() { g.Attribute("id", g.String, func() { g.Description("The unique identifier for this backup schedule.") g.MaxLength(64) g.Example("daily-full-backup") }) g.Attribute("type", g.String, func() { g.Description("The type of backup to take on this schedule.") g.Enum("full", "incr") g.Example("full") }) g.Attribute("cron_expression", g.String, func() { g.Description("The cron expression for this schedule.") g.MaxLength(32) g.Example("0 6 * * ?") }) g.Required("id", "type", "cron_expression") })
View Source
var CancelDatabaseTaskPayload = g.Type("CancelDatabaseTaskPayload", func() { g.Attribute("database_id", Identifier) g.Attribute("task_id", Identifier) g.Required("database_id", "task_id") })
View Source
var Cluster = g.Type("Cluster", func() { g.Attribute("id", Identifier, func() { g.Description("Unique identifier for the cluster.") g.Example("production") }) g.Attribute("status", ClusterStatus, func() { g.Description("Current status of the cluster.") }) g.Attribute("hosts", g.ArrayOf(Host), func() { g.Description("All of the hosts in the cluster.") g.Example(HostsArrayExample) }) g.Required("id", "status", "hosts") })
View Source
var ClusterCredentials = g.Type("ClusterCredentials", func() { g.Attribute("username", g.String, func() { g.Description("The Etcd username for the new host.") g.Example("host-2") }) g.Attribute("password", g.String, func() { g.Description("The Etcd password for the new host.") g.Example("a78v2x866zirk4o737gjdssfi") }) g.Attribute("ca_cert", g.String, func() { g.Description("The base64-encoded CA certificate for the cluster.") g.Example("ZGE4NDdkMzMtM2FiYi00YzE2LTkzOGQtNDRkODU2ZDFlZWZlCg==") }) g.Attribute("client_cert", g.String, func() { g.Description("The base64-encoded etcd client certificate for the new cluster member.") g.Example("NWM0MGMyZTAtYjAyYS00NzkxLTk0YjAtMjMyN2EyZGQ4ZDc3Cg==") }) g.Attribute("client_key", g.String, func() { g.Description("The base64-encoded etcd client key for the new cluster member.") g.Example("Y2FlNjhmODQtYjE1Ni00YWYyLWFhMWEtM2FhNzI2MmVhYTM0Cg==") }) g.Attribute("server_cert", g.String, func() { g.Description("The base64-encoded etcd server certificate for the new cluster member.") g.Example("Nzc1OGQyY2UtZjdjOC00YmE4LTk2ZmQtOWE3MjVmYmY3NDdiCg==") }) g.Attribute("server_key", g.String, func() { g.Description("The base64-encoded etcd server key for the new cluster member.") g.Example("NWRhNzY1ZGUtNzJkMi00OTU3LTk4ODUtOWRiZThjOGE5MGQ3Cg==") }) g.Required( "username", "password", "ca_cert", "client_cert", "client_key", "server_cert", "server_key", ) })
View Source
var ClusterJoinOptions = g.Type("ClusterJoinOptions", func() { g.Attribute("leader", EtcdClusterMember, func() { g.Description("Connection information for the etcd cluster leader") }) g.Attribute("credentials", ClusterCredentials, func() { g.Description("Credentials for the new host joining the cluster.") }) g.Required("leader", "credentials") })
View Source
var ClusterJoinRequest = g.Type("ClusterJoinRequest", func() { g.Attribute("token", g.String, func() { g.Description("Token to join the cluster.") g.Pattern(`^PGEDGE-[\w]{64}-[\w]{32}$`) g.Example("PGEDGE-dd440afcf5de20ef8e8cf54f6cb9f125fd55f90e64faa94b906130b31235e730-41e975f41d7ea61058f2fe2572cb52dd") }) g.Attribute("host_id", Identifier, func() { g.Description("The unique identifier for the host that's joining the cluster.") g.Example("host-1") }) g.Attribute("hostname", g.String, func() { g.Description("The hostname of the host that's joining the cluster.") g.MinLength(3) g.MaxLength(128) g.Example("ip-10-1-0-113.ec2.internal") }) g.Attribute("ipv4_address", g.String, func() { g.Format(g.FormatIPv4) g.Description("The IPv4 address of the host that's joining the cluster.") g.Example("10.1.0.113") }) g.Attribute("embedded_etcd_enabled", g.Boolean, func() { g.Description("True if the joining member is configured to run an embedded an etcd server.") g.Example(true) }) g.Required("embedded_etcd_enabled", "token", "host_id", "hostname", "ipv4_address") })
View Source
var ClusterJoinToken = g.Type("ClusterJoinToken", func() { g.Attribute("token", g.String, func() { g.Description("Token to join an existing cluster.") g.Example("PGEDGE-dd440afcf5de20ef8e8cf54f6cb9f125fd55f90e64faa94b906130b31235e730-41e975f41d7ea61058f2fe2572cb52dd") }) g.Attribute("server_url", g.String, func() { g.Format(g.FormatURI) g.Description("Existing server to join") g.Example("http://192.168.1.1:3000") }) g.Required("token", "server_url") })
View Source
var ClusterStatus = g.Type("ClusterStatus", func() { g.Attribute("state", g.String, func() { g.Description("The current state of the cluster.") g.Enum("available", "error") }) g.Required("state") })
View Source
var ComponentStatus = g.Type("ComponentStatus", func() { g.Attribute("healthy", g.Boolean, func() { g.Description("Indicates if the component is healthy.") g.Example(false) }) g.Attribute("error", g.String, func() { g.Description("Error message from any errors that occurred during the health check.") g.Example("failed to connect to etcd") }) g.Attribute("details", g.MapOf(g.String, g.Any), func() { g.Description("Additional details about the component.") g.Example(map[string]any{ "alarms": []string{"3: NOSPACE"}, }) }) g.Required("healthy") })
View Source
var CreateDatabaseRequest = g.Type("CreateDatabaseRequest", func() { g.Attribute("id", Identifier, func() { g.Description("Unique identifier for the database.") g.Example("production") g.Example("my-app") g.Example("02f1a7db-fca8-4521-b57a-2a375c1ced51") }) g.Attribute("tenant_id", Identifier, func() { g.Description("Unique identifier for the databases's owner.") g.Example("engineering") g.Example("8210ec10-2dca-406c-ac4a-0661d2189954") }) g.Attribute("spec", DatabaseSpec, func() { g.Description("The specification for the database.") }) g.Required("spec") g.Example("Minimal", func() { g.Description("A minimal configuration that relies on default values for most fields.") g.Value(map[string]any{ "id": "storefront", "spec": map[string]any{ "database_name": "storefront", "database_users": []map[string]any{ { "username": "admin", "password": "password", "db_owner": true, "attributes": []string{"LOGIN", "SUPERUSER"}, }, }, "port": 5432, "nodes": []map[string]any{ {"name": "n1", "host_ids": []string{"us-east-1"}}, {"name": "n2", "host_ids": []string{"ap-south-1"}}, {"name": "n3", "host_ids": []string{"eu-central-1"}}, }, }, }) }) g.Example("With local backups", func() { g.Description("A configuration that includes backups to a locally-mounted NFS on n1.") g.Value(map[string]any{ "id": "storefront", "spec": map[string]any{ "database_name": "storefront", "port": 5432, "database_users": []map[string]any{ { "username": "admin", "password": "password", "db_owner": true, "attributes": []string{"LOGIN", "SUPERUSER"}, }, }, "nodes": []map[string]any{ { "name": "n1", "host_ids": []string{"us-east-1"}, "orchestrator_opts": map[string]any{ "swarm": map[string]any{ "extra_volumes": []map[string]any{ { "host_path": "/mnt/backups", "destination_path": "/backups", }, }, }, }, "backup_config": map[string]any{ "repositories": []map[string]any{ { "type": "posix", "base_path": "/backups", }, }, }, }, {"name": "n2", "host_ids": []string{"ap-south-1"}}, {"name": "n3", "host_ids": []string{"eu-central-1"}}, }, }, }) }) g.Example("With custom networks, volumes, and labels", func() { g.Description("A configuration that mounts a local volume, attaches the container to multiple Swarm networks and applies custom labels.") g.Value(map[string]any{ "id": "inventory-db", "spec": map[string]any{ "database_name": "inventory", "port": 5432, "database_users": []map[string]any{ { "username": "inv_admin", "password": "securepass", "db_owner": true, "attributes": []string{"LOGIN"}, }, }, "nodes": []map[string]any{ { "name": "n1", "host_ids": []string{"host-1"}, "orchestrator_opts": map[string]any{ "swarm": map[string]any{ "extra_volumes": []map[string]any{ { "host_path": "/mnt/backups", "destination_path": "/backups", }, }, "extra_networks": []map[string]any{ { "id": "net-network", }, }, "extra_labels": map[string]string{ "traefik.enable": "true", "traefik.tcp.routers.db.rule": "HostSNI(`inventory.example.com`)", "environment": "staging", }, }, }, }, {"name": "n2", "host_ids": []string{"host-2"}}, }, }, }) }) g.Example("With cloud backups", func() { g.Description("A configuration that includes backups to S3 from all nodes. Note that the S3 access key and secret can be excluded if EC2 instance profiles are configured for each host.") g.Value(map[string]any{ "id": "storefront", "spec": map[string]any{ "database_name": "storefront", "port": 5432, "database_users": []map[string]any{ { "username": "admin", "password": "password", "db_owner": true, "attributes": []string{"LOGIN", "SUPERUSER"}, }, }, "nodes": []map[string]any{ { "name": "n1", "host_ids": []string{"us-east-1"}, "backup_config": map[string]any{ "repositories": []map[string]any{ { "type": "s3", "s3_bucket": "storefront-db-backups-us-east-1", }, }, }, }, { "name": "n2", "host_ids": []string{"ap-south-1"}, "backup_config": map[string]any{ "repositories": []map[string]any{ { "type": "s3", "s3_bucket": "storefront-db-backups-ap-south-1", }, }, }, }, { "name": "n3", "host_ids": []string{"eu-central-1"}, "backup_config": map[string]any{ "repositories": []map[string]any{ { "type": "s3", "s3_bucket": "storefront-db-backups-eu-central-1", }, }, }, }, }, }, }) }) g.Example("Creating from an existing backup", func() { g.Description("A configuration that creates a database from an existing backup in S3.") g.Value(map[string]any{ "id": "storefront-staging", "spec": map[string]any{ "database_name": "storefront", "port": 5432, "database_users": []map[string]any{ { "username": "admin", "password": "password", "db_owner": true, "attributes": []string{"LOGIN", "SUPERUSER"}, }, }, "restore_config": map[string]any{ "source_database_id": "storefront", "source_database_name": "storefront", "source_node_name": "n1", "repository": map[string]any{ "type": "s3", "s3_bucket": "storefront-db-backups-us-east-1", }, }, "nodes": []map[string]any{ {"name": "n1", "host_ids": []string{"us-east-1"}}, {"name": "n2", "host_ids": []string{"ap-south-1"}}, {"name": "n3", "host_ids": []string{"eu-central-1"}}, }, }, }) }) g.Example("Built-in roles", func() { g.Description("The Control Plane can create multiple users on your behalf, and it includes some built-in roles that make it easy to assign limited permissions.") g.Value(map[string]any{ "id": "storefront", "spec": map[string]any{ "database_name": "storefront", "port": 5432, "database_users": []map[string]any{ { "username": "admin", "password": "password", "db_owner": true, "attributes": []string{"LOGIN", "SUPERUSER"}, }, { "username": "storefront_app", "password": "password", "attributes": []string{"LOGIN"}, "roles": []string{"pgedge_application"}, }, { "username": "business_intelligence_app", "password": "password", "attributes": []string{"LOGIN"}, "roles": []string{"pgedge_application_read_only"}, }, }, "nodes": []map[string]any{ {"name": "n1", "host_ids": []string{"us-east-1"}}, {"name": "n2", "host_ids": []string{"ap-south-1"}}, {"name": "n3", "host_ids": []string{"eu-central-1"}}, }, }, }) }) g.Example("Customized PostgreSQL configuration", func() { g.Description("The Control Plane will automatically set and tune some parameters based on the resources available to the host. You can override these and other settings for the whole database or per-node.") g.Value(map[string]any{ "id": "storefront", "spec": map[string]any{ "database_name": "storefront", "port": 5432, "database_users": []map[string]any{ { "username": "admin", "password": "password", "db_owner": true, "attributes": []string{"LOGIN", "SUPERUSER"}, }, }, "postgresql_conf": map[string]any{ "max_connections": 5000, }, "nodes": []map[string]any{ {"name": "n1", "host_ids": []string{"us-east-1"}}, {"name": "n2", "host_ids": []string{"ap-south-1"}}, {"name": "n3", "host_ids": []string{"eu-central-1"}}, }, }, }) }) })
View Source
var CreateDatabaseResponse = g.Type("CreateDatabaseResponse", func() { g.Attribute("task", Task, func() { g.Description("The task that will create this database.") }) g.Attribute("database", Database, func() { g.Description("The database being created.") }) g.Required("task", "database") g.Example(map[string]any{ "database": map[string]any{ "created_at": "2025-06-18T16:52:05Z", "id": "storefront", "spec": map[string]any{ "database_name": "storefront", "port": 5432, "database_users": []map[string]any{ { "attributes": []any{ "SUPERUSER", "LOGIN", }, "db_owner": true, "username": "admin", }, }, "nodes": []map[string]any{ {"name": "n1", "host_ids": []string{"us-east-1"}}, {"name": "n2", "host_ids": []string{"ap-south-1"}}, {"name": "n3", "host_ids": []string{"eu-central-1"}}, }, "postgres_version": "17.6", "spock_version": "5", }, "state": "creating", "updated_at": "2025-06-18T16:52:05Z", }, "task": map[string]any{ "created_at": "2025-06-18T16:52:05Z", "database_id": "storefront", "status": "pending", "task_id": "019783f4-75f4-71e7-85a3-c9b96b345d77", "type": "create", }, }) })
View Source
var Database = g.ResultType("Database", func() { g.Attributes(func() { g.Attribute("id", Identifier, func() { g.Description("Unique identifier for the database.") g.Example("production") g.Example("my-app") g.Example("02f1a7db-fca8-4521-b57a-2a375c1ced51") }) g.Attribute("tenant_id", Identifier, func() { g.Description("Unique identifier for the databases's owner.") g.Example("engineering") g.Example("8210ec10-2dca-406c-ac4a-0661d2189954") }) g.Attribute("created_at", g.String, func() { g.Format(g.FormatDateTime) g.Description("The time that the database was created.") g.Example("2025-01-01T01:30:00Z") }) g.Attribute("updated_at", g.String, func() { g.Format(g.FormatDateTime) g.Description("The time that the database was last updated.") g.Example("2025-01-01T02:30:00Z") }) g.Attribute("state", g.String, func() { g.Description("Current state of the database.") g.Enum( "creating", "modifying", "available", "deleting", "degraded", "failed", "backing_up", "restoring", "unknown", ) }) g.Attribute("instances", g.CollectionOf(Instance), func() { g.Description("All of the instances in the database.") }) g.Attribute("spec", DatabaseSpec, func() { g.Description("The user-provided specification for the database.") }) }) g.View("default", func() { g.Attribute("id") g.Attribute("tenant_id") g.Attribute("created_at") g.Attribute("updated_at") g.Attribute("state") g.Attribute("instances", func() { g.View("default") }) g.Attribute("spec") g.Example(exampleDatabase) }) g.View("abbreviated", func() { g.Attribute("id") g.Attribute("tenant_id") g.Attribute("created_at") g.Attribute("updated_at") g.Attribute("state") g.Attribute("instances", func() { g.View("abbreviated") }) }) g.Required("id", "created_at", "updated_at", "state") })
View Source
var DatabaseNodeSpec = g.Type("DatabaseNodeSpec", func() { g.Attribute("name", g.String, func() { g.Description("The name of the database node.") g.Pattern(nodeNamePattern) g.Example("n1") }) g.Attribute("host_ids", HostIDs, func() { g.Description("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.") g.MinLength(1) }) g.Attribute("postgres_version", g.String, func() { g.Description("The Postgres version for this node in 'major.minor' format. Overrides the Postgres version set in the DatabaseSpec.") g.Pattern(postgresVersionPattern) g.Example("17.6") }) g.Attribute("port", g.Int, func() { g.Description("The port used by the Postgres database for this node. Overrides the Postgres port set in the DatabaseSpec.") g.Minimum(0) g.Maximum(65535) g.Example(5432) }) g.Attribute("cpus", g.String, func() { g.Description("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.") g.Pattern(cpuPattern) g.Example("14") g.Example("0.5") g.Example("500m") }) g.Attribute("memory", g.String, func() { g.Description("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.") g.MaxLength(16) g.Example("16GiB") g.Example("500M") }) g.Attribute("postgresql_conf", g.MapOf(g.String, g.Any), func() { g.Description("Additional postgresql.conf settings for this particular node. Will be merged with the settings provided by control-plane.") g.Example(map[string]any{ "max_connections": 1000, }) }) g.Attribute("backup_config", BackupConfigSpec, func() { g.Description("The backup configuration for this node. Overrides the backup configuration set in the DatabaseSpec.") }) g.Attribute("restore_config", RestoreConfigSpec, func() { g.Description("The restore configuration for this node. Overrides the restore configuration set in the DatabaseSpec.") }) g.Attribute("orchestrator_opts", OrchestratorOpts, func() { g.Description("Orchestrator-specific configuration options.") }) g.Attribute("source_node", g.String, func() { g.Description("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.") g.Example("n1") }) g.Required("name", "host_ids") })
View Source
var DatabaseSpec = g.Type("DatabaseSpec", func() { g.Attribute("database_name", g.String, func() { g.Description("The name of the Postgres database.") g.MinLength(1) g.MaxLength(31) g.Example("northwind") }) g.Attribute("postgres_version", g.String, func() { g.Description("The Postgres version in 'major.minor' format.") g.Pattern(postgresVersionPattern) g.Example("17.6") }) g.Attribute("spock_version", g.String, func() { g.Description("The major version of the Spock extension.") g.Pattern(spockVersionPattern) g.Example("5") }) g.Attribute("port", g.Int, func() { g.Description("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.") g.Minimum(0) g.Maximum(65535) g.Example(5432) }) g.Attribute("cpus", g.String, func() { g.Description("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.") g.Pattern(cpuPattern) g.Example("14") g.Example("0.5") g.Example("500m") }) g.Attribute("memory", g.String, func() { g.Description("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.") g.MaxLength(16) g.Example("16GiB") g.Example("500M") }) g.Attribute("nodes", g.ArrayOf(DatabaseNodeSpec), func() { g.Description("The Spock nodes for this database.") g.MinLength(1) g.MaxLength(9) }) g.Attribute("database_users", g.ArrayOf(DatabaseUserSpec), func() { g.Description("The users to create for this database.") g.MaxLength(16) }) g.Attribute("backup_config", BackupConfigSpec, func() { g.Description("The backup configuration for this database.") }) g.Attribute("restore_config", RestoreConfigSpec, func() { g.Description("The restore configuration for this database.") }) g.Attribute("postgresql_conf", g.MapOf(g.String, g.Any), func() { g.Description("Additional postgresql.conf settings. Will be merged with the settings provided by control-plane.") g.MaxLength(64) g.Example(map[string]any{ "max_connections": 1000, }) }) g.Attribute("orchestrator_opts", OrchestratorOpts, func() { g.Description("Orchestrator-specific configuration options.") }) g.Required("database_name", "nodes") })
View Source
var DatabaseUserSpec = g.Type("DatabaseUserSpec", func() { g.Attribute("username", g.String, func() { g.Description("The username for this database user.") g.Example("admin") g.MinLength(1) }) g.Attribute("password", g.String, func() { g.Description("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.") g.Example("secret") g.MinLength(1) }) g.Attribute("db_owner", g.Boolean, func() { g.Description("If true, this user will be granted database ownership.") }) g.Attribute("attributes", g.ArrayOf(g.String), func() { g.Description("The attributes to assign to this database user.") g.MaxLength(16) g.Example([]string{"LOGIN", "SUPERUSER"}) g.Example([]string{"LOGIN", "CREATEDB", "CREATEROLE"}) }) g.Attribute("roles", g.ArrayOf(g.String), func() { g.Description("The roles to assign to this database user.") g.MaxLength(16) g.Example([]string{"application"}) g.Example([]string{"application_read_only"}) g.Example([]string{"pgedge_superuser"}) }) g.Required("username") })
View Source
var DeleteDatabaseResponse = g.Type("DeleteDatabaseResponse", func() { g.Attribute("task", Task, func() { g.Description("The task that will delete this database.") }) g.Required("task") g.Example(map[string]any{ "task": map[string]any{ "created_at": "2025-06-18T16:48:59Z", "database_id": "storefront", "status": "pending", "task_id": "019783f1-9f17-77e7-9a08-fa6ab39e3b29", "type": "delete", }, }) })
View Source
var EtcdClusterMember = g.Type("EtcdClusterMember", func() { g.Attribute("name", g.String, func() { g.Description("The name of the Etcd cluster member.") g.Example("host-1") }) g.Attribute("peer_urls", g.ArrayOf(g.String), func() { g.Description("The Etcd peer endpoint for this cluster member.") g.Example([]string{"http://192.168.1.1:2380"}) }) g.Attribute("client_urls", g.ArrayOf(g.String), func() { g.Description("The Etcd client endpoint for this cluster member.") g.Example([]string{"http://192.168.1.1:2379"}) }) g.Required("name", "peer_urls", "client_urls") })
View Source
var ExtraNetworkSpec = g.Type("ExtraNetworkSpec", func() { g.Description("Describes an additional Docker network to attach the container to.") g.Attribute("id", g.String, func() { g.Description("The name or ID of the network to connect to.") g.Example("storefront") g.Example("traefik-public") }) g.Attribute("aliases", g.ArrayOf(g.String), func() { g.Description("Optional network-scoped aliases for the container.") g.MaxLength(8) g.Example([]string{"pg-db", "db-alias"}) }) g.Attribute("driver_opts", g.MapOf(g.String, g.String), func() { g.Description("Optional driver options for the network connection.") g.Example(map[string]string{ "com.docker.network.endpoint.expose": "true", }) }) g.Required("id") })
View Source
var ExtraVolumesSpec = g.Type("ExtraVolumesSpec", func() { g.Description("Extra volumes to mount from the host to the database container.") g.Attribute("host_path", g.String, func() { g.Description("The host path for the volume.") g.MaxLength(256) g.Example("/Users/user/backups/host") }) g.Attribute("destination_path", g.String, func() { g.Description("The path inside the container where the volume will be mounted.") g.MaxLength(256) g.Example("/backups/container") }) g.Required("host_path", "destination_path") })
View Source
var FailoverDatabaseNodeRequest = g.Type("FailoverDatabaseNodeRequest", func() { g.Attribute("database_id", Identifier, func() { g.Description("ID of the database to perform the failover for.") g.Example("my-app") }) g.Attribute("node_name", g.String, func() { g.Description("Name of the node to initiate the failover from.") g.Pattern(nodeNamePattern) g.Example("n1") }) g.Attribute("candidate_instance_id", g.String, func() { g.Description("Optional instance_id of the replica to promote. If omitted, a candidate will be selected.") g.Example("68f50878-44d2-4524-a823-e31bd478706d-n1-689qacsi") }) g.Attribute("skip_validation", g.Boolean, func() { g.Description("If true, skip the health validations that prevent running failover on a healthy cluster.") g.Default(false) }) g.Required("database_id", "node_name") })
View Source
var FailoverDatabaseNodeResponse = g.Type("FailoverDatabaseNodeResponse", func() { g.Attribute("task", Task, func() { g.Description("The task that will perform the failover.") }) g.Required("task") g.Example(map[string]any{ "task": map[string]any{ "created_at": "2025-06-18T17:54:28Z", "database_id": "storefront", "status": "pending", "task_id": "0197842d-9082-7496-b787-77bd2e11809f", "type": "failover", }, }) })
View Source
var Host = g.Type("Host", func() { g.Attribute("id", Identifier, func() { g.Description("Unique identifier for the host.") g.Example("host-1") g.Example("us-east-1") g.Example("de3b1388-1f0c-42f1-a86c-59ab72f255ec") }) g.Attribute("orchestrator", g.String, func() { g.Description("The orchestrator used by this host.") g.Example("swarm") }) g.Attribute("data_dir", g.String, func() { g.Description("The data directory for the host.") g.Example("/data") }) g.Attribute("cohort", HostCohort, func() { g.Description("The cohort that this host belongs to.") }) g.Attribute("hostname", g.String, func() { g.Description("The hostname of this host.") g.Example("i-0123456789abcdef.ec2.internal") }) g.Attribute("ipv4_address", func() { g.Description("The IPv4 address of this host.") g.Format(g.FormatIPv4) g.Example("10.24.34.2") }) g.Attribute("cpus", g.Int, func() { g.Description("The number of CPUs on this host.") g.Example(4) }) g.Attribute("memory", g.String, func() { g.Description("The amount of memory available on this host.") g.Example("16GiB") }) g.Attribute("status", HostStatus, func() { g.Description("Current status of the host.") }) g.Attribute("default_pgedge_version", PgEdgeVersion, func() { g.Description("The default PgEdge version for this host.") }) g.Attribute("supported_pgedge_versions", g.ArrayOf(PgEdgeVersion), func() { g.Description("The PgEdge versions supported by this host.") }) g.Required( "id", "orchestrator", "data_dir", "hostname", "ipv4_address", "status", ) })
View Source
var HostCohort = g.Type("HostCohort", func() { g.Attribute("type", g.String, func() { g.Description("The type of cohort that the host belongs to.") g.Example("swarm") }) g.Attribute("member_id", g.String, func() { g.Description("The member ID of the host within the cohort.") g.Example("lah4bsznw6kc0hp7biylmmmll") }) g.Attribute("control_available", g.Boolean, func() { g.Description("Indicates if the host is a control node in the cohort.") g.Example(true) }) g.Required("type", "member_id", "control_available") })
View Source
var HostIDs = g.ArrayOf(Identifier, func() { g.Example("host-1") g.Example("us-east-1") g.Example("de3b1388-1f0c-42f1-a86c-59ab72f255ec") })
View Source
var HostStatus = g.Type("HostStatus", func() { g.Attribute("state", g.String, func() { g.Enum("healthy", "unreachable", "degraded", "unknown") g.Example("available") }) g.Attribute("updated_at", g.String, func() { g.Format(g.FormatDateTime) g.Description("The last time the host status was updated.") g.Example("2021-07-01T12:34:56Z") }) g.Attribute("components", g.MapOf(g.String, ComponentStatus), func() { g.Description("The status of each component of the host.") }) g.Required("state", "updated_at", "components") })
View Source
var HostsArrayExample = []map[string]any{ { "cohort": map[string]any{ "cohort_id": "zdjfu3tfxg1cihv3146ro3hy2", "control_available": true, "member_id": "lah4bsznw6kc0hp7biylmmmll", "type": "swarm", }, "cpus": 16, "default_pgedge_version": map[string]any{ "postgres_version": "17.6", "spock_version": "5", }, "hostname": "i-0123456789abcdef.ec2.internal", "id": "us-east-1", "ipv4_address": "10.24.34.2", "memory": "16GB", "orchestrator": "swarm", "data_dir": "/data", "status": map[string]any{ "components": map[string]any{}, "state": "healthy", "updated_at": "2025-06-17T00:00:00Z", }, "supported_pgedge_versions": []map[string]any{ { "postgres_version": "17.6", "spock_version": "5", }, { "postgres_version": "18.1", "spock_version": "5", }, { "postgres_version": "16.10", "spock_version": "5", }, }, }, { "cohort": map[string]any{ "cohort_id": "zdjfu3tfxg1cihv3146ro3hy2", "control_available": true, "member_id": "cb88u9jael2psnepep5iuzb4r", "type": "swarm", }, "cpus": 16, "default_pgedge_version": map[string]any{ "postgres_version": "17.6", "spock_version": "5", }, "hostname": "i-058731542fee493f.ec2.internal", "id": "ap-south-1", "ipv4_address": "10.24.35.2", "memory": "16GB", "orchestrator": "swarm", "data_dir": "/data", "status": map[string]any{ "components": map[string]any{}, "state": "healthy", "updated_at": "2025-06-17T00:00:00Z", }, "supported_pgedge_versions": []map[string]any{ { "postgres_version": "17.6", "spock_version": "5", }, { "postgres_version": "18.1", "spock_version": "5", }, { "postgres_version": "16.10", "spock_version": "5", }, }, }, { "cohort": map[string]any{ "cohort_id": "zdjfu3tfxg1cihv3146ro3hy2", "control_available": true, "member_id": "u7u9i3nhqunxc4wj577l6ecb0", "type": "swarm", }, "cpus": 16, "default_pgedge_version": map[string]any{ "postgres_version": "17.6", "spock_version": "5", }, "hostname": "i-494027b7b53f6a23.ec2.internal", "id": "eu-central-1", "ipv4_address": "10.24.36.2", "memory": "16GB", "orchestrator": "swarm", "data_dir": "/data", "status": map[string]any{ "components": map[string]any{}, "state": "healthy", "updated_at": "2025-06-17T00:00:00Z", }, "supported_pgedge_versions": []map[string]any{ { "postgres_version": "17.6", "spock_version": "5", }, { "postgres_version": "18.1", "spock_version": "5", }, { "postgres_version": "16.10", "spock_version": "5", }, }, }, }
View Source
var Identifier = g.Type("Identifier", g.String, func() { g.Description("A user-specified identifier. Must be 1-63 characters, contain only lower-cased letters and hyphens, start and end with a letter or number, and not contain consecutive hyphens.") g.MinLength(1) g.MaxLength(63) g.Example("Human-readable", func() { g.Description("Identifiers can be human-readable for ease of use.") g.Value("production") }) g.Example("UUID", func() { g.Description("UUIDs are valid Identifiers.") g.Value("76f9b8c0-4958-11f0-a489-3bb29577c696") }) })
View Source
var InitClusterRequest = g.Type("InitClusterRequest", func() { g.Description("Request to initialize a cluster") g.Attribute("cluster_id", Identifier, func() { g.Description("Optional id for the cluster, omit for default generated id") }) })
View Source
var Instance = g.ResultType("Instance", func() { g.Description("An instance of pgEdge Postgres running on a host.") g.Attributes(func() { g.Attribute("id", g.String, func() { g.Description("Unique identifier for the instance.") g.Example("a67cbb36-c3c3-49c9-8aac-f4a0438a883d") }) g.Attribute("host_id", g.String, func() { g.Description("The ID of the host this instance is running on.") g.Example("de3b1388-1f0c-42f1-a86c-59ab72f255ec") }) g.Attribute("node_name", g.String, func() { g.Description("The Spock node name for this instance.") g.Example("n1") }) g.Attribute("created_at", g.String, func() { g.Format(g.FormatDateTime) g.Description("The time that the instance was created.") }) g.Attribute("updated_at", g.String, func() { g.Format(g.FormatDateTime) g.Description("The time that the instance was last modified.") }) g.Attribute("status_updated_at", g.String, func() { g.Format(g.FormatDateTime) g.Description("The time that the instance status information was last updated.") }) g.Attribute("state", g.String, func() { g.Enum( "creating", "modifying", "backing_up", "available", "degraded", "failed", "stopped", "unknown", ) }) g.Attribute("connection_info", InstanceConnectionInfo, func() { g.Description("Connection information for the instance.") }) g.Attribute("postgres", InstancePostgresStatus, func() { g.Description("Postgres status information for the instance.") }) g.Attribute("spock", InstanceSpockStatus, func() { g.Description("Spock status information for the instance.") }) g.Attribute("error", g.String, func() { g.Description("An error message if the instance is in an error state.") g.Example("failed to get patroni status: connection refused") }) }) g.View("default", func() { g.Attribute("id") g.Attribute("host_id") g.Attribute("node_name") g.Attribute("created_at") g.Attribute("updated_at") g.Attribute("status_updated_at") g.Attribute("state") g.Attribute("connection_info") g.Attribute("postgres") g.Attribute("spock") g.Attribute("error") }) g.View("abbreviated", func() { g.Attribute("id") g.Attribute("host_id") g.Attribute("node_name") g.Attribute("state") }) g.Required("id", "host_id", "node_name", "created_at", "updated_at", "state") })
View Source
var InstanceConnectionInfo = g.Type("InstanceConnectionInfo", func() { g.Description("Connection information for a pgEdge instance.") g.Attribute("hostname", g.String, func() { g.Description("The hostname of the host that's running this instance.") g.Example("i-0123456789abcdef.ec2.internal") }) g.Attribute("ipv4_address", g.String, func() { g.Description("The IPv4 address of the host that's running this instance.") g.Format(g.FormatIPv4) g.Example("10.24.34.2") }) g.Attribute("port", g.Int, func() { g.Description("The host port that Postgres is listening on for this instance.") g.Example(5432) }) })
View Source
var InstancePostgresStatus = g.Type("InstancePostgresStatus", func() { g.Description("Postgres status information for a pgEdge instance.") g.Attribute("version", g.String, func() { g.Description("The version of Postgres for this instance.") g.Example("18.1") }) g.Attribute("patroni_state", g.String, func() { g.Example("stopping") g.Example("stopped") g.Example("stop failed") g.Example("crashed") g.Example("running") g.Example("starting") g.Example("start failed") g.Example("restarting") g.Example("restart failed") g.Example("initializing new cluster") g.Example("initdb failed") g.Example("running custom bootstrap script") g.Example("custom bootstrap failed") g.Example("creating replica") g.Example("unknown") }) g.Attribute("role", g.String, func() { g.Example("replica") g.Example("primary") }) g.Attribute("pending_restart", g.Boolean, func() { g.Description("True if this instance has a pending restart from a configuration change.") }) g.Attribute("patroni_paused", g.Boolean, func() { g.Description("True if Patroni is paused for this instance.") }) })
View Source
var InstanceSpockStatus = g.Type("InstanceSpockStatus", func() { g.Description("Spock status information for a pgEdge instance.") g.Attribute("read_only", g.String, func() { g.Description("The current spock.readonly setting.") g.Example("off") }) g.Attribute("version", g.String, func() { g.Description("The version of Spock for this instance.") g.Example("4.10.0") }) g.Attribute("subscriptions", g.ArrayOf(InstanceSubscription), func() { g.Description("Status information for this instance's Spock subscriptions.") }) })
View Source
var InstanceSubscription = g.Type("InstanceSubscription", func() { g.Description("Status information for a Spock subscription.") g.Attribute("provider_node", g.String, func() { g.Description("The Spock node name of the provider for this subscription.") g.Pattern(nodeNamePattern) g.Example("n2") }) g.Attribute("name", g.String, func() { g.Description("The name of the subscription.") g.Example("sub_n1n2") }) g.Attribute("status", g.String, func() { g.Description("The current status of the subscription.") g.Example("replicating") g.Example("down") }) g.Required("provider_node", "name", "status") })
View Source
var ListDatabaseTasksResponse = g.Type("ListDatabaseTasksResponse", func() { g.Attribute("tasks", g.ArrayOf(Task)) g.Example(map[string]any{ "tasks": []map[string]any{ { "completed_at": "2025-06-18T17:54:36Z", "created_at": "2025-06-18T17:54:28Z", "database_id": "storefront", "instance_id": "storefront-n1-689qacsi", "status": "completed", "task_id": "0197842d-9082-7496-b787-77bd2e11809f", "type": "node_backup", }, { "completed_at": "2025-06-18T17:54:04Z", "created_at": "2025-06-18T17:53:17Z", "database_id": "storefront", "status": "completed", "task_id": "0197842c-7c4f-7a8c-829e-7405c2a41c8c", "type": "update", }, { "completed_at": "2025-06-18T17:23:28Z", "created_at": "2025-06-18T17:23:14Z", "database_id": "storefront", "status": "completed", "task_id": "01978410-fb5d-7cd2-bbd2-66c0bf929dc0", "type": "update", }, { "completed_at": "2025-06-18T16:52:35Z", "created_at": "2025-06-18T16:52:05Z", "database_id": "storefront", "status": "completed", "task_id": "019783f4-75f4-71e7-85a3-c9b96b345d77", "type": "create", }, }, }) })
View Source
var ListDatabasesResponse = g.ResultType("ListDatabasesResponse", func() { g.TypeName("ListDatabasesResponse") g.Attributes(func() { g.Attribute("databases", g.CollectionOf(Database), func() { g.View("abbreviated") }) g.Example(map[string]any{ "databases": []map[string]any{ { "created_at": "2025-06-17T20:05:10Z", "id": "inventory", "instances": []map[string]any{ { "host_id": "us-east-1", "id": "inventory-n1-689qacsi", "node_name": "n1", "state": "available", }, { "host_id": "ap-south-1", "id": "inventory-n2-9ptayhma", "node_name": "n2", "state": "available", }, { "host_id": "eu-central-1", "id": "inventory-n3-ant97dj4", "node_name": "n3", "state": "available", }, }, "state": "available", "updated_at": "2025-06-17T20:05:10Z", }, { "created_at": "2025-06-17T20:05:10Z", "id": "storefront", "instances": []map[string]any{ { "host_id": "us-east-1", "id": "storefront-n1-689qacsi", "node_name": "n1", "state": "available", }, { "host_id": "ap-south-1", "id": "storefront-n2-9ptayhma", "node_name": "n2", "state": "available", }, { "host_id": "eu-central-1", "id": "storefront-n3-ant97dj4", "node_name": "n3", "state": "available", }, }, "state": "available", "updated_at": "2025-06-12T15:10:05Z", }, }, }) }) })
View Source
var ListHostsResponse = g.Type("ListHostsResponse", func() { g.Description("Response containing the list of hosts") g.Attribute("hosts", g.ArrayOf(Host), "List of hosts in the cluster") g.Required("hosts") })
View Source
var ListHostsResponseExample = map[string]any{ "hosts": HostsArrayExample, }
View Source
var OrchestratorOpts = g.Type("OrchestratorOpts", func() { g.Description("Options specific to the selected orchestrator.") g.Attribute("swarm", SwarmOpts, func() { g.Description("Swarm-specific configuration.") }) })
View Source
var PgEdgeVersion = g.Type("PgEdgeVersion", func() { g.Attribute("postgres_version", g.String, func() { g.Description("The Postgres major and minor version.") g.Example("17.6") }) g.Attribute("spock_version", g.String, func() { g.Description("The Spock major version.") g.Example("5") }) g.Required("postgres_version", "spock_version") })
View Source
var RemoveHostResponse = g.Type("RemoveHostResponse", func() { g.Attribute("update_database_tasks", g.ArrayOf(Task), func() { g.Description("The tasks that will update databases affected by the host removal.") }) g.Required("update_database_tasks") })
View Source
var RestartInstanceResponse = g.Type("RestartInstanceResponse", func() { g.Description("Response containing the restart task") g.Attribute("task", Task, "Task representing the restart operation") g.Required("task") })
View Source
var RestoreConfigSpec = g.Type("RestoreConfigSpec", func() { g.Attribute("source_database_id", Identifier, func() { g.Description("The ID of the database to restore this database from.") g.Example("production") g.Example("my-app") g.Example("02f1a7db-fca8-4521-b57a-2a375c1ced51") }) g.Attribute("source_node_name", g.String, func() { g.Description("The name of the node to restore this database from.") g.Pattern(nodeNamePattern) g.Example("n1") }) g.Attribute("source_database_name", g.String, func() { g.Description("The name of the database in this repository. The database will be renamed to the database_name in the DatabaseSpec after it's restored.") g.MinLength(1) g.MaxLength(31) g.Example("northwind") }) g.Attribute("repository", RestoreRepositorySpec, func() { g.Description("The repository to restore this database from.") }) g.Attribute("restore_options", g.MapOf(g.String, g.String), func() { g.Description("Additional options to use when restoring this database. If omitted, the database will be restored to the latest point in the given repository.") g.MaxLength(32) g.Example(map[string]string{ "type": "time", "target": "2025-01-01T01:30:00Z", }) g.Example(map[string]string{ "type": "lsn", "target": "0/30000000", }) g.Example(map[string]string{ "set": "20250505-153628F", "type": "xid", "target": "123456", }) }) g.Required("source_database_id", "source_node_name", "source_database_name", "repository") })
View Source
var RestoreDatabaseRequest = g.Type("RestoreDatabaseRequest", func() { g.Attribute("restore_config", RestoreConfigSpec, func() { g.Description("Configuration for the restore process.") }) g.Attribute("target_nodes", g.ArrayOf(g.String), func() { g.Description("The nodes to restore. Defaults to all nodes if empty or unspecified.") g.MaxLength(9) g.Example([]string{"n1", "n2"}) g.Example([]string{"n1"}) }) g.Required("restore_config") g.Example("Restore all nodes", func() { g.Description("If the target_nodes field is omitted from the request, all nodes will be restored using the given restore_config.") g.Value(map[string]any{ "restore_config": map[string]any{ "source_database_id": "storefront", "source_node_name": "n1", "source_database_name": "storefront", "repository": map[string]any{ "type": "posix", "base_path": "/backups", }, }, }) }) g.Example("Restore n1 only", func() { g.Description("Example of restoring a single target node.") g.Value(map[string]any{ "target_nodes": []string{"n1"}, "restore_config": map[string]any{ "source_database_id": "storefront", "source_node_name": "n1", "source_database_name": "storefront", "repository": map[string]any{ "type": "posix", "base_path": "/backups", }, }, }) }) })
View Source
var RestoreDatabaseResponse = g.Type("RestoreDatabaseResponse", func() { g.Attribute("task", Task, func() { g.Description("The task that will restore this database.") }) g.Attribute("node_tasks", g.ArrayOf(Task), func() { g.Description("The tasks that will restore each database node.") }) g.Attribute("database", Database, func() { g.Description("The database being restored.") }) g.Required("task", "node_tasks", "database") g.Example(map[string]any{ "database": exampleDatabase, "node_tasks": []map[string]any{ { "created_at": "2025-06-18T17:58:59Z", "database_id": "storefront", "node_name": "n1", "parent_id": "01978431-b628-758a-aec6-03b331fa1a17", "status": "pending", "task_id": "01978431-b62b-723b-a09c-e4072cd64bdb", "type": "node_restore", }, { "created_at": "2025-06-18T17:58:59Z", "database_id": "storefront", "node_name": "n2", "parent_id": "01978431-b628-758a-aec6-03b331fa1a17", "status": "pending", "task_id": "01978431-b62c-7593-aad8-43b03df2031b", "type": "node_restore", }, { "created_at": "2025-06-18T17:58:59Z", "database_id": "storefront", "node_name": "n3", "parent_id": "01978431-b628-758a-aec6-03b331fa1a17", "status": "pending", "task_id": "01978431-b62d-7b65-ab09-272d0b2fea91", "type": "node_restore", }, }, "task": map[string]any{ "created_at": "2025-06-18T17:58:59Z", "database_id": "storefront", "status": "pending", "task_id": "01978431-b628-758a-aec6-03b331fa1a17", "type": "restore", }, }) })
View Source
var RestoreRepositorySpec = g.Type("RestoreRepositorySpec", func() { g.Attribute("id", Identifier, func() { g.Description("The unique identifier of this repository.") g.Example("my-app-1") g.Example("f6b84a99-5e91-4203-be1e-131fe82e5984") }) g.Attribute("type", g.String, func() { g.Description("The type of this repository.") g.Enum("s3", "gcs", "azure", "posix", "cifs") g.Example("s3") }) g.Attribute("s3_bucket", g.String, func() { g.Description("The S3 bucket name for this repository. Only applies when type = 's3'.") g.MinLength(3) g.MaxLength(63) g.Example("pgedge-backups-9f81786f-373b-4ff2-afee-e054a06a96f1") }) g.Attribute("s3_region", g.String, func() { g.Description("The region of the S3 bucket for this repository. Only applies when type = 's3'.") g.MinLength(1) g.MaxLength(32) g.Example("us-east-1") }) g.Attribute("s3_endpoint", g.String, func() { g.Description("The optional S3 endpoint for this repository. Only applies when type = 's3'.") g.MinLength(3) g.MaxLength(128) g.Example("s3.us-east-1.amazonaws.com") }) g.Attribute("s3_key", g.String, func() { g.Description("An optional AWS access key ID to use for this repository. If not provided, pgbackrest will use the default credential provider chain.") g.MaxLength(128) g.Example("AKIAIOSFODNN7EXAMPLE") }) g.Attribute("s3_key_secret", g.String, func() { g.Description("The corresponding secret for the AWS access key ID in s3_key.") g.MaxLength(128) g.Example("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY") }) g.Attribute("gcs_bucket", g.String, func() { g.Description("The GCS bucket name for this repository. Only applies when type = 'gcs'.") g.MinLength(3) g.MaxLength(63) g.Example("pgedge-backups-9f81786f-373b-4ff2-afee-e054a06a96f1") }) g.Attribute("gcs_endpoint", g.String, func() { g.Description("The optional GCS endpoint for this repository. Only applies when type = 'gcs'.") g.MinLength(3) g.MaxLength(128) g.Example("localhost") }) g.Attribute("gcs_key", g.String, func() { g.Description("Optional base64-encoded private key data. If omitted, pgbackrest will use the service account attached to the instance profile.") g.MaxLength(1024) g.Example("ZXhhbXBsZSBnY3Mga2V5Cg==") }) g.Attribute("azure_account", g.String, func() { g.Description("The Azure account name for this repository. Only applies when type = 'azure'.") g.MinLength(3) g.MaxLength(24) g.Example("pgedge-backups") }) g.Attribute("azure_container", g.String, func() { g.Description("The Azure container name for this repository. Only applies when type = 'azure'.") g.MinLength(3) g.MaxLength(63) g.Example("pgedge-backups-9f81786f-373b-4ff2-afee-e054a06a96f1") }) g.Attribute("azure_endpoint", g.String, func() { g.Description("The optional Azure endpoint for this repository. Only applies when type = 'azure'.") g.MinLength(3) g.MaxLength(128) g.Example("blob.core.usgovcloudapi.net") }) g.Attribute("azure_key", g.String, func() { g.Description("An optional Azure storage account access key to use for this repository. If not provided, pgbackrest will use the VM's managed identity.") g.MaxLength(128) g.Example("YXpLZXk=") }) g.Attribute("base_path", g.String, func() { g.Description("The base path within the repository to store backups. Required for type = 'posix' and 'cifs'.") g.MaxLength(256) g.Example("/backups") }) g.Attribute("custom_options", g.MapOf(g.String, g.String), func() { g.Description("Additional options to apply to this repository.") g.Example(map[string]any{ "s3-kms-key-id": "1234abcd-12ab-34cd-56ef-1234567890ab", }) }) g.Required("type") })
View Source
var StartInstanceResponse = g.Type("StartInstanceResponse", func() { g.Description("Response containing the start task") g.Attribute("task", Task, "Task representing the start operation") g.Required("task") })
View Source
var StopInstanceResponse = g.Type("StopInstanceResponse", func() { g.Description("Response containing the stop task") g.Attribute("task", Task, "Task representing the stop operation") g.Required("task") })
View Source
var SwarmOpts = g.Type("SwarmOpts", func() { g.Description("Docker Swarm-specific options.") g.Attribute("extra_volumes", g.ArrayOf(ExtraVolumesSpec), func() { g.Description("A list of extra volumes to mount. Each entry defines a host and container path.") g.MaxLength(16) }) g.Attribute("extra_networks", g.ArrayOf(ExtraNetworkSpec), func() { g.Description("A list of additional Docker Swarm networks to attach containers in this database to.") g.MaxLength(8) }) g.Attribute("extra_labels", g.MapOf(g.String, g.String), func() { g.Description("Arbitrary labels to apply to the Docker Swarm service") g.Example(map[string]string{ "traefik.enable": "true", "traefik.tcp.routers.mydb.rule": "HostSNI(`mydb.example.com`)", }) }) })
View Source
var SwitchoverDatabaseNodeRequest = g.Type("SwitchoverDatabaseNodeRequest", func() { g.Attribute("database_id", Identifier, func() { g.Description("ID of the database to perform the switchover for.") g.Example("my-app") }) g.Attribute("node_name", g.String, func() { g.Description("Name of the node to initiate the switchover from (informational).") g.Pattern(nodeNamePattern) g.Example("n1") }) g.Attribute("candidate_instance_id", g.String, func() { g.Description("Optional instance_id of the replica to promote. If omitted, a candidate will be selected.") g.Example("3c875a27-f6a6-4c1c-ba5f-6972fb1fc348") }) g.Attribute("scheduled_at", g.String, func() { g.Description("Optional ISO8601 datetime when the switchover should occur. If omitted the switchover occurs immediately.") g.Format(g.FormatDateTime) g.Example("2025-09-20T22:00:00+05:30") }) g.Required("database_id", "node_name") })
View Source
var SwitchoverDatabaseNodeResponse = g.Type("SwitchoverDatabaseNodeResponse", func() { g.Attribute("task", Task, func() { g.Description("The task that will perform the switchover.") }) g.Required("task") g.Example(map[string]any{ "task": map[string]any{ "created_at": "2025-06-18T17:54:28Z", "database_id": "storefront", "status": "pending", "task_id": "0197842d-9082-7496-b787-77bd2e11809f", "type": "switchover", }, }) })
View Source
var Task = g.Type("Task", func() { g.Attribute("parent_id", g.String, func() { g.Format(g.FormatUUID) g.Description("The parent task ID of the task.") g.Example("439eb515-e700-4740-b508-4a3f12ec4f83") }) g.Attribute("database_id", g.String, func() { g.Description("The database ID of the task.") g.Example("02f1a7db-fca8-4521-b57a-2a375c1ced51") }) g.Attribute("node_name", g.String, func() { g.Description("The name of the node that the task is operating on.") g.Example("n1") }) g.Attribute("instance_id", g.String, func() { g.Description("The ID of the instance that the task is operating on.") g.Example("3c875a27-f6a6-4c1c-ba5f-6972fb1fc348") }) g.Attribute("host_id", g.String, func() { g.Description("The ID of the host that the task is running on.") g.Example("2e52dcde-86d8-4f71-b58e-8dc3a10c936a") }) g.Attribute("task_id", g.String, func() { g.Format(g.FormatUUID) g.Description("The unique ID of the task.") g.Example("3c875a27-f6a6-4c1c-ba5f-6972fb1fc348") }) g.Attribute("created_at", g.String, func() { g.Format(g.FormatDateTime) g.Description("The time when the task was created.") g.Example("2025-01-01T01:30:00Z") }) g.Attribute("completed_at", g.String, func() { g.Format(g.FormatDateTime) g.Description("The time when the task was completed.") g.Example("2025-01-01T02:30:00Z") }) g.Attribute("type", g.String, func() { g.Description("The type of the task.") g.Example("backup", "restore") }) g.Attribute("status", g.String, func() { g.Enum("pending", "running", "completed", "canceled", "canceling", "failed", "unknown") g.Description("The status of the task.") g.Example("pending") }) g.Attribute("error", g.String, func() { g.Description("The error message if the task failed.") g.Example("failed to connect to database") }) g.Required("database_id", "task_id", "created_at", "type", "status") g.Example(map[string]any{ "completed_at": "2025-06-18T16:52:35Z", "created_at": "2025-06-18T16:52:05Z", "database_id": "storefront", "status": "completed", "task_id": "019783f4-75f4-71e7-85a3-c9b96b345d77", "type": "create", }) })
View Source
var TaskLog = g.Type("TaskLog", func() { g.Attribute("database_id", g.String, func() { g.Description("The database ID of the task log.") g.Example("02f1a7db-fca8-4521-b57a-2a375c1ced51") }) g.Attribute("task_id", g.String, func() { g.Description("The unique ID of the task log.") g.Example("3c875a27-f6a6-4c1c-ba5f-6972fb1fc348") }) g.Attribute("task_status", g.String, func() { g.Enum("pending", "running", "completed", "failed", "unknown", "canceled", "canceling") g.Description("The status of the task.") g.Example("pending") }) g.Attribute("last_entry_id", g.String, func() { g.Description("The ID of the last entry in the task log.") g.Example("3c875a27-f6a6-4c1c-ba5f-6972fb1fc348") }) g.Attribute("entries", g.ArrayOf(TaskLogEntry), func() { g.Description("Entries in the task log.") }) g.Required("database_id", "task_id", "task_status", "entries") g.Example("node_backup task log", func() { g.Description("The task log from a 'node_backup' task. These messages are produced by pgbackrest.") g.Value(map[string]any{ "database_id": "storefront", "entries": []map[string]any{ { "message": "P00 INFO: backup command begin 2.55.1: --config=/opt/pgedge/configs/pgbackrest.backup.conf --exec-id=198-b17fae6e --log-level-console=info --no-log-timestamp --pg1-path=/opt/pgedge/data/pgdata --pg1-user=pgedge --repo1-cipher-type=none --repo1-path=/backups/databases/storefront/n1 --repo1-retention-full=7 --repo1-retention-full-type=time --repo1-type=posix --stanza=db --start-fast --type=full", "timestamp": "2025-06-18T17:54:34Z", }, { "message": "P00 INFO: execute non-exclusive backup start: backup begins after the requested immediate checkpoint completes", "timestamp": "2025-06-18T17:54:34Z", }, { "message": "P00 INFO: backup start archive = 000000020000000000000004, lsn = 0/4000028", "timestamp": "2025-06-18T17:54:34Z", }, { "message": "P00 INFO: check archive for prior segment 000000020000000000000003", "timestamp": "2025-06-18T17:54:34Z", }, { "message": "P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive", "timestamp": "2025-06-18T17:54:36Z", }, { "message": "P00 INFO: backup stop archive = 000000020000000000000004, lsn = 0/4000120", "timestamp": "2025-06-18T17:54:36Z", }, { "message": "P00 INFO: check archive for segment(s) 000000020000000000000004:000000020000000000000004", "timestamp": "2025-06-18T17:54:36Z", }, { "message": "P00 INFO: new backup label = 20250618-175434F", "timestamp": "2025-06-18T17:54:36Z", }, { "message": "P00 INFO: full backup size = 30.6MB, file total = 1342", "timestamp": "2025-06-18T17:54:36Z", }, { "message": "P00 INFO: backup command end: completed successfully", "timestamp": "2025-06-18T17:54:36Z", }, { "message": "P00 INFO: expire command begin 2.55.1: --config=/opt/pgedge/configs/pgbackrest.backup.conf --exec-id=198-b17fae6e --log-level-console=info --no-log-timestamp --repo1-cipher-type=none --repo1-path=/backups/databases/storefront/n1 --repo1-retention-full=7 --repo1-retention-full-type=time --repo1-type=posix --stanza=db", "timestamp": "2025-06-18T17:54:36Z", }, { "message": "P00 INFO: repo1: time-based archive retention not met - archive logs will not be expired", "timestamp": "2025-06-18T17:54:36Z", }, { "message": "P00 INFO: expire command end: completed successfully", "timestamp": "2025-06-18T17:54:36Z", }, }, "last_entry_id": "0197842d-b14d-7c69-86c1-c006a7c65318", "task_id": "0197842d-9082-7496-b787-77bd2e11809f", "task_status": "completed", }) }) g.Example("update task log", func() { g.Description("This is the task log of an update task. This example excludes many entries for brevity.") g.Value(map[string]any{ "database_id": "storefront", "entries": []map[string]any{ { "message": "refreshing current state", "timestamp": "2025-06-18T17:53:19Z", }, { "fields": map[string]any{ "duration_ms": 8972, }, "message": "finished refreshing current state (took 8.972080116s)", "timestamp": "2025-06-18T17:53:28Z", }, { "fields": map[string]any{ "host_id": "host-1", "resource_id": "storefront-n1-689qacsi-backup", "resource_type": "swarm.pgbackrest_config", }, "message": "creating resource swarm.pgbackrest_config::storefront-n1-689qacsi-backup", "timestamp": "2025-06-18T17:53:29Z", }, { "fields": map[string]any{ "host_id": "host-2", "resource_id": "storefront-n2-9ptayhma-backup", "resource_type": "swarm.pgbackrest_config", }, "message": "creating resource swarm.pgbackrest_config::storefront-n2-9ptayhma-backup", "timestamp": "2025-06-18T17:53:29Z", }, { "fields": map[string]any{ "duration_ms": 383, "host_id": "host-3", "resource_id": "n3", "resource_type": "swarm.pgbackrest_stanza", "success": true, }, "message": "finished creating resource swarm.pgbackrest_stanza::n3 (took 383.568613ms)", "timestamp": "2025-06-18T17:54:02Z", }, { "fields": map[string]any{ "duration_ms": 1181, "host_id": "host-1", "resource_id": "n1", "resource_type": "swarm.pgbackrest_stanza", "success": true, }, "message": "finished creating resource swarm.pgbackrest_stanza::n1 (took 1.181454868s)", "timestamp": "2025-06-18T17:54:03Z", }, }, "last_entry_id": "0197842d-303b-7251-b814-6d12c98e7d25", "task_id": "0197842c-7c4f-7a8c-829e-7405c2a41c8c", "task_status": "completed", }) }) })
View Source
var TaskLogEntry = g.Type("TaskLogEntry", func() { g.Attribute("timestamp", g.String, func() { g.Format(g.FormatDateTime) g.Description("The timestamp of the log entry.") g.Example("2025-05-29T15:43:13Z") }) g.Attribute("message", g.String, func() { g.Description("The log message.") g.Example("task started") }) g.Attribute("fields", g.MapOf(g.String, g.Any), func() { g.Description("Additional fields for the log entry.") g.Example(map[string]any{ "status": "creating", "option.enabled": true, }) }) g.Required("timestamp", "message") })
View Source
var UpdateDatabaseRequest = g.Type("UpdateDatabaseRequest", func() { g.Attribute("tenant_id", Identifier, func() { g.Description("Unique identifier for the databases's owner.") g.Example("engineering") g.Example("8210ec10-2dca-406c-ac4a-0661d2189954") }) g.Attribute("spec", DatabaseSpec, func() { g.Description("The specification for the database.") }) g.Example("Minimal", func() { g.Value(map[string]any{ "spec": map[string]any{ "database_name": "storefront", "port": 5432, "database_users": []map[string]any{ { "username": "admin", "db_owner": true, "attributes": []string{"LOGIN", "SUPERUSER"}, }, }, "nodes": []map[string]any{ {"name": "n1", "host_ids": []string{"us-east-1"}}, {"name": "n2", "host_ids": []string{"ap-south-1"}}, {"name": "n3", "host_ids": []string{"eu-central-1"}}, }, }, }) }) g.Example("Adding a new node from a Cloud backup", func() { g.Description("This update request adds a new node, n3, to an existing two-node cluster using the latest backup of n1.") g.Value(map[string]any{ "spec": map[string]any{ "database_name": "storefront", "port": 5432, "database_users": []map[string]any{ { "username": "admin", "db_owner": true, "attributes": []string{"LOGIN", "SUPERUSER"}, }, }, "nodes": []map[string]any{ { "name": "n1", "host_ids": []string{"us-east-1"}, "backup_config": map[string]any{ "repositories": []map[string]any{ { "type": "s3", "s3_bucket": "storefront-db-backups-us-east-1", }, }, }, }, { "name": "n2", "host_ids": []string{"ap-south-1"}, "backup_config": map[string]any{ "repositories": []map[string]any{ { "type": "s3", "s3_bucket": "storefront-db-backups-ap-south-1", }, }, }, }, { "name": "n3", "host_ids": []string{"eu-central-1"}, "backup_config": map[string]any{ "repositories": []map[string]any{ { "type": "s3", "s3_bucket": "storefront-db-backups-eu-central-1", }, }, }, "restore_config": map[string]any{ "source_database_id": "storefront", "source_database_name": "storefront", "source_node_name": "n1", "repository": map[string]any{ "type": "s3", "s3_bucket": "storefront-db-backups-us-east-1", }, }, }, }, }, }) }) g.Required("spec") })
View Source
var UpdateDatabaseResponse = g.Type("UpdateDatabaseResponse", func() { g.Attribute("task", Task, func() { g.Description("The task that will update this database.") }) g.Attribute("database", Database, func() { g.Description("The database being updated.") }) g.Required("task", "database") g.Example(map[string]any{ "database": exampleDatabase, "task": map[string]any{ "created_at": "2025-06-18T17:23:14Z", "database_id": "storefront", "status": "pending", "task_id": "01978410-fb5d-7cd2-bbd2-66c0bf929dc0", "type": "update", }, }) })
View Source
var VersionInfo = g.Type("VersionInfo", func() { g.Attribute("version", g.String, func() { g.Description("The version of the API server.") g.Example("1.0.0") }) g.Attribute("revision", g.String, func() { g.Description("The VCS revision of the API server.") g.Example("e89ae93b") }) g.Attribute("revision_time", g.String, func() { g.Format(g.FormatDateTime) g.Description("The timestamp associated with the revision.") g.Example("2025-01-01T01:30:00Z") }) g.Attribute("arch", g.String, func() { g.Description("The CPU architecture of the API server.") g.Example("amd64") }) g.Required("version", "revision", "revision_time", "arch") })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.