planetscale

package
Version: v0.178.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 17 Imported by: 7

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL = "https://api.planetscale.com/"
)

Variables

This section is empty.

Functions

func NewAuditLogsService added in v0.35.0

func NewAuditLogsService(client *Client) *auditlogsService

func NewBackupsService

func NewBackupsService(client *Client) *backupsService

func NewBranchInfrastructureService added in v0.152.0

func NewBranchInfrastructureService(client *Client) *branchInfrastructureService

func NewDatabaseBranchesService

func NewDatabaseBranchesService(client *Client) *databaseBranchesService

func NewDatabasesService

func NewDatabasesService(client *Client) *databasesService

func NewDeployRequestsService

func NewDeployRequestsService(client *Client) *deployRequestsService

func NewKeyspacesService added in v0.114.0

func NewKeyspacesService(client *Client) *keyspacesService

func NewOrganizationsService

func NewOrganizationsService(client *Client) *organizationsService

func NewPasswordsService added in v0.40.0

func NewPasswordsService(client *Client) *passwordsService

func NewPostgresBranchesService added in v0.134.0

func NewPostgresBranchesService(client *Client) *postgresBranchesService

func NewPostgresRolesService added in v0.138.0

func NewPostgresRolesService(client *Client) *postgresRolesService

func NewQueryPatternsService added in v0.175.0

func NewQueryPatternsService(client *Client) *queryPatternsService

func NewRegionsSevice added in v0.29.0

func NewRegionsSevice(client *Client) *regionsService

func NewTrafficBudgetsService added in v0.156.0

func NewTrafficBudgetsService(client *Client) *trafficBudgetsService

NewTrafficBudgetsService returns a TrafficBudgetsService backed by client.

func NewTrafficRulesService added in v0.156.0

func NewTrafficRulesService(client *Client) *trafficRulesService

NewTrafficRulesService returns a TrafficRulesService backed by client.

func NewWorkflowsService added in v0.126.0

func NewWorkflowsService(client *Client) *workflowsService

Types

type Actor added in v0.83.0

type Actor struct {
	Type string `json:"type"`
	ID   string `json:"id"`
	Name string `json:"display_name"`
}

Actor represents a user or service token

type AddServiceTokenAccessRequest

type AddServiceTokenAccessRequest struct {
	Organization string   `json:"-"`
	ID           string   `json:"-"`
	Database     string   `json:"database"`
	Accesses     []string `json:"access"`
}

type ApplyDeployRequestRequest added in v0.71.0

type ApplyDeployRequestRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`
}

type AuditLog added in v0.35.0

type AuditLog struct {
	ID   string `json:"id"`
	Type string `json:"type"`

	ActorID          string `json:"actor_id"`
	ActorType        string `json:"actor_type"`
	ActorDisplayName string `json:"actor_display_name"`

	AuditableID          string `json:"auditable_id"`
	AuditableType        string `json:"auditable_type"`
	AuditableDisplayName string `json:"auditable_display_name"`

	AuditAction string `json:"audit_action"`
	Action      string `json:"action"`

	Location string `json:"location"`
	RemoteIP string `json:"remote_ip"`

	TargetID          string `json:"target_id"`
	TargetType        string `json:"target_type"`
	TargetDisplayName string `json:"target_display_name"`

	Metadata map[string]interface{} `json:"metadata"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

AuditLog represents a PlanetScale audit log.

type AuditLogEvent added in v0.35.0

type AuditLogEvent string

AuditLogEvent represents an audit log's event type

const (
	AuditLogEventBranchCreated                 AuditLogEvent = "branch.created"
	AuditLogEventBranchDeleted                 AuditLogEvent = "branch.deleted"
	AuditLogEventDatabaseCreated               AuditLogEvent = "database.created"
	AuditLogEventDatabaseDeleted               AuditLogEvent = "database.deleted"
	AuditLogEventDeployRequestApproved         AuditLogEvent = "deploy_request.approved"
	AuditLogEventDeployRequestClosed           AuditLogEvent = "deploy_request.closed"
	AuditLogEventDeployRequestCreated          AuditLogEvent = "deploy_request.created"
	AuditLogEventDeployRequestDeleted          AuditLogEvent = "deploy_request.deleted"
	AuditLogEventDeployRequestQueued           AuditLogEvent = "deploy_request.queued"
	AuditLogEventDeployRequestUnqueued         AuditLogEvent = "deploy_request.unqueued"
	AuditLogEventIntegrationCreated            AuditLogEvent = "integration.created"
	AuditLogEventIntegrationDeleted            AuditLogEvent = "integration.deleted"
	AuditLogEventOrganizationInvitationCreated AuditLogEvent = "organization_invitation.created"
	AuditLogEventOrganizationInvitationDeleted AuditLogEvent = "organization_invitation.deleted"
	AuditLogEventOrganizationMembershipCreated AuditLogEvent = "organization_membership.created"
	AuditLogEventOrganizationJoined            AuditLogEvent = "organization.joined"
	AuditLogEventOrganizationRemovedMember     AuditLogEvent = "organization.removed_member"
	AuditLogEventOrganizationDisabledSSO       AuditLogEvent = "organization.disabled_sso"
	AuditLogEventOrganizationEnabledSSO        AuditLogEvent = "organization.enabled_sso"
	AuditLogEventOrganizationUpdatedRole       AuditLogEvent = "organization.updated_role"
	AuditLogEventServiceTokenCreated           AuditLogEvent = "service_token.created"
	AuditLogEventServiceTokenDeleted           AuditLogEvent = "service_token.deleted"
	AuditLogEventServiceTokenGrantedAccess     AuditLogEvent = "service_token.granted_access"
)

type AuditLogsService added in v0.35.0

type AuditLogsService interface {
	List(context.Context, *ListAuditLogsRequest, ...ListOption) (*CursorPaginatedResponse[*AuditLog], error)
}

AuditLogsService is an interface for communicating with the PlanetScale AuditLogs API endpoints.

type AutoApplyDeployRequestRequest added in v0.71.0

type AutoApplyDeployRequestRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`
	Enable       bool   `json:"-"`
}

type Backup

type Backup struct {
	PublicID    string    `json:"id"`
	Name        string    `json:"name"`
	State       string    `json:"state"`
	Size        int64     `json:"size"`
	Actor       *Actor    `json:"actor"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	StartedAt   time.Time `json:"started_at"`
	ExpiresAt   time.Time `json:"expires_at"`
	CompletedAt time.Time `json:"completed_at"`
}

type BackupsService

BackupsService is an interface for communicating with the PlanetScale backup API endpoint.

type BillingPlan added in v0.62.0

type BillingPlan int
const (
	HobbyPlan BillingPlan = iota
	ScalerProPlan
)

func (BillingPlan) String added in v0.62.0

func (bp BillingPlan) String() string

type BranchInfraPod added in v0.152.0

type BranchInfraPod struct {
	Name         string     `json:"name"`
	Status       string     `json:"status"`
	Component    string     `json:"component"`
	Ready        string     `json:"ready"`
	RestartCount int        `json:"restart_count"`
	CreatedAt    *time.Time `json:"created_at"`
	Cell         string     `json:"cell"`
	Size         string     `json:"size"`
	Keyspace     *string    `json:"keyspace"`
	Shard        *string    `json:"shard"`
	TabletType   *string    `json:"tablet_type"`
}

BranchInfraPod represents a single pod in the branch infrastructure.

type BranchInfrastructure added in v0.152.0

type BranchInfrastructure struct {
	Type     string
	Vitess   *VitessBranchInfrastructure
	Postgres *PostgresBranchInfrastructure
}

BranchInfrastructure represents the infrastructure for a branch. Exactly one of Vitess or Postgres is set, depending on the branch's database engine.

func (*BranchInfrastructure) UnmarshalJSON added in v0.177.0

func (b *BranchInfrastructure) UnmarshalJSON(data []byte) error

type BranchInfrastructureService added in v0.152.0

type BranchInfrastructureService interface {
	Get(ctx context.Context, req *GetBranchInfrastructureRequest) (*BranchInfrastructure, error)
}

BranchInfrastructureService is an interface for interacting with the branch infrastructure API.

type BranchRoutingRulesRequest added in v0.97.0

type BranchRoutingRulesRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

type BranchSchemaRequest

type BranchSchemaRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"-"`
}

BranchSchemaRequest encapsulates a request for getting a branch's schema.

type CancelDataImportRequest added in v0.58.0

type CancelDataImportRequest struct {
	Organization string
	Database     string
}

type CancelDeployRequestRequest

type CancelDeployRequestRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`
}

type CancelKeyspaceResizeRequest added in v0.109.0

type CancelKeyspaceResizeRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"-"`
}

type CancelWorkflowRequest added in v0.128.0

type CancelWorkflowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	WorkflowNumber uint64 `json:"-"`
}

type Client

type Client struct {

	// UserAgent is the version of the planetscale-go library that is being used
	UserAgent string

	AuditLogs             AuditLogsService
	Backups               BackupsService
	BranchInfrastructure  BranchInfrastructureService
	D1ImportNotifications D1ImportNotificationsService
	DatabaseBranches      DatabaseBranchesService
	Databases             DatabasesService
	DataImports           DataImportsService
	DeployRequests        DeployRequestsService
	Keyspaces             KeyspacesService
	LookupVindex          LookupVindexService
	Materialize           MaterializeService
	MoveTables            MoveTablesService
	Organizations         OrganizationsService
	Passwords             PasswordsService
	PlannedReparentShard  PlannedReparentShardService
	PostgresBranches      PostgresBranchesService
	PostgresRoles         PostgresRolesService
	Processlist           ProcesslistService
	QueryPatterns         QueryPatternsService
	Regions               RegionsService
	SchemaRecommendations SchemaRecommendationService
	ServiceTokens         ServiceTokenService
	TrafficBudgets        TrafficBudgetsService
	TrafficRules          TrafficRulesService
	VDiff                 VDiffService
	Vtctld                VtctldService
	Webhooks              WebhooksService
	Workflows             WorkflowsService
	// contains filtered or unexported fields
}

Client encapsulates a client that talks to the PlanetScale API

func NewClient

func NewClient(opts ...ClientOption) (*Client, error)

NewClient instantiates an instance of the PlanetScale API client.

type ClientOption

type ClientOption func(c *Client) error

ClientOption provides a variadic option for configuring the client

func WithAccessToken

func WithAccessToken(token string) ClientOption

WithAccessToken configures a client with the given PlanetScale access token.

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the base URL for the API.

func WithHTTPClient

func WithHTTPClient(client *http.Client) ClientOption

WithHTTPClient configures the PlanetScale client with the given HTTP client.

func WithRequestHeaders added in v0.67.0

func WithRequestHeaders(headers map[string]string) ClientOption

WithRequestHeaders sets the request headers for every HTTP request.

func WithServiceToken

func WithServiceToken(name, token string) ClientOption

WithServiceToken configures a client with the given PlanetScale Service Token

func WithUserAgent added in v0.67.0

func WithUserAgent(userAgent string) ClientOption

WithUserAgent overrides the User-Agent header.

type CloseDeployRequestRequest

type CloseDeployRequestRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`
}

type CloseRequest

type CloseRequest struct {
	State string `json:"state"`
}

type ClosedByDeployRequest added in v0.164.0

type ClosedByDeployRequest struct {
	ID       string `json:"id"`
	BranchID string `json:"branch_id"`
	Number   int    `json:"number"`
}

type ClusterSKU added in v0.119.0

type ClusterSKU struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	CPU         string `json:"cpu"`
	Memory      int64  `json:"ram"`

	SortOrder int64 `json:"sort_order"`

	Storage *int64 `json:"storage"`

	Rate                 *int64  `json:"rate"`
	ReplicaRate          *int64  `json:"replica_rate"`
	ProviderInstanceType *string `json:"provider_instance_type"`
	Provider             *string `json:"provider"`
	Enabled              bool    `json:"enabled"`
	DefaultVTGate        string  `json:"default_vtgate"`
	DefaultVTGateRate    *int64  `json:"default_vtgate_rate"`

	Metal bool `json:"metal"`
}

ClusterSKU represents a SKU for a PlanetScale cluster

type CompleteWorkflowRequest added in v0.128.0

type CompleteWorkflowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	WorkflowNumber uint64 `json:"-"`
}

type CreateBackupRequest

type CreateBackupRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	Name           string `json:"name,omitempty"`
	RetentionUnit  string `json:"retention_unit,omitempty"`
	RetentionValue int    `json:"retention_value,omitempty"`
	Emergency      bool   `json:"emergency,omitempty"`
}

type CreateD1ImportNotificationRequest added in v0.172.0

type CreateD1ImportNotificationRequest struct {
	Organization string
	Database     string
	BranchName   string
	MigrationID  string
	Event        string
	Method       string
	ExportBytes  int64
	TableCount   int
	Matched      *bool
	DurationMs   int64
	Error        string
	ErrorCode    string
	Stage        string
	Message      string
}

type CreateDatabaseBranchRequest

type CreateDatabaseBranchRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Region       string `json:"region,omitempty"`
	Name         string `json:"name"`
	ParentBranch string `json:"parent_branch"`
	BackupID     string `json:"backup_id,omitempty"`
	SeedData     string `json:"seed_data,omitempty"`
	ClusterSize  string `json:"cluster_size,omitempty"`
}

CreateDatabaseBranchRequest encapsulates the request for creating a new database branch

type CreateDatabaseRequest

type CreateDatabaseRequest struct {
	Organization string
	Name         string         `json:"name"`
	Notes        string         `json:"notes,omitempty"`
	Region       string         `json:"region,omitempty"`
	ClusterSize  string         `json:"cluster_size,omitempty"`
	Kind         DatabaseEngine `json:"kind,omitempty"`
	Replicas     *int           `json:"replicas,omitempty"`
	MajorVersion string         `json:"major_version,omitempty"`
	Storage      *StorageConfig `json:"storage,omitempty"`
}

CreateDatabaseRequest encapsulates the request for creating a new database.

type CreateDeployRequestRequest

type CreateDeployRequestRequest struct {
	Organization     string `json:"-"`
	Database         string `json:"-"`
	Branch           string `json:"branch"`
	IntoBranch       string `json:"into_branch,omitempty"`
	Notes            string `json:"notes"`
	AutoCutover      bool   `json:"auto_cutover,omitempty"`
	AutoDeleteBranch bool   `json:"auto_delete_branch,omitempty"`
}

type CreateKeyspaceRequest added in v0.114.0

type CreateKeyspaceRequest struct {
	Organization  string `json:"-"`
	Database      string `json:"-"`
	Branch        string `json:"-"`
	Name          string `json:"name"`
	ClusterSize   string `json:"cluster_size"`
	ExtraReplicas int    `json:"extra_replicas"`
	Shards        int    `json:"shards"`
}

type CreatePostgresBranchRequest added in v0.134.0

type CreatePostgresBranchRequest struct {
	Organization string         `json:"-"`
	Database     string         `json:"-"`
	Region       string         `json:"region,omitempty"`
	Name         string         `json:"name"`
	ParentBranch string         `json:"parent_branch"`
	BackupID     string         `json:"backup_id,omitempty"`
	ClusterName  string         `json:"cluster_name,omitempty"`
	MajorVersion string         `json:"major_version,omitempty"`
	Storage      *StorageConfig `json:"storage,omitempty"`
}

CreatePostgresBranchRequest encapsulates the request to create a Postgres branch.

type CreatePostgresRoleRequest added in v0.139.0

type CreatePostgresRoleRequest struct {
	Organization    string   `json:"-"`
	Database        string   `json:"-"`
	Branch          string   `json:"-"`
	Name            string   `json:"name"`
	TTL             int      `json:"ttl,omitempty"`
	InheritedRoles  []string `json:"inherited_roles,omitempty"`
	WithReplication bool     `json:"with_replication,omitempty"`
}

CreatePostgresRoleRequest encapsulates the request for creating role credentials for a database branch.

type CreateQueryPatternsReportRequest added in v0.175.0

type CreateQueryPatternsReportRequest struct {
	Organization string
	Database     string
	Branch       string
}

type CreateServiceTokenRequest

type CreateServiceTokenRequest struct {
	Organization string  `json:"-"`
	Name         *string `json:"name,omitempty"`
	TTL          *int    `json:"ttl,omitempty"`
}

type CreateTrafficBudgetRequest added in v0.156.0

type CreateTrafficBudgetRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	Name string `json:"name"`
	Mode string `json:"mode"`

	Capacity         *int `json:"capacity,omitempty"`
	Rate             *int `json:"rate,omitempty"`
	Burst            *int `json:"burst,omitempty"`
	Concurrency      *int `json:"concurrency,omitempty"`
	WarningThreshold *int `json:"warning_threshold,omitempty"`

	Rules *[]CreateTrafficBudgetRuleRequest `json:"rules,omitempty"`
}

CreateTrafficBudgetRequest is the request for creating a traffic budget.

type CreateTrafficBudgetRuleRequest added in v0.156.0

type CreateTrafficBudgetRuleRequest struct {
	Kind        string            `json:"kind"`
	Fingerprint string            `json:"fingerprint,omitempty"`
	Keyspace    string            `json:"keyspace,omitempty"`
	Tags        *[]TrafficRuleTag `json:"tags,omitempty"`
}

CreateTrafficBudgetRuleRequest describes a rule when creating or updating a budget.

type CreateTrafficRuleRequest added in v0.156.0

type CreateTrafficRuleRequest struct {
	Organization string            `json:"-"`
	Database     string            `json:"-"`
	Branch       string            `json:"-"`
	BudgetID     string            `json:"-"`
	Kind         string            `json:"kind"`
	Fingerprint  *string           `json:"fingerprint,omitempty"`
	Keyspace     *string           `json:"keyspace,omitempty"`
	Tags         *[]TrafficRuleTag `json:"tags,omitempty"`
}

CreateTrafficRuleRequest is the request for creating a traffic rule on a budget.

type CreateWebhookRequest added in v0.146.0

type CreateWebhookRequest struct {
	Organization string   `json:"-"`
	Database     string   `json:"-"`
	URL          string   `json:"url"`
	Enabled      *bool    `json:"enabled,omitempty"`
	Events       []string `json:"events,omitempty"`
}

CreateWebhookRequest is the request for creating a webhook.

type CreateWorkflowRequest added in v0.127.0

type CreateWorkflowRequest struct {
	Organization       string   `json:"-"`
	Database           string   `json:"-"`
	Branch             string   `json:"branch_name"`
	Name               string   `json:"name"`
	SourceKeyspace     string   `json:"source_keyspace"`
	TargetKeyspace     string   `json:"target_keyspace"`
	Tables             []string `json:"tables"`
	GlobalKeyspace     *string  `json:"global_keyspace"`
	DeferSecondaryKeys *bool    `json:"defer_secondary_keys"`
	OnDDL              *string  `json:"on_ddl"`
}

type CursorPaginatedResponse added in v0.66.0

type CursorPaginatedResponse[T any] struct {
	Data    []T  `json:"data"`
	HasNext bool `json:"has_next"`
	HasPrev bool `json:"has_prev"`
	// CursorStart is the ending cursor of the previous page.
	CursorStart *string `json:"cursor_start"`

	// CursorEnd is the starting cursor of the next page.
	CursorEnd *string `json:"cursor_end"`
}

CursorPaginatedResponse provides a generic means of wrapping a paginated response.

type CutoverWorkflowRequest added in v0.128.0

type CutoverWorkflowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	WorkflowNumber uint64 `json:"-"`
}

type D1ImportNotificationsService added in v0.172.0

type D1ImportNotificationsService interface {
	Create(ctx context.Context, req *CreateD1ImportNotificationRequest) error
}

type DataImport added in v0.58.0

type DataImport struct {
	ID                 string `json:"id"`
	ImportState        DataImportState
	State              string           `json:"state"`
	Errors             string           `json:"import_check_errors"`
	StartedAt          *time.Time       `json:"started_at"`
	FinishedAt         *time.Time       `json:"finished_at"`
	DeletedAt          *time.Time       `json:"deleted_at"`
	ExternalDataSource DataImportSource `json:"data_source"`
}

func (*DataImport) ParseState added in v0.58.0

func (di *DataImport) ParseState()

type DataImportSource added in v0.58.0

type DataImportSource struct {
	HostName            string `json:"hostname"`
	Database            string `json:"schema_name"`
	Port                int    `json:"port"`
	SSLMode             string `json:"ssl_mode"`
	SSLVerificationMode ExternalDataSourceSSLVerificationMode
	UserName            string `json:"username"`
	Password            string `json:"password"`
	SSLCA               string `json:"ssl_ca"`
	SSLCertificate      string `json:"ssl_cert"`
	SSLKey              string `json:"ssl_key"`
	SSLServerName       string `json:"ssl_server_name"`
}

type DataImportState added in v0.58.0

type DataImportState int
const (
	DataImportPreparingDataCopy DataImportState = iota
	DataImportPreparingDataCopyFailed
	DataImportCopyingData
	DataImportCopyingDataFailed
	DataImportSwitchTrafficPending
	DataImportSwitchTrafficRunning
	DataImportSwitchTrafficCompleted
	DataImportSwitchTrafficError
	DataImportReverseTrafficRunning
	DataImportReverseTrafficCompleted
	DataImportReverseTrafficError
	DataImportDetachExternalDatabaseRunning
	DataImportDetachExternalDatabaseError
	DataImportReady
)

func (DataImportState) String added in v0.58.0

func (d DataImportState) String() string

type DataImportsService added in v0.58.0

type DataImportsService interface {
	// TestDataImportSource checks if the external database that we're importing will be supported
	// by PlanetScale. It checks for ability to replicate binlogs, schema compatibility and other factors.
	TestDataImportSource(ctx context.Context, request *TestDataImportSourceRequest) (*TestDataImportSourceResponse, error)
	// StartDataImport spins up a downstream PlanetScale database in replica mode, with the
	// external database as a Primary and starts copying data from external to PlanetScale.
	StartDataImport(ctx context.Context, request *StartDataImportRequest) (*DataImport, error)
	// CancelDataImport halts all replication and data copy from external to PlanetScale
	// and deletes the PlanetScale database.
	CancelDataImport(ctx context.Context, request *CancelDataImportRequest) error
	// GetDataImportStatus gets the current status of a DataImport for a given database
	// Fails if the database is not importing any data.
	GetDataImportStatus(ctx context.Context, request *GetImportStatusRequest) (*DataImport, error)
	// MakePlanetScalePrimary makes the downstream PlanetScale database a Primary and the external database a Replica.
	MakePlanetScalePrimary(ctx context.Context, request *MakePlanetScalePrimaryRequest) (*DataImport, error)
	// MakePlanetScaleReplica makes the downstream PlanetScale database a Replica and the external database a Primary.
	MakePlanetScaleReplica(ctx context.Context, request *MakePlanetScaleReplicaRequest) (*DataImport, error)
	// DetachExternalDatabase detaches the external database from PlanetScale after a data import has finished
	// and PlanetScale is running as Primary.
	DetachExternalDatabase(ctx context.Context, request *DetachExternalDatabaseRequest) (*DataImport, error)
}

DataImportsService is an interface for communicating with the PlanetScale Data Imports API endpoint.

type DataSourceIncompatibilityError added in v0.58.0

type DataSourceIncompatibilityError struct {
	LintError        string `json:"lint_error"`
	Keyspace         string `json:"keyspace_name"`
	Table            string `json:"table_name"`
	SubjectType      string `json:"subject_type"`
	ErrorDescription string `json:"error_description"`
	DocsUrl          string `json:"docs_url"`
}

DataSourceIncompatibilityError represents an error that occurs when the source schema in an external database server is incompatible with PlanetScale.

type Database

type Database struct {
	Name      string         `json:"name"`
	Notes     string         `json:"notes"`
	Region    Region         `json:"region"`
	State     DatabaseState  `json:"state"`
	Kind      DatabaseEngine `json:"kind"`
	HtmlURL   string         `json:"html_url"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
}

Database represents a PlanetScale database

type DatabaseBranch

type DatabaseBranch struct {
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	ParentBranch   string    `json:"parent_branch"`
	Actor          Actor     `json:"actor"`
	Region         Region    `json:"region"`
	Ready          bool      `json:"ready"`
	Production     bool      `json:"production"`
	HtmlURL        string    `json:"html_url"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	SafeMigrations bool      `json:"safe_migrations"`
}

DatabaseBranch represents a database branch.

type DatabaseBranchPassword added in v0.40.0

type DatabaseBranchPassword struct {
	PublicID  string         `json:"id"`
	Name      string         `json:"name"`
	Hostname  string         `json:"access_host_url"`
	Username  string         `json:"username"`
	Role      string         `json:"role"`
	Actor     *Actor         `json:"actor"`
	Branch    DatabaseBranch `json:"database_branch"`
	CreatedAt time.Time      `json:"created_at"`
	DeletedAt time.Time      `json:"deleted_at"`
	ExpiresAt time.Time      `json:"expires_at"`
	PlainText string         `json:"plain_text"`
	TTL       int            `json:"ttl_seconds"`
	Renewable bool           `json:"renewable"`
	Replica   bool           `json:"replica"`
}

type DatabaseBranchPasswordRequest added in v0.40.0

type DatabaseBranchPasswordRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Role         string `json:"role,omitempty"`
	Name         string `json:"name"`
	TTL          int    `json:"ttl,omitempty"`
	Replica      bool   `json:"replica,omitempty"`
}

DatabaseBranchPasswordRequest encapsulates the request for creating/getting/deleting a database branch password.

type DatabaseDeletionRequest added in v0.65.0

type DatabaseDeletionRequest struct {
	ID    string `json:"id"`
	Actor Actor  `json:"actor"`
}

DatabaseDeletionRequest encapsulates the request for deleting a database from an organization.

type DatabaseEngine added in v0.137.0

type DatabaseEngine string
const (
	DatabaseEngineMySQL    DatabaseEngine = "mysql"
	DatabaseEnginePostgres DatabaseEngine = "postgresql"
)

type DatabaseState added in v0.52.0

type DatabaseState string

DatabaseState represents the state of a database

const (
	DatabasePending         DatabaseState = "pending"
	DatabaseImporting       DatabaseState = "importing"
	DatabaseAwakening       DatabaseState = "awakening"
	DatabaseSleepInProgress DatabaseState = "sleep_in_progress"
	DatabaseSleeping        DatabaseState = "sleeping"
	DatabaseReady           DatabaseState = "ready"
)

type DatabasesService

DatabaseService is an interface for communicating with the PlanetScale Databases API endpoint.

type DeleteBackupRequest

type DeleteBackupRequest struct {
	Organization string
	Database     string
	Branch       string
	Backup       string
}

type DeleteDatabaseBranchPasswordRequest added in v0.40.0

type DeleteDatabaseBranchPasswordRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Name         string `json:"name"`
	PasswordId   string
}

DeleteDatabaseBranchPasswordRequest encapsulates the request for deleting a password for a given database branch.

type DeleteDatabaseBranchRequest

type DeleteDatabaseBranchRequest struct {
	Organization      string
	Database          string
	Branch            string
	DeleteDescendants bool
}

DeleteDatabaseRequest encapsulates the request for deleting a database branch from a database.

type DeleteDatabaseRequest

type DeleteDatabaseRequest struct {
	Organization string
	Database     string
}

DeleteDatabaseRequest encapsulates the request for deleting a database from an organization.

type DeletePostgresBranchRequest added in v0.134.0

type DeletePostgresBranchRequest struct {
	Organization      string
	Database          string
	Branch            string
	DeleteDescendants bool
}

DeletePostgresBranchRequest encapsulates the request to delete a Postgres branch.

type DeletePostgresRoleRequest added in v0.139.0

type DeletePostgresRoleRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	RoleId       string `json:"-"`
	Successor    string `json:"successor,omitempty"`
}

DeletePostgresRoleRequest encapsulates the request for deleting role credentials for a database branch.

type DeleteServiceTokenAccessRequest

type DeleteServiceTokenAccessRequest struct {
	Organization string   `json:"-"`
	ID           string   `json:"-"`
	Database     string   `json:"database"`
	Accesses     []string `json:"access"`
}

type DeleteServiceTokenRequest

type DeleteServiceTokenRequest struct {
	Organization string `json:"-"`
	ID           string `json:"-"`
}

type DeleteTrafficBudgetRequest added in v0.156.0

type DeleteTrafficBudgetRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	BudgetID     string `json:"-"`
}

DeleteTrafficBudgetRequest is the request for deleting a traffic budget.

type DeleteTrafficRuleRequest added in v0.156.0

type DeleteTrafficRuleRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	BudgetID     string `json:"-"`
	RuleID       string `json:"-"`
}

DeleteTrafficRuleRequest is the request for deleting a traffic rule.

type DeleteWebhookRequest added in v0.146.0

type DeleteWebhookRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	ID           string `json:"-"`
}

DeleteWebhookRequest is the request for deleting a webhook.

type DemoteRequest added in v0.83.0

type DemoteRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

DemoteRequest encapsulates the request for demoting a branch to development.

type DeployOperation

type DeployOperation struct {
	ID                 string    `json:"id"`
	State              string    `json:"state"`
	Table              string    `json:"table_name"`
	Keyspace           string    `json:"keyspace_name"`
	Operation          string    `json:"operation_name"`
	ETASeconds         int64     `json:"eta_seconds"`
	ProgressPercentage uint64    `json:"progress_percentage"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
}

DeployOperation encapsulates a deploy operation within a deployment from the PlanetScale API.

type DeployRequest

type DeployRequest struct {
	ID string `json:"id"`

	Branch     string `json:"branch"`
	IntoBranch string `json:"into_branch"`

	Actor           Actor  `json:"actor"`
	ClosedBy        *Actor `json:"closed_by"`
	BranchDeletedBy *Actor `json:"branch_deleted_by"`
	Number          uint64 `json:"number"`

	State string `json:"state"`

	DeploymentState string `json:"deployment_state"`

	Approved bool `json:"approved"`

	Notes string `json:"notes"`

	Deployment *Deployment `json:"deployment"`

	HtmlURL string `json:"html_url"`

	CreatedAt  time.Time  `json:"created_at"`
	UpdatedAt  time.Time  `json:"updated_at"`
	ClosedAt   *time.Time `json:"closed_at"`
	DeployedAt *time.Time `json:"deployed_at"`
}

DeployRequest encapsulates the request to deploy a database branch's schema to a production branch

type DeployRequestReview

type DeployRequestReview struct {
	ID        string    `json:"id"`
	Body      string    `json:"body"`
	State     string    `json:"state"`
	Actor     Actor     `json:"actor"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

DeployRequestReview posts a review to a deploy request.

type Deployment

type Deployment struct {
	ID                   string                 `json:"id"`
	State                string                 `json:"state"`
	Deployable           bool                   `json:"deployable"`
	LintErrors           []*DeploymentLintError `json:"lint_errors"`
	DeployRequestNumber  uint64                 `json:"deploy_request_number"`
	IntoBranch           string                 `json:"into_branch"`
	PrecedingDeployments []*QueuedDeployment    `json:"preceding_deployments"`

	InstantDDLEligible bool `json:"instant_ddl_eligible"`
	InstantDDL         bool `json:"instant_ddl"`

	Actor          *Actor `json:"actor"`
	CutoverActor   *Actor `json:"cutover_actor"`
	CancelledActor *Actor `json:"cancelled_actor"`

	CreatedAt  time.Time  `json:"created_at"`
	UpdatedAt  time.Time  `json:"updated_at"`
	StartedAt  *time.Time `json:"started_at"`
	QueuedAt   *time.Time `json:"queued_at"`
	FinishedAt *time.Time `json:"finished_at"`
}

Deployment encapsulates a deployment for a deploy request.

type DeploymentLintError added in v0.50.0

type DeploymentLintError struct {
	LintError        string `json:"lint_error"`
	Keyspace         string `json:"keyspace_name"`
	Table            string `json:"table_name"`
	SubjectType      string `json:"subject_type"`
	ErrorDescription string `json:"error_description"`
	DocsUrl          string `json:"docs_url"`
}

DeploymentLintError represents an error that occurs during the deployment flow.

type DetachExternalDatabaseRequest added in v0.58.0

type DetachExternalDatabaseRequest struct {
	Organization string
	Database     string
}

type Diff

type Diff struct {
	Name string `json:"name"`
	Raw  string `json:"raw"`
	HTML string `json:"html"`
}

Diff returns the diff for a database deploy request

type DiffBranchRequest

type DiffBranchRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

DiffBranchRequest encapsulates a request for getting the diff for a branch.

type DiffRequest

type DiffRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`
}

type DisableSafeMigrationsRequest added in v0.84.0

type DisableSafeMigrationsRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

DisableSafeMigrationsRequest encapsulates the request for disabling safe migrations on a branch.

type DismissSchemaRecommendationRequest added in v0.164.0

type DismissSchemaRecommendationRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	ID           string `json:"-"`
}

DismissSchemaRecommendationRequest is the request for dismissing a schema recommendation.

type DownloadQueryPatternsReportRequest added in v0.175.0

type DownloadQueryPatternsReportRequest struct {
	Organization string
	Database     string
	Branch       string
	Report       string
}

type EnableSafeMigrationsRequest added in v0.84.0

type EnableSafeMigrationsRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

EnableSafeMigrationsRequest encapsulates the request for enabling safe migrations on a branch.

type Error

type Error struct {

	// Code specifies the error code. i.e; NotFound, RateLimited, etc...
	Code ErrorCode

	// Meta contains additional information depending on the error code. As an
	// example, if the Code is "ErrResponseMalformed", the map will be: ["body"]
	// = "body of the response"
	Meta map[string]string
	// contains filtered or unexported fields
}

Error represents common errors originating from the Client.

func (*Error) Error

func (e *Error) Error() string

Error returns the string representation of the error.

type ErrorCode

type ErrorCode string

ErrorCode defines the code of an error.

const (
	ErrInternal          ErrorCode = "internal"           // Internal error.
	ErrInvalid           ErrorCode = "invalid"            // Invalid operation, e.g wrong params
	ErrPermission        ErrorCode = "permission"         // Permission denied.
	ErrNotFound          ErrorCode = "not_found"          // Resource not found.
	ErrRetry             ErrorCode = "retry"              // Operation should be retried.
	ErrResponseMalformed ErrorCode = "response_malformed" // Response body is malformed.
)

type ExternalDataSourceSSLVerificationMode added in v0.58.0

type ExternalDataSourceSSLVerificationMode int
const (
	SSLModeDisabled ExternalDataSourceSSLVerificationMode = iota
	SSLModePreferred
	SSLModeRequired
	SSLModeVerifyCA
	SSLModeVerifyIdentity
)

func (ExternalDataSourceSSLVerificationMode) String added in v0.58.0

type GetBackupRequest

type GetBackupRequest struct {
	Organization string
	Database     string
	Branch       string
	Backup       string
}

type GetBranchInfrastructureRequest added in v0.152.0

type GetBranchInfrastructureRequest struct {
	Organization string
	Database     string
	Branch       string
}

GetBranchInfrastructureRequest encapsulates the request for getting branch infrastructure.

type GetDatabaseBranchPasswordRequest added in v0.40.0

type GetDatabaseBranchPasswordRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Name         string `json:"name"`
	PasswordId   string
}

GetDatabaseBranchPasswordRequest encapsulates the request for listing all passwords for a given database branch.

type GetDatabaseBranchRequest

type GetDatabaseBranchRequest struct {
	Organization string
	Database     string
	Branch       string
}

GetDatabaseBranchRequest encapsulates the request for getting a single database branch for a database.

type GetDatabaseRequest

type GetDatabaseRequest struct {
	Organization string
	Database     string
}

DatabaseRequest encapsulates the request for getting a single database.

type GetDeployOperationsRequest added in v0.116.0

type GetDeployOperationsRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`
}

GetDeployOperationsRequest encapsulates the request for getting a deploy operation for a deploy request.

type GetDeployRequestRequest

type GetDeployRequestRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`
}

GetDeployRequest encapsulates the request for getting a single deploy request.

type GetImportStatusRequest added in v0.58.0

type GetImportStatusRequest struct {
	Organization string
	Database     string
}

type GetKeyspaceRequest added in v0.114.0

type GetKeyspaceRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"-"`
}

type GetKeyspaceVSchemaRequest added in v0.106.0

type GetKeyspaceVSchemaRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"-"`
}

type GetOrganizationRequest

type GetOrganizationRequest struct {
	Organization string
}

GetOrganizationRequest encapsulates the request for getting a single organization.

type GetPlannedReparentShardRequest added in v0.159.0

type GetPlannedReparentShardRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	ID           string `json:"-"`
}

GetPlannedReparentShardRequest is a request for retrieving a planned reparent shard operation.

type GetPostgresBranchRequest added in v0.134.0

type GetPostgresBranchRequest struct {
	Organization string
	Database     string
	Branch       string
}

GetPostgresBranchRequest encapsulates the request to get a specific Postgres branch.

type GetPostgresRoleRequest added in v0.139.0

type GetPostgresRoleRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	RoleId       string
}

GetPostgresRoleRequest encapsulates the request for getting a specific role for a given database branch.

type GetQueryPatternsReportRequest added in v0.175.0

type GetQueryPatternsReportRequest struct {
	Organization string
	Database     string
	Branch       string
	Report       string
}

type GetSchemaRecommendationRequest added in v0.164.0

type GetSchemaRecommendationRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	ID           string `json:"-"`
}

GetSchemaRecommendationRequest is the request for getting a schema recommendation.

type GetServiceTokenAccessRequest

type GetServiceTokenAccessRequest struct {
	Organization string `json:"-"`
	ID           string `json:"-"`
}

type GetTrafficBudgetRequest added in v0.156.0

type GetTrafficBudgetRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	BudgetID     string `json:"-"`
}

GetTrafficBudgetRequest is the request for getting a traffic budget.

type GetVtctldOperationRequest added in v0.153.0

type GetVtctldOperationRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	ID           string `json:"-"`
}

GetVtctldOperationRequest is a request for retrieving a vtctld operation.

type GetWebhookRequest added in v0.146.0

type GetWebhookRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	ID           string `json:"-"`
}

GetWebhookRequest is the request for getting a webhook.

type GetWorkflowRequest added in v0.126.0

type GetWorkflowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	WorkflowNumber uint64 `json:"-"`
}

type Keyspace added in v0.68.0

type Keyspace struct {
	ID                               string                            `json:"id"`
	Name                             string                            `json:"name"`
	Shards                           int                               `json:"shards"`
	Sharded                          bool                              `json:"sharded"`
	Replicas                         uint64                            `json:"replicas"`
	ExtraReplicas                    uint64                            `json:"extra_replicas"`
	ResizePending                    bool                              `json:"resize_pending"`
	Resizing                         bool                              `json:"resizing"`
	Ready                            bool                              `json:"ready"`
	ClusterSize                      string                            `json:"cluster_name"`
	CreatedAt                        time.Time                         `json:"created_at"`
	UpdatedAt                        time.Time                         `json:"updated_at"`
	VReplicationFlags                *VReplicationFlags                `json:"vreplication_flags"`
	ReplicationDurabilityConstraints *ReplicationDurabilityConstraints `json:"replication_durability_constraints"`
}

type KeyspaceResizeRequest added in v0.109.0

type KeyspaceResizeRequest struct {
	ID    string `json:"id"`
	State string `json:"state"`
	Actor *Actor `json:"actor"`

	ClusterSize         string `json:"cluster_name"`
	PreviousClusterSize string `json:"previous_cluster_name"`

	Replicas         uint `json:"replicas"`
	ExtraReplicas    uint `json:"extra_replicas"`
	PreviousReplicas uint `json:"previous_replicas"`

	UpdatedAt   time.Time  `json:"updated_at"`
	CreatedAt   time.Time  `json:"created_at"`
	StartedAt   *time.Time `json:"started_at"`
	CompletedAt *time.Time `json:"completed_at"`
}

type KeyspaceResizeStatusRequest added in v0.109.0

type KeyspaceResizeStatusRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"-"`
}

type KeyspaceRollout added in v0.117.0

type KeyspaceRollout struct {
	Name  string `json:"name"`
	State string `json:"state"`

	Shards []ShardRollout `json:"shards"`
}

type KeyspaceRolloutStatusRequest added in v0.117.0

type KeyspaceRolloutStatusRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"-"`
}

type KeyspacesService added in v0.114.0

KeyspacesService is an interface for interacting with the keyspace endpoints of the PlanetScale API

type KillProcessRequest added in v0.167.0

type KillProcessRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"keyspace,omitempty"`
	Shard        string `json:"shard,omitempty"`
	ID           int64  `json:"id"`
	Kind         string `json:"kind,omitempty"`
}

KillProcessRequest kills a single process by ID on a branch. Keyspace/Shard follow the same disambiguation rules as ProcesslistRequest. Kind is either "connection" (default) or "query".

type KillProcessResult added in v0.167.0

type KillProcessResult struct {
	Success  bool   `json:"success"`
	Keyspace string `json:"keyspace"`
	Shard    string `json:"shard"`
	Tablet   string `json:"tablet"`
	ID       int64  `json:"id"`
	Kind     string `json:"kind"`
}

KillProcessResult is the response from killing a process.

type LintSchemaRequest added in v0.85.0

type LintSchemaRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

LintSchemaRequest encapsulates the request for linting a branch's schema.

type ListAuditLogsRequest added in v0.35.0

type ListAuditLogsRequest struct {
	Organization string

	// Events can be used to filter out only the given audit log events.
	Events []AuditLogEvent
}

ListAuditLogsRequest encapsulates the request for listing the audit logs of an organization.

type ListBackupsRequest

type ListBackupsRequest struct {
	Organization string
	Database     string
	Branch       string
}

type ListBranchClusterSKUsRequest added in v0.121.0

type ListBranchClusterSKUsRequest struct {
	Organization string
	Database     string
	Branch       string
}

ListBranchClusterSKUsRequest encapsulates the request for getting a list of Cluster SKUs for a branch.

type ListBranchTabletsRequest added in v0.160.0

type ListBranchTabletsRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	// Keyspace, if set, only returns tablets in this keyspace.
	Keyspace string `json:"-"`
	// Shard, if set, only returns tablets in this shard. It requires Keyspace
	// to also be set.
	Shard string `json:"-"`
	// TabletType, if set, only returns tablets of this type (e.g. "primary",
	// "replica", "rdonly").
	TabletType string `json:"-"`
	// TabletAliases, if set, only returns the tablets with these aliases (e.g.
	// "zone1-0000000100"). When set, the other filters are ignored.
	TabletAliases []string `json:"-"`
}

ListBranchTabletsRequest is a request for listing tablets on a branch.

type ListDatabaseBranchPasswordRequest added in v0.40.0

type ListDatabaseBranchPasswordRequest struct {
	Organization string
	Database     string
	Branch       string
}

ListDatabaseBranchPasswordRequest encapsulates the request for listing all passwords for a given database branch.

type ListDatabaseBranchesRequest

type ListDatabaseBranchesRequest struct {
	Organization string
	Database     string
}

ListDatabaseBranchesRequest encapsulates the request for listing the branches of a database.

type ListDatabasesRequest

type ListDatabasesRequest struct {
	Organization string
}

ListDatabasesRequest encapsulates the request for listing all databases in an organization.

type ListDeployRequestsRequest

type ListDeployRequestsRequest struct {
	Organization string
	Database     string
	State        string
	Branch       string
	IntoBranch   string
}

ListDeployRequestsRequest gets the deploy requests for a specific database branch.

type ListKeyspacesRequest added in v0.114.0

type ListKeyspacesRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

type ListOption added in v0.66.0

type ListOption func(*ListOptions) error

func WithEventFilters added in v0.66.0

func WithEventFilters(events []AuditLogEvent) ListOption

WithEventFilters sets filters on a set of list filters from audit log events. For example, `audit_action:database.created`, `audit_action:database.deleted`, etc.

func WithLimit added in v0.66.0

func WithLimit(limit int) ListOption

WithLimit returns a ListOption that sets the "limit" URL parameter.

func WithPage added in v0.74.0

func WithPage(page int) ListOption

WithPage returns a ListOption that sets the "page" URL parameter.

func WithPerPage added in v0.74.0

func WithPerPage(perPage int) ListOption

WithPerPage returns a ListOption that sets the "per_page" URL paramter.

func WithPostgreSQL added in v0.140.0

func WithPostgreSQL() ListOption

WithPostgreSQL returns a ListOption that sets the "postgresql" URL parameter.

func WithRates added in v0.119.0

func WithRates() ListOption

WithRates returns a ListOption that sets the "rates" URL parameter.

func WithRegion added in v0.119.0

func WithRegion(region string) ListOption

WithRegion returns a ListOption sets the "region" URL parameter.

func WithStartingAfter added in v0.66.0

func WithStartingAfter(startingAfter string) ListOption

WithStartingAfter returns a ListOption that sets the "starting_after" URL parameter.

type ListOptions added in v0.66.0

type ListOptions struct {
	URLValues *url.Values
}

ListOptions are options for listing responses.

type ListOrganizationClusterSKUsRequest added in v0.119.0

type ListOrganizationClusterSKUsRequest struct {
	Organization string
}

ListOrganizationClusterSKUsRequest encapsulates the request for getting a list of Cluster SKUs for an organization.

type ListOrganizationRegionsRequest added in v0.40.0

type ListOrganizationRegionsRequest struct {
	Organization string
}

ListRegionsRequest encapsulates the request for getting a list of regions for an organization.

type ListPostgresBranchesRequest added in v0.134.0

type ListPostgresBranchesRequest struct {
	Organization string
	Database     string
}

ListPostgresBranchesRequest encapsulates the request to list Postgres branches for a database.

type ListPostgresRolesRequest added in v0.139.0

type ListPostgresRolesRequest struct {
	Organization string
	Database     string
	Branch       string
}

ListPostgresRolesRequest encapsulates the request for listing all roles for a given database branch.

type ListRegionsRequest added in v0.29.0

type ListRegionsRequest struct{}

type ListSchemaRecommendationsRequest added in v0.164.0

type ListSchemaRecommendationsRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
}

ListSchemaRecommendationsRequest is the request for listing schema recommendations.

type ListServiceTokenGrantsRequest added in v0.76.0

type ListServiceTokenGrantsRequest struct {
	Organization string `json:"-"`
	ID           string `json:"-"`
}

type ListServiceTokensRequest

type ListServiceTokensRequest struct {
	Organization string `json:"-"`
}

type ListTrafficBudgetsRequest added in v0.156.0

type ListTrafficBudgetsRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

ListTrafficBudgetsRequest is the request for listing traffic budgets.

type ListWebhooksRequest added in v0.146.0

type ListWebhooksRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
}

ListWebhooksRequest is the request for listing webhooks.

type ListWorkflowsRequest added in v0.126.0

type ListWorkflowsRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
}

type LookupVindexCancelRequest added in v0.149.0

type LookupVindexCancelRequest struct {
	Organization  string `json:"-"`
	Database      string `json:"-"`
	Branch        string `json:"-"`
	Name          string `json:"-"`
	TableKeyspace string `json:"table_keyspace"`
}

type LookupVindexCompleteRequest added in v0.149.0

type LookupVindexCompleteRequest struct {
	Organization  string `json:"-"`
	Database      string `json:"-"`
	Branch        string `json:"-"`
	Name          string `json:"-"`
	TableKeyspace string `json:"table_keyspace"`
	Keyspace      string `json:"keyspace,omitempty"`
}

type LookupVindexCreateRequest added in v0.149.0

type LookupVindexCreateRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	Name                         string   `json:"name"`
	TableKeyspace                string   `json:"table_keyspace"`
	Keyspace                     string   `json:"keyspace,omitempty"`
	TableOwner                   string   `json:"table_owner,omitempty"`
	TableName                    string   `json:"table_name,omitempty"`
	Type                         string   `json:"type,omitempty"`
	Cells                        []string `json:"cells,omitempty"`
	TabletTypes                  []string `json:"tablet_types,omitempty"`
	TabletTypesInPreferenceOrder *bool    `json:"tablet_types_in_preference_order,omitempty"`
	IgnoreNulls                  *bool    `json:"ignore_nulls,omitempty"`
	TableOwnerColumns            []string `json:"table_owner_columns,omitempty"`
	TableVindexType              string   `json:"table_vindex_type,omitempty"`
	ContinueAfterCopyWithOwner   *bool    `json:"continue_after_copy_with_owner,omitempty"`
}

type LookupVindexExternalizeRequest added in v0.149.0

type LookupVindexExternalizeRequest struct {
	Organization  string `json:"-"`
	Database      string `json:"-"`
	Branch        string `json:"-"`
	Name          string `json:"-"`
	TableKeyspace string `json:"table_keyspace"`
	Keyspace      string `json:"keyspace,omitempty"`
	Delete        *bool  `json:"delete,omitempty"`
}

type LookupVindexInternalizeRequest added in v0.149.0

type LookupVindexInternalizeRequest struct {
	Organization  string `json:"-"`
	Database      string `json:"-"`
	Branch        string `json:"-"`
	Name          string `json:"-"`
	TableKeyspace string `json:"table_keyspace"`
	Keyspace      string `json:"keyspace,omitempty"`
}

type LookupVindexService added in v0.149.0

LookupVindexService is an interface for interacting with the LookupVindex endpoints of the PlanetScale API.

type LookupVindexShowRequest added in v0.149.0

type LookupVindexShowRequest struct {
	Organization  string `json:"-"`
	Database      string `json:"-"`
	Branch        string `json:"-"`
	Name          string `json:"-"`
	TableKeyspace string `json:"-"`
}

type MakePlanetScalePrimaryRequest added in v0.58.0

type MakePlanetScalePrimaryRequest struct {
	Organization string
	Database     string
}

type MakePlanetScaleReplicaRequest added in v0.58.0

type MakePlanetScaleReplicaRequest struct {
	Organization string
	Database     string
}

type MaterializeCancelRequest added in v0.149.0

type MaterializeCancelRequest struct {
	Organization     string `json:"-"`
	Database         string `json:"-"`
	Branch           string `json:"-"`
	Workflow         string `json:"-"`
	TargetKeyspace   string `json:"target_keyspace"`
	KeepData         *bool  `json:"keep_data,omitempty"`
	KeepRoutingRules *bool  `json:"keep_routing_rules,omitempty"`
}

MaterializeCancelRequest is a request for canceling a Materialize workflow.

type MaterializeCreateRequest added in v0.149.0

type MaterializeCreateRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	Workflow                     string          `json:"workflow"`
	TargetKeyspace               string          `json:"target_keyspace"`
	SourceKeyspace               string          `json:"source_keyspace"`
	TableSettings                json.RawMessage `json:"table_settings"`
	Cells                        []string        `json:"cells,omitempty"`
	ReferenceTables              []string        `json:"reference_tables,omitempty"`
	TabletTypes                  []string        `json:"tablet_types,omitempty"`
	StopAfterCopy                *bool           `json:"stop_after_copy,omitempty"`
	TabletTypesInPreferenceOrder *bool           `json:"tablet_types_in_preference_order,omitempty"`
	DeferSecondaryKeys           *bool           `json:"defer_secondary_keys,omitempty"`
	AtomicCopy                   *bool           `json:"atomic_copy,omitempty"`
	OnDDL                        string          `json:"on_ddl,omitempty"`
	SourceTimeZone               string          `json:"source_time_zone,omitempty"`
}

MaterializeCreateRequest is a request for creating a Materialize workflow.

type MaterializeService added in v0.149.0

MaterializeService is an interface for interacting with the Materialize endpoints of the PlanetScale API.

type MaterializeShowRequest added in v0.149.0

type MaterializeShowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	Branch         string `json:"-"`
	Workflow       string `json:"-"`
	TargetKeyspace string `json:"-"`
	IncludeLogs    *bool  `json:"-"`
}

MaterializeShowRequest is a request for showing a Materialize workflow.

type MaterializeStartRequest added in v0.149.0

type MaterializeStartRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	Branch         string `json:"-"`
	Workflow       string `json:"-"`
	TargetKeyspace string `json:"target_keyspace"`
}

MaterializeStartRequest is a request for starting a Materialize workflow.

type MaterializeStopRequest added in v0.149.0

type MaterializeStopRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	Branch         string `json:"-"`
	Workflow       string `json:"-"`
	TargetKeyspace string `json:"target_keyspace"`
}

MaterializeStopRequest is a request for stopping a Materialize workflow.

type MoveTablesCancelRequest added in v0.149.0

type MoveTablesCancelRequest struct {
	Organization     string `json:"-"`
	Database         string `json:"-"`
	Branch           string `json:"-"`
	Workflow         string `json:"-"`
	TargetKeyspace   string `json:"target_keyspace"`
	KeepData         *bool  `json:"keep_data,omitempty"`
	KeepRoutingRules *bool  `json:"keep_routing_rules,omitempty"`
}

MoveTablesCancelRequest is a request for canceling a MoveTables workflow.

type MoveTablesCompleteRequest added in v0.149.0

type MoveTablesCompleteRequest struct {
	Organization     string `json:"-"`
	Database         string `json:"-"`
	Branch           string `json:"-"`
	Workflow         string `json:"-"`
	TargetKeyspace   string `json:"target_keyspace"`
	KeepData         *bool  `json:"keep_data,omitempty"`
	KeepRoutingRules *bool  `json:"keep_routing_rules,omitempty"`
	RenameTables     *bool  `json:"rename_tables,omitempty"`
	DryRun           *bool  `json:"dry_run,omitempty"`
}

MoveTablesCompleteRequest is a request for completing a MoveTables workflow.

type MoveTablesCreateRequest added in v0.149.0

type MoveTablesCreateRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	Workflow                     string   `json:"workflow"`
	TargetKeyspace               string   `json:"target_keyspace"`
	SourceKeyspace               string   `json:"source_keyspace"`
	Tables                       []string `json:"tables,omitempty"`
	AllTables                    *bool    `json:"all_tables,omitempty"`
	AutoStart                    *bool    `json:"auto_start,omitempty"`
	StopAfterCopy                *bool    `json:"stop_after_copy,omitempty"`
	DeferSecondaryKeys           *bool    `json:"defer_secondary_keys,omitempty"`
	OnDDL                        string   `json:"on_ddl,omitempty"`
	ShardedAutoIncrementHandling string   `json:"sharded_auto_increment_handling,omitempty"`
	GlobalKeyspace               string   `json:"global_keyspace,omitempty"`
	SourceTimeZone               string   `json:"source_time_zone,omitempty"`
	TenantID                     string   `json:"tenant_id,omitempty"`
	Cells                        []string `json:"cells,omitempty"`
	TabletTypes                  []string `json:"tablet_types,omitempty"`
	ExcludeTables                []string `json:"exclude_tables,omitempty"`
	AtomicCopy                   *bool    `json:"atomic_copy,omitempty"`
}

MoveTablesCreateRequest is a request for creating a MoveTables workflow.

type MoveTablesReverseTrafficRequest added in v0.149.0

type MoveTablesReverseTrafficRequest struct {
	Organization             string   `json:"-"`
	Database                 string   `json:"-"`
	Branch                   string   `json:"-"`
	Workflow                 string   `json:"-"`
	TargetKeyspace           string   `json:"target_keyspace"`
	TabletTypes              []string `json:"tablet_types,omitempty"`
	MaxReplicationLagAllowed *int64   `json:"max_replication_lag_allowed,omitempty"`
	DryRun                   *bool    `json:"dry_run,omitempty"`
}

MoveTablesReverseTrafficRequest is a request for reversing traffic for a MoveTables workflow.

type MoveTablesShowRequest added in v0.149.0

type MoveTablesShowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	Branch         string `json:"-"`
	Workflow       string `json:"-"`
	TargetKeyspace string `json:"-"`
}

MoveTablesShowRequest is a request for showing a MoveTables workflow.

type MoveTablesStatusRequest added in v0.149.0

type MoveTablesStatusRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	Branch         string `json:"-"`
	Workflow       string `json:"-"`
	TargetKeyspace string `json:"-"`
}

MoveTablesStatusRequest is a request for getting the status of a MoveTables workflow.

type MoveTablesSwitchTrafficRequest added in v0.149.0

type MoveTablesSwitchTrafficRequest struct {
	Organization              string   `json:"-"`
	Database                  string   `json:"-"`
	Branch                    string   `json:"-"`
	Workflow                  string   `json:"-"`
	TargetKeyspace            string   `json:"target_keyspace"`
	TabletTypes               []string `json:"tablet_types,omitempty"`
	MaxReplicationLagAllowed  *int64   `json:"max_replication_lag_allowed,omitempty"`
	DryRun                    *bool    `json:"dry_run,omitempty"`
	InitializeTargetSequences *bool    `json:"initialize_target_sequences,omitempty"`
}

MoveTablesSwitchTrafficRequest is a request for switching traffic for a MoveTables workflow.

type Organization

type Organization struct {
	Name                   string    `json:"name"`
	CreatedAt              time.Time `json:"created_at"`
	UpdatedAt              time.Time `json:"updated_at"`
	RemainingFreeDatabases int       `json:"free_databases_remaining"`
}

Organization represents a PlanetScale organization.

type OrganizationsService

OrganizationsService is an interface for communicating with the PlanetScale Organizations API endpoints.

type PasswordsService added in v0.40.0

DatabaseBranchPasswordsService is an interface for communicating with the PlanetScale Database Branch Passwords API endpoint.

type PerformDeployRequest

type PerformDeployRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`
	InstantDDL   bool   `json:"instant_ddl"`
	Strategy     string `json:"strategy,omitempty"`
}

PerformDeployRequest is a request for approving and deploying a deploy request. NOTE: We deviate from naming convention here because we have a data model named DeployRequest already.

type PlannedReparentShardRequest added in v0.159.0

type PlannedReparentShardRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"keyspace"`
	Shard        string `json:"shard"`
	NewPrimary   string `json:"new_primary"`
}

PlannedReparentShardRequest is a request for creating a planned reparent shard operation.

type PlannedReparentShardService added in v0.159.0

PlannedReparentShardService is an interface for interacting with the PlannedReparentShard endpoints of the PlanetScale API.

type PostgresBranch added in v0.134.0

type PostgresBranch struct {
	ID                  string    `json:"id"`
	Name                string    `json:"name"`
	ClusterName         string    `json:"cluster_name"`
	ClusterDisplayName  string    `json:"cluster_display_name"`
	ClusterArchitecture string    `json:"cluster_architecture"`
	ClusterIOPS         int       `json:"cluster_iops"`
	State               string    `json:"state"`
	CreatedAt           time.Time `json:"created_at"`
	UpdatedAt           time.Time `json:"updated_at"`
	Actor               Actor     `json:"actor"`
	Production          bool      `json:"production"`
	Ready               bool      `json:"ready"`
	ParentBranch        string    `json:"parent_branch"`
	Region              Region    `json:"region"`
	Kind                string    `json:"kind"`
	Replicas            int       `json:"replicas"`
}

PostgresBranch represents a Postgres branch in the PlanetScale API.

type PostgresBranchClusterResizeRequest added in v0.171.0

type PostgresBranchClusterResizeRequest struct {
	ID    string `json:"id"`
	State string `json:"state"`

	ClusterName        string `json:"cluster_name"`
	ClusterDisplayName string `json:"cluster_display_name"`
	Replicas           int    `json:"replicas"`

	PreviousClusterName        string `json:"previous_cluster_name"`
	PreviousClusterDisplayName string `json:"previous_cluster_display_name"`
	PreviousReplicas           int    `json:"previous_replicas"`

	StartedAt   *time.Time `json:"started_at"`
	CompletedAt *time.Time `json:"completed_at"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
}

PostgresBranchClusterResizeRequest represents an asynchronous Postgres branch cluster change (resize) request.

type PostgresBranchInfrastructure added in v0.177.0

type PostgresBranchInfrastructure struct {
	State                           string                  `json:"state"`
	PrimaryName                     string                  `json:"primary_name"`
	PrimaryPromotedAt               *time.Time              `json:"primary_promoted_at"`
	VolumeModificationsBlockedUntil *time.Time              `json:"volume_modifications_blocked_until"`
	Nodes                           []*PostgresInfraNode    `json:"nodes"`
	Bouncers                        []*PostgresInfraBouncer `json:"bouncers"`
}

PostgresBranchInfrastructure represents the infrastructure (nodes and bouncers) for a Postgres branch.

type PostgresBranchSchema added in v0.134.0

type PostgresBranchSchema struct {
	Name string `json:"name"`
	Raw  string `json:"raw"`
	HTML string `json:"html"`
}

PostgresBranchSchema encapsulates the schema of a Postgres branch.

type PostgresBranchSchemaRequest added in v0.134.0

type PostgresBranchSchemaRequest struct {
	Organization string
	Database     string
	Branch       string
	Namespace    string `json:"-"`
}

PostgresBranchSchemaRequest encapsulates the request to get the schema of a Postgres branch.

type PostgresInfraBouncer added in v0.177.0

type PostgresInfraBouncer struct {
	ID              string                   `json:"id"`
	Name            string                   `json:"name"`
	Target          string                   `json:"target"`
	ReplicasPerCell int                      `json:"replicas_per_cell"`
	Region          Region                   `json:"region"`
	SKU             *PostgresInfraBouncerSKU `json:"sku"`
}

PostgresInfraBouncer represents a PgBouncer deployment in the branch infrastructure.

type PostgresInfraBouncerSKU added in v0.177.0

type PostgresInfraBouncerSKU struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	CPU         string `json:"cpu"`
	RAM         int64  `json:"ram"`
}

PostgresInfraBouncerSKU represents the size of a PgBouncer deployment.

type PostgresInfraDiskReplacement added in v0.177.0

type PostgresInfraDiskReplacement struct {
	Reason      string     `json:"reason"`
	Bytes       int64      `json:"bytes"`
	ScheduledAt *time.Time `json:"scheduled_at"`
}

PostgresInfraDiskReplacement represents a scheduled disk replacement for a Postgres node.

type PostgresInfraNode added in v0.177.0

type PostgresInfraNode struct {
	Name                         string                        `json:"name"`
	NormalizedName               string                        `json:"normalized_name"`
	Role                         string                        `json:"role"`
	AvailabilityZone             string                        `json:"availability_zone"`
	ClusterName                  string                        `json:"cluster_name"`
	ClusterDisplayName           string                        `json:"cluster_display_name"`
	PeersCount                   int                           `json:"peers_count"`
	VolumeUsageBytes             *int64                        `json:"volume_usage_bytes"`
	VolumeCapacityBytes          *int64                        `json:"volume_capacity_bytes"`
	VolumeShrinkThresholdPercent *float64                      `json:"volume_shrink_threshold_percent"`
	Region                       Region                        `json:"region"`
	DiskReplacement              *PostgresInfraDiskReplacement `json:"disk_replacement"`
}

PostgresInfraNode represents a single Postgres instance in the branch infrastructure.

type PostgresRole added in v0.138.0

type PostgresRole struct {
	ID              string    `json:"id"`
	Name            string    `json:"name"`
	AccessHostURL   string    `json:"access_host_url"`
	DatabaseName    string    `json:"database_name"`
	Password        string    `json:"password"`
	Actor           Actor     `json:"actor"`
	Username        string    `json:"username"`
	WithReplication bool      `json:"with_replication"`
	CreatedAt       time.Time `json:"created_at"`
}

PostgresRole represents a PostgreSQL role in PlanetScale.

type Process added in v0.167.0

type Process struct {
	ID      int64  `json:"id"`
	User    string `json:"user"`
	Host    string `json:"host"`
	DB      string `json:"db"`
	Command string `json:"command"`
	Time    int64  `json:"time"`
	State   string `json:"state"`
	Info    string `json:"info"`
}

Process is a single row from `SHOW FULL PROCESSLIST` on the resolved primary tablet.

type ProcesslistRequest added in v0.167.0

type ProcesslistRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"-"`
	Shard        string `json:"-"`
}

ProcesslistRequest lists the MySQL process list for a branch. Keyspace/Shard are only required to disambiguate multi-keyspace or sharded databases; for a single unsharded keyspace they may be left empty.

type ProcesslistResult added in v0.167.0

type ProcesslistResult struct {
	Keyspace  string    `json:"keyspace"`
	Shard     string    `json:"shard"`
	Tablet    string    `json:"tablet"`
	Processes []Process `json:"processes"`
}

ProcesslistResult is the response from showing the process list. It echoes the keyspace/shard/tablet that were resolved so the caller knows where the processes (and their IDs) live.

type ProcesslistService added in v0.167.0

type ProcesslistService interface {
	List(context.Context, *ProcesslistRequest) (*ProcesslistResult, error)
	Kill(context.Context, *KillProcessRequest) (*KillProcessResult, error)
}

ProcesslistService is an interface for viewing and killing MySQL processes on a Vitess branch.

type PromoteRequest added in v0.46.0

type PromoteRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

PromoteRequest encapsulates the request for promoting a request to production.

type QueryPatternsReport added in v0.175.0

type QueryPatternsReport struct {
	PublicID    string    `json:"id"`
	State       string    `json:"state"`
	Actor       *Actor    `json:"actor"`
	URL         string    `json:"url"`
	DownloadURL string    `json:"download_url"`
	CreatedAt   time.Time `json:"created_at"`
	FinishedAt  time.Time `json:"finished_at"`
}

QueryPatternsReport represents a query patterns report for a branch.

type QueryPatternsService added in v0.175.0

QueryPatternsService is an interface for communicating with the PlanetScale query patterns API endpoints.

type QueuedDeployment

type QueuedDeployment struct {
	ID                  string `json:"id"`
	State               string `json:"state"`
	DeployRequestNumber uint64 `json:"deploy_request_number"`
	IntoBranch          string `json:"into_branch"`

	Actor *Actor `json:"actor"`

	CreatedAt  time.Time  `json:"created_at"`
	UpdatedAt  time.Time  `json:"updated_at"`
	StartedAt  *time.Time `json:"started_at"`
	QueuedAt   *time.Time `json:"queued_at"`
	FinishedAt *time.Time `json:"finished_at"`
}

QueuedDeployment encapsulates a deployment that is in the queue.

type ReassignPostgresRoleObjectsRequest added in v0.143.0

type ReassignPostgresRoleObjectsRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	RoleId       string `json:"-"`
	Successor    string `json:"successor"`
}

ReassignPostgresRoleObjectsRequest encapsulates the request for reassigning objects owned by one role to another role.

type RefreshSchemaRequest

type RefreshSchemaRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

RefreshSchemaRequest reflects the request needed to refresh a schema snapshot on a database branch.

type Region added in v0.29.0

type Region struct {
	Slug      string `json:"slug"`
	Provider  string `json:"provider"`
	Name      string `json:"display_name"`
	Location  string `json:"location"`
	Enabled   bool   `json:"enabled"`
	IsDefault bool   `json:"current_default"`
}

type RegionsService added in v0.29.0

type RegionsService interface {
	List(ctx context.Context, req *ListRegionsRequest) ([]*Region, error)
}

type RenewDatabaseBranchPasswordRequest added in v0.95.0

type RenewDatabaseBranchPasswordRequest struct {
	Organization string
	Database     string
	Branch       string
	PasswordId   string
}

RenewDatabaseBranchPasswordRequest encapsulates the request for renewing a password for a given database branch.

type RenewPostgresRoleRequest added in v0.139.0

type RenewPostgresRoleRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	RoleId       string `json:"-"`
}

RenewPostgresRoleRequest encapsulates the request for renewing role expiration for a database branch.

type ReplicationDurabilityConstraints added in v0.131.0

type ReplicationDurabilityConstraints struct {
	Strategy string `json:"strategy"`
}

type RequestOption added in v0.135.0

type RequestOption func(*requestOptions)

RequestOption allows for customizing HTTP requests

func WithQueryParams added in v0.135.0

func WithQueryParams(params url.Values) RequestOption

WithQueryParams sets query parameters for the request

type ResetDefaultRoleRequest added in v0.138.0

type ResetDefaultRoleRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

ResetDefaultRoleRequest encapsulates the request for resetting the default role of a Postgres database branch.

type ResetPostgresRolePasswordRequest added in v0.143.0

type ResetPostgresRolePasswordRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	RoleId       string `json:"-"`
}

ResetPostgresRolePasswordRequest encapsulates the request for resetting a role's password for a database branch.

type ResizeKeyspaceRequest added in v0.109.0

type ResizeKeyspaceRequest struct {
	Organization  string  `json:"-"`
	Database      string  `json:"-"`
	Branch        string  `json:"-"`
	Keyspace      string  `json:"-"`
	ExtraReplicas *uint   `json:"extra_replicas,omitempty"`
	ClusterSize   *string `json:"cluster_size,omitempty"`
}

type ResizePostgresBranchRequest added in v0.171.0

type ResizePostgresBranchRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	// ClusterSize is the fully-qualified cluster size SKU name to resize to,
	// e.g. "PS_10_GCP_X86". Use the values returned by ListClusterSKUs.
	ClusterSize string `json:"cluster_size,omitempty"`
	// Replicas is the desired number of replicas. Nil leaves it unchanged.
	Replicas *int `json:"replicas,omitempty"`
}

ResizePostgresBranchRequest encapsulates the request to resize a Postgres branch's cluster (and optionally change its replica count).

type RetryWorkflowRequest added in v0.128.0

type RetryWorkflowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	WorkflowNumber uint64 `json:"-"`
}

type ReverseCutoverWorkflowRequest added in v0.128.0

type ReverseCutoverWorkflowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	WorkflowNumber uint64 `json:"-"`
}

type ReverseTrafficWorkflowRequest added in v0.128.0

type ReverseTrafficWorkflowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	WorkflowNumber uint64 `json:"-"`
}

type RevertDeployRequestRequest added in v0.63.0

type RevertDeployRequestRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`
}

type ReviewAction

type ReviewAction int

ReviewAction defines the action for an individual review.

const (
	// Comment is used to comment a Review with a custom text.
	ReviewComment ReviewAction = iota

	// Approve is used to approve a Review.
	ReviewApprove
)

func (ReviewAction) String

func (r ReviewAction) String() string

type ReviewDeployRequestRequest

type ReviewDeployRequestRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`

	// CommentText represents the comment body to be posted
	CommentText string `json:"-"`

	// ReviewAction defines the action for an individual review.
	ReviewAction ReviewAction `json:"-"`
}

type RoutingRules added in v0.97.0

type RoutingRules struct {
	Raw  string `json:"raw"`
	HTML string `json:"html"`
}

type SchemaLintError added in v0.85.0

type SchemaLintError struct {
	LintError        string `json:"lint_error"`
	Keyspace         string `json:"keyspace_name"`
	Table            string `json:"table_name"`
	SubjectType      string `json:"subject_type"`
	ErrorDescription string `json:"error_description"`
	DocsURL          string `json:"docs_url"`
}

SchemaLintError represents an error with the branch's schema

type SchemaRecommendation added in v0.164.0

type SchemaRecommendation struct {
	ID                    string                 `json:"id"`
	HtmlURL               string                 `json:"html_url"`
	Title                 string                 `json:"title"`
	Table                 string                 `json:"table_name"`
	Keyspace              string                 `json:"keyspace"`
	DDLStatement          string                 `json:"ddl_statement"`
	Number                int                    `json:"number"`
	State                 string                 `json:"state"`
	RecommendationType    string                 `json:"recommendation_type"`
	CreatedAt             time.Time              `json:"created_at"`
	UpdatedAt             time.Time              `json:"updated_at"`
	AppliedAt             *time.Time             `json:"applied_at"`
	DismissedAt           *time.Time             `json:"dismissed_at"`
	ClosedByDeployRequest *ClosedByDeployRequest `json:"closed_by_deploy_request"`
	DismissedBy           *Actor                 `json:"dismissed_by"`
}

SchemaRecommendation represents a PlanetScale schema recommendation.

type SchemaRecommendationService added in v0.164.0

SchemaRecommendationService is an interface for communicating with the PlanetScale Schema recommendation API.

type ServiceToken

type ServiceToken struct {
	ID         string     `json:"id"`
	Type       string     `json:"type"`
	Token      string     `json:"token"`
	Name       *string    `json:"name"`
	CreatedAt  time.Time  `json:"created_at"`
	LastUsedAt *time.Time `json:"last_used_at"`
	ExpiresAt  *time.Time `json:"expires_at"`
}

type ServiceTokenAccess

type ServiceTokenAccess struct {
	ID       string               `json:"id"`
	Access   string               `json:"access"`
	Type     string               `json:"type"`
	Resource ServiceTokenResource `json:"resource"`
}

type ServiceTokenGrant added in v0.76.0

type ServiceTokenGrant struct {
	ID           string                     `json:"id"`
	ResourceName string                     `json:"resource_name"`
	ResourceType string                     `json:"resource_type"`
	ResourceID   string                     `json:"resource_id"`
	Accesses     []*ServiceTokenGrantAccess `json:"accesses"`
}

type ServiceTokenGrantAccess added in v0.81.0

type ServiceTokenGrantAccess struct {
	Access      string `json:"access"`
	Description string `json:"description"`
}

type ServiceTokenResource added in v0.94.0

type ServiceTokenResource struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type ServiceTokenService

ServiceTokenService is an interface for communicating with the PlanetScale Service Token API.

type ShardRollout added in v0.117.0

type ShardRollout struct {
	Name  string `json:"name"`
	State string `json:"state"`

	LastRolloutStartedAt  time.Time `json:"last_rollout_started_at"`
	LastRolloutFinishedAt time.Time `json:"last_rollout_finished_at"`
}

type SkipRevertDeployRequestRequest added in v0.63.0

type SkipRevertDeployRequestRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Number       uint64 `json:"-"`
}

type StartDataImportRequest added in v0.58.0

type StartDataImportRequest struct {
	Organization string           `json:"organization"`
	Database     string           `json:"database_name"`
	Connection   DataImportSource `json:"connection"`
	Region       string           `json:"region"`
	Plan         string           `json:"plan"`
	MaxPoolSize  int              `json:"max_pool_size"`
}

type StorageConfig added in v0.161.0

type StorageConfig struct {
	MinimumStorageBytes *int64 `json:"minimum_storage_bytes,omitempty"`
	MaximumStorageBytes *int64 `json:"maximum_storage_bytes,omitempty"`
}

StorageConfig represents storage size configuration for a database or branch.

type SwitchPrimariesWorkflowRequest added in v0.128.0

type SwitchPrimariesWorkflowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	WorkflowNumber uint64 `json:"-"`
}

type SwitchReplicasWorkflowRequest added in v0.128.0

type SwitchReplicasWorkflowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	WorkflowNumber uint64 `json:"-"`
}

type Tablet added in v0.160.0

type Tablet struct {
	Alias string `json:"alias"`
	Role  string `json:"role"`
	Cell  string `json:"cell"`
}

Tablet represents an individual vttablet.

type TabletGroup added in v0.160.0

type TabletGroup struct {
	Type     string   `json:"type"`
	Keyspace string   `json:"keyspace"`
	Shard    string   `json:"shard"`
	Tablets  []Tablet `json:"tablets"`
}

TabletGroup represents a group of tablets in a keyspace/shard.

type TestDataImportSourceRequest added in v0.58.0

type TestDataImportSourceRequest struct {
	Organization string           `json:"organization"`
	Database     string           `json:"database_name"`
	Connection   DataImportSource `json:"connection"`
}

type TestDataImportSourceResponse added in v0.58.0

type TestDataImportSourceResponse struct {
	CanConnect           bool   `json:"can_connect"`
	ShouldUpgradePlan    bool   `json:"should_upgrade"`
	SuggestedPlan        string `json:"suggested_plan"`
	SuggestedBillingPlan BillingPlan
	ConnectError         string                            `json:"error"`
	Errors               []*DataSourceIncompatibilityError `json:"lint_errors"`
	MaxPoolSize          int                               `json:"max_pool_size"`
}

type TestWebhookRequest added in v0.146.0

type TestWebhookRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	ID           string `json:"-"`
}

TestWebhookRequest is the request for testing a webhook.

type TrafficBudget added in v0.156.0

type TrafficBudget struct {
	ID   string `json:"id"`
	Type string `json:"type"`

	Name string `json:"name"`
	Mode string `json:"mode"`

	Capacity         *int `json:"capacity"`
	Rate             *int `json:"rate"`
	Burst            *int `json:"burst"`
	Concurrency      *int `json:"concurrency"`
	WarningThreshold *int `json:"warning_threshold"`

	Rules []TrafficRule `json:"rules"`

	Actor     Actor     `json:"actor"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

TrafficBudget represents a traffic budget on a branch.

type TrafficBudgetsService added in v0.156.0

TrafficBudgetsService communicates with the PlanetScale traffic budgets API.

type TrafficRule added in v0.156.0

type TrafficRule struct {
	ID                   string           `json:"id"`
	Type                 string           `json:"type"`
	Kind                 string           `json:"kind"`
	Fingerprint          *string          `json:"fingerprint"`
	Keyspace             *string          `json:"keyspace"`
	Tags                 []TrafficRuleTag `json:"tags"`
	Actor                Actor            `json:"actor"`
	SyntaxHighlightedSQL string           `json:"syntax_highlighted_sql"`
	CreatedAt            time.Time        `json:"created_at"`
	UpdatedAt            time.Time        `json:"updated_at"`
}

TrafficRule represents a rule for a traffic budget.

type TrafficRuleTag added in v0.156.0

type TrafficRuleTag struct {
	Type   string `json:"type"`
	KeyID  string `json:"key_id"`
	Key    string `json:"key"`
	Value  string `json:"value"`
	Source string `json:"source"`
}

TrafficRuleTag is a tag attached to a traffic rule.

type TrafficRulesService added in v0.156.0

type TrafficRulesService interface {
	Create(context.Context, *CreateTrafficRuleRequest) (*TrafficRule, error)
	Delete(context.Context, *DeleteTrafficRuleRequest) error
}

TrafficRulesService communicates with the PlanetScale traffic rules API.

type UpdateBranchRoutingRulesRequest added in v0.97.0

type UpdateBranchRoutingRulesRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	RoutingRules string `json:"routing_rules"`
}

type UpdateKeyspaceSettingsRequest added in v0.131.0

type UpdateKeyspaceSettingsRequest struct {
	Organization                     string                            `json:"-"`
	Database                         string                            `json:"-"`
	Branch                           string                            `json:"-"`
	Keyspace                         string                            `json:"-"`
	ReplicationDurabilityConstraints *ReplicationDurabilityConstraints `json:"replication_durability_constraints,omitempty"`
	VReplicationFlags                *VReplicationFlags                `json:"vreplication_flags,omitempty"`
}

type UpdateKeyspaceVSchemaRequest added in v0.106.0

type UpdateKeyspaceVSchemaRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"-"`
	VSchema      string `json:"vschema"`
}

type UpdatePostgresRoleRequest added in v0.139.0

type UpdatePostgresRoleRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	RoleId       string `json:"-"`
	Name         string `json:"name"`
}

UpdatePostgresRoleRequest encapsulates the request for updating a role name for a database branch.

type UpdateTrafficBudgetRequest added in v0.156.0

type UpdateTrafficBudgetRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	BudgetID     string `json:"-"`

	Name *string `json:"name,omitempty"`
	Mode *string `json:"mode,omitempty"`

	Capacity         *int `json:"capacity,omitempty"`
	Rate             *int `json:"rate,omitempty"`
	Burst            *int `json:"burst,omitempty"`
	Concurrency      *int `json:"concurrency,omitempty"`
	WarningThreshold *int `json:"warning_threshold,omitempty"`

	Rules *[]CreateTrafficBudgetRuleRequest `json:"rules,omitempty"`
}

UpdateTrafficBudgetRequest is the request for updating a traffic budget.

type UpdateWebhookRequest added in v0.146.0

type UpdateWebhookRequest struct {
	Organization string   `json:"-"`
	Database     string   `json:"-"`
	ID           string   `json:"-"`
	URL          *string  `json:"url,omitempty"`
	Enabled      *bool    `json:"enabled,omitempty"`
	Events       []string `json:"events,omitempty"`
}

UpdateWebhookRequest is the request for updating a webhook.

type UserShouldUpgradePlanError added in v0.60.0

type UserShouldUpgradePlanError struct{}

func (UserShouldUpgradePlanError) Error added in v0.60.0

type VDiffCreateRequest added in v0.149.0

type VDiffCreateRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Workflow     string `json:"-"`

	TargetKeyspace              string   `json:"target_keyspace"`
	AutoRetry                   *bool    `json:"auto_retry,omitempty"`
	AutoStart                   *bool    `json:"auto_start,omitempty"`
	DebugQuery                  bool     `json:"debug_query,omitempty"`
	OnlyPKs                     bool     `json:"only_pks,omitempty"`
	UpdateTableStats            bool     `json:"update_table_stats,omitempty"`
	Verbose                     bool     `json:"verbose,omitempty"`
	Tables                      []string `json:"tables,omitempty"`
	TabletTypes                 []string `json:"tablet_types,omitempty"`
	TabletSelectionPreference   string   `json:"tablet_selection_preference,omitempty"`
	FilteredReplicationWaitTime *int     `json:"filtered_replication_wait_time,omitempty"`
	MaxReportSampleRows         *int     `json:"max_report_sample_rows,omitempty"`
	MaxExtraRowsToCompare       *int     `json:"max_extra_rows_to_compare,omitempty"`
	RowDiffColumnTruncateAt     *int     `json:"row_diff_column_truncate_at,omitempty"`
	Limit                       *int     `json:"limit,omitempty"`
}

type VDiffDeleteRequest added in v0.149.0

type VDiffDeleteRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	Branch         string `json:"-"`
	Workflow       string `json:"-"`
	UUID           string `json:"-"`
	TargetKeyspace string `json:"-"`
}

type VDiffListRequest added in v0.154.0

type VDiffListRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	Branch         string `json:"-"`
	Workflow       string `json:"-"`
	TargetKeyspace string `json:"-"`
}

type VDiffResumeRequest added in v0.149.0

type VDiffResumeRequest struct {
	Organization   string   `json:"-"`
	Database       string   `json:"-"`
	Branch         string   `json:"-"`
	Workflow       string   `json:"-"`
	UUID           string   `json:"-"`
	TargetKeyspace string   `json:"target_keyspace"`
	TargetShards   []string `json:"target_shards,omitempty"`
}

type VDiffService added in v0.149.0

VDiffService is an interface for interacting with the VDiff endpoints of the PlanetScale API.

type VDiffShowRequest added in v0.149.0

type VDiffShowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	Branch         string `json:"-"`
	Workflow       string `json:"-"`
	UUID           string `json:"-"`
	TargetKeyspace string `json:"-"`
}

type VDiffStopRequest added in v0.149.0

type VDiffStopRequest struct {
	Organization   string   `json:"-"`
	Database       string   `json:"-"`
	Branch         string   `json:"-"`
	Workflow       string   `json:"-"`
	UUID           string   `json:"-"`
	TargetKeyspace string   `json:"target_keyspace"`
	TargetShards   []string `json:"target_shards,omitempty"`
}

type VReplicationFlags added in v0.131.0

type VReplicationFlags struct {
	OptimizeInserts           bool `json:"optimize_inserts"`
	AllowNoBlobBinlogRowImage bool `json:"allow_no_blob_binlog_row_image"`
	VPlayerBatching           bool `json:"vplayer_batching"`
}

type VSchema added in v0.98.0

type VSchema struct {
	Raw  string `json:"raw"`
	HTML string `json:"html"`
}

VSchema represnts the VSchema for a branch keyspace

type VerifyDataWorkflowRequest added in v0.128.0

type VerifyDataWorkflowRequest struct {
	Organization   string `json:"-"`
	Database       string `json:"-"`
	WorkflowNumber uint64 `json:"-"`
}

type VitessBranchInfrastructure added in v0.177.0

type VitessBranchInfrastructure struct {
	Ready bool              `json:"ready"`
	Pods  []*BranchInfraPod `json:"pods"`
}

VitessBranchInfrastructure represents the infrastructure (pods) for a Vitess branch.

type VtctldCheckThrottlerRequest added in v0.165.0

type VtctldCheckThrottlerRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	TabletAlias string `json:"tablet_alias"`
	// AppName is the app to issue the check on behalf of (e.g. "online-ddl"). If
	// empty, the throttler's default app is used.
	AppName string `json:"app_name,omitempty"`
	// Scope is the scope of the check, either "shard" or "self". If empty, the
	// throttler's default scope is used.
	Scope string `json:"scope,omitempty"`
	// SkipRequestHeartbeats instructs the throttler not to renew its heartbeat
	// lease while serving this check.
	SkipRequestHeartbeats *bool `json:"skip_request_heartbeats,omitempty"`
	// OkIfNotExists instructs the throttler to return OK even if the requested
	// metric does not exist.
	OkIfNotExists *bool `json:"ok_if_not_exists,omitempty"`
}

VtctldCheckThrottlerRequest is a request for issuing a throttler check against a single tablet. The tablet is identified by its alias, as discovered via ListTablets.

type VtctldGetRoutingRulesRequest added in v0.168.1

type VtctldGetRoutingRulesRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
}

VtctldGetRoutingRulesRequest is a request for reading live routing rules from the cluster via vtctld.

type VtctldGetShardRequest added in v0.170.0

type VtctldGetShardRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"-"`
	Shard        string `json:"-"`
}

VtctldGetShardRequest is a request for reading a shard record from the cluster via vtctld.

type VtctldGetThrottlerStatusRequest added in v0.165.0

type VtctldGetThrottlerStatusRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	TabletAlias  string `json:"-"`
}

VtctldGetThrottlerStatusRequest is a request for reading the tablet throttler status from a single tablet. The tablet is identified by its alias, as discovered via ListTablets.

type VtctldListKeyspacesRequest added in v0.149.0

type VtctldListKeyspacesRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Name         string `json:"-"`
}

type VtctldListWorkflowsRequest added in v0.149.0

type VtctldListWorkflowsRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Keyspace     string `json:"-"`
	Workflow     string `json:"-"`
	IncludeLogs  *bool  `json:"-"`
}

type VtctldOperation added in v0.153.0

type VtctldOperation struct {
	ID          string          `json:"id"`
	Type        string          `json:"type"`
	Action      string          `json:"action"`
	Timeout     int             `json:"timeout"`
	CreatedAt   time.Time       `json:"created_at"`
	CompletedAt *time.Time      `json:"completed_at"`
	State       string          `json:"state"`
	Completed   bool            `json:"completed"`
	Metadata    json.RawMessage `json:"metadata"`
	Result      json.RawMessage `json:"result"`
	Error       string          `json:"error"`
}

VtctldOperation represents a generic vtctld operation resource.

type VtctldOperationReference added in v0.153.0

type VtctldOperationReference struct {
	ID string `json:"id"`
}

VtctldOperationReference identifies an accepted vtctld operation that can be polled later.

type VtctldRefreshStateByShardRequest added in v0.174.0

type VtctldRefreshStateByShardRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	Keyspace string   `json:"keyspace"`
	Shard    string   `json:"shard"`
	Cells    []string `json:"cells,omitempty"`
}

VtctldRefreshStateByShardRequest reloads tablet records for all tablets in a shard via vtctld.

type VtctldSetShardTabletControlRequest added in v0.170.0

type VtctldSetShardTabletControlRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	Keyspace            string   `json:"keyspace"`
	Shard               string   `json:"shard"`
	TabletType          string   `json:"tablet_type"`
	Cells               []string `json:"cells,omitempty"`
	DeniedTables        []string `json:"denied_tables,omitempty"`
	Remove              *bool    `json:"remove,omitempty"`
	DisableQueryService *bool    `json:"disable_query_service,omitempty"`
}

VtctldSetShardTabletControlRequest is a request for updating shard tablet controls via vtctld.

type VtctldStartWorkflowRequest added in v0.150.0

type VtctldStartWorkflowRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Workflow     string `json:"-"`
	Keyspace     string `json:"keyspace"`
}

VtctldStartWorkflowRequest is a request for starting a workflow.

type VtctldStopWorkflowRequest added in v0.150.0

type VtctldStopWorkflowRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`
	Workflow     string `json:"-"`
	Keyspace     string `json:"keyspace"`
}

VtctldStopWorkflowRequest is a request for stopping a workflow.

type VtctldThrottledAppConfig added in v0.165.0

type VtctldThrottledAppConfig struct {
	// Name is the app to throttle (e.g. "online-ddl", "vreplication", or an
	// Online DDL migration UUID).
	Name string `json:"name"`
	// Ratio is the fraction of operations to throttle for the app, 0.00-1.00 in
	// increments of 0.01.
	Ratio *float64 `json:"ratio,omitempty"`
	// ExpireAt is an optional RFC3339 expiration time for the app rule. It must
	// be in the future. Omit to throttle until changed.
	ExpireAt string `json:"expire_at,omitempty"`
}

VtctldThrottledAppConfig configures a single throttled app rule for UpdateThrottlerConfig.

type VtctldUpdateThrottlerConfigRequest added in v0.165.0

type VtctldUpdateThrottlerConfigRequest struct {
	Organization string `json:"-"`
	Database     string `json:"-"`
	Branch       string `json:"-"`

	Keyspace string `json:"keyspace"`
	// Enabled controls whether the tablet throttler is enabled for the keyspace.
	// It is required: the API has no tri-state, so omitting it would disable the
	// throttler.
	Enabled bool `json:"enabled"`
	// Threshold is the threshold for the default throttler check (replication lag
	// in seconds). It must be >= 0; the server defaults to 5.0 when omitted.
	Threshold *float64 `json:"threshold,omitempty"`
	// Apps configures zero or more per-app throttling rules.
	Apps []VtctldThrottledAppConfig `json:"apps,omitempty"`
}

VtctldUpdateThrottlerConfigRequest is a request for updating the tablet throttler configuration for a keyspace.

type Webhook added in v0.146.0

type Webhook struct {
	ID              string    `json:"id"`
	URL             string    `json:"url"`
	Secret          string    `json:"secret"`
	Enabled         bool      `json:"enabled"`
	LastSentResult  string    `json:"last_sent_result"`
	LastSentSuccess bool      `json:"last_sent_success"`
	LastSentAt      time.Time `json:"last_sent_at"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	Events          []string  `json:"events"`
}

Webhook represents a PlanetScale webhook.

type WebhooksService added in v0.146.0

WebhooksService is an interface for communicating with the PlanetScale Webhooks API.

type Workflow added in v0.126.0

type Workflow struct {
	ID                  string     `json:"id"`
	Name                string     `json:"name"`
	Number              uint64     `json:"number"`
	State               string     `json:"state"`
	CreatedAt           time.Time  `json:"created_at"`
	UpdatedAt           time.Time  `json:"updated_at"`
	StartedAt           *time.Time `json:"started_at"`
	CompletedAt         *time.Time `json:"completed_at"`
	CancelledAt         *time.Time `json:"cancelled_at"`
	ReversedAt          *time.Time `json:"reversed_at"`
	RetriedAt           *time.Time `json:"retried_at"`
	DataCopyCompletedAt *time.Time `json:"data_copy_completed_at"`
	CutoverAt           *time.Time `json:"cutover_at"`
	ReplicasSwitched    bool       `json:"replicas_switched"`
	PrimariesSwitched   bool       `json:"primaries_switched"`
	SwitchReplicasAt    *time.Time `json:"switch_replicas_at"`
	SwitchPrimariesAt   *time.Time `json:"switch_primaries_at"`
	VerifyDataAt        *time.Time `json:"verify_data_at"`

	Branch         DatabaseBranch `json:"branch"`
	SourceKeyspace Keyspace       `json:"source_keyspace"`
	TargetKeyspace Keyspace       `json:"target_keyspace"`

	Actor             Actor  `json:"actor"`
	VerifyDataBy      *Actor `json:"verify_data_by"`
	ReversedBy        *Actor `json:"reversed_by"`
	SwitchReplicasBy  *Actor `json:"switch_replicas_by"`
	SwitchPrimariesBy *Actor `json:"switch_primaries_by"`
	CancelledBy       *Actor `json:"cancelled_by"`
	CompletedBy       *Actor `json:"completed_by"`
	RetriedBy         *Actor `json:"retried_by"`
	CutoverBy         *Actor `json:"cutover_by"`
	ReversedCutoverBy *Actor `json:"reversed_cutover_by"`

	Streams []*WorkflowStream `json:"streams"`
	Tables  []*WorkflowTable  `json:"tables"`
	VDiff   *WorkflowVDiff    `json:"vdiff"`
}

type WorkflowStream added in v0.126.0

type WorkflowStream struct {
	PublicID             string              `json:"id"`
	State                string              `json:"state"`
	CreatedAt            time.Time           `json:"created_at"`
	UpdatedAt            time.Time           `json:"updated_at"`
	TargetShard          string              `json:"target_shard"`
	SourceShard          string              `json:"source_shard"`
	Position             string              `json:"position"`
	StopPosition         string              `json:"stop_position"`
	RowsCopied           int64               `json:"rows_copied"`
	ComponentThrottled   *string             `json:"component_throttled"`
	ComponentThrottledAt *time.Time          `json:"component_throttled_at"`
	PrimaryServing       bool                `json:"primary_serving"`
	Info                 string              `json:"info"`
	Logs                 []WorkflowStreamLog `json:"logs"`
}

type WorkflowStreamLog added in v0.126.0

type WorkflowStreamLog struct {
	PublicID  string    `json:"id"`
	State     string    `json:"state"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Message   string    `json:"message"`
	LogType   string    `json:"log_type"`
}

type WorkflowTable added in v0.126.0

type WorkflowTable struct {
	PublicID       string    `json:"id"`
	Name           string    `json:"name"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	RowsCopied     uint64    `json:"rows_copied"`
	RowsTotal      uint64    `json:"rows_total"`
	RowsPercentage uint      `json:"rows_percentage"`
}

type WorkflowVDiff added in v0.126.0

type WorkflowVDiff struct {
	PublicID           string                     `json:"id"`
	State              string                     `json:"state"`
	CreatedAt          time.Time                  `json:"created_at"`
	UpdatedAt          time.Time                  `json:"updated_at"`
	StartedAt          *time.Time                 `json:"started_at"`
	CompletedAt        *time.Time                 `json:"completed_at"`
	HasMismatch        bool                       `json:"has_mismatch"`
	ProgressPercentage uint                       `json:"progress_percentage"`
	EtaSeconds         uint64                     `json:"eta_seconds"`
	TableReports       []WorkflowVDiffTableReport `json:"table_reports"`
}

type WorkflowVDiffTableReport added in v0.126.0

type WorkflowVDiffTableReport struct {
	PublicID                   string        `json:"id"`
	TableName                  string        `json:"table_name"`
	Shard                      string        `json:"shard"`
	MismatchedRowsCount        int64         `json:"mismatched_rows_count"`
	ExtraSourceRowsCount       int64         `json:"extra_source_rows_count"`
	ExtraTargetRowsCount       int64         `json:"extra_target_rows_count"`
	ExtraSourceRows            []interface{} `json:"extra_source_rows"`
	ExtraTargetRows            []interface{} `json:"extra_target_rows"`
	MismatchedRows             []interface{} `json:"mismatched_rows"`
	SampleExtraSourceRowsQuery string        `json:"sample_extra_source_rows_query"`
	SampleExtraTargetRowsQuery string        `json:"sample_extra_target_rows_query"`
	SampleMismatchedRowsQuery  string        `json:"sample_mismatched_rows_query"`
	CreatedAt                  time.Time     `json:"created_at"`
	UpdatedAt                  time.Time     `json:"updated_at"`
}

type WorkflowsService added in v0.126.0

WorkflowsService is an interface for interacting with the workflow endpoints of the PlanetScale API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
Morty Proxy This is a proxified and sanitized view of the page, visit original site.