Documentation
¶
Overview ¶
Package planetscale is the CLI's client for the PlanetScale API.
It was vendored from github.com/planetscale/planetscale-go (v0.178.0) in July 2026 and is maintained here; the CLI no longer depends on that module. New endpoints are added directly to this package in the same PR as the CLI feature that uses them, and are synced back to planetscale-go for external users. See doc/api-client.md for background.
Index ¶
- Constants
- func IsSignedDownloadTransportError(err error) bool
- func NewAuditLogsService(client *Client) *auditlogsService
- func NewBackupPoliciesService(client *Client) *backupPoliciesService
- func NewBackupsService(client *Client) *backupsService
- func NewBranchInfrastructureService(client *Client) *branchInfrastructureService
- func NewDatabaseBranchesService(client *Client) *databaseBranchesService
- func NewDatabasesService(client *Client) *databasesService
- func NewDeployRequestsService(client *Client) *deployRequestsService
- func NewKeyspacesService(client *Client) *keyspacesService
- func NewOrganizationsService(client *Client) *organizationsService
- func NewPasswordsService(client *Client) *passwordsService
- func NewPostgresBranchesService(client *Client) *postgresBranchesService
- func NewPostgresCIDRsService(client *Client) *postgresCIDRsService
- func NewPostgresRolesService(client *Client) *postgresRolesService
- func NewQueryPatternsService(client *Client) *queryPatternsService
- func NewRegionsSevice(client *Client) *regionsService
- func NewTrafficBudgetsService(client *Client) *trafficBudgetsService
- func NewTrafficRulesService(client *Client) *trafficRulesService
- func NewWorkflowsService(client *Client) *workflowsService
- type Actor
- type AddOrganizationTeamMemberRequest
- type AddServiceTokenAccessRequest
- type AggressiveCutover
- type AggressiveCutoverRequest
- type Anomaly
- type ApplyDeployRequestRequest
- type AuditLog
- type AuditLogEvent
- type AuditLogsService
- type AuthAttemptExport
- type AuthAttemptExportFilters
- type AuthAttemptExportsService
- type AutoApplyDeployRequestRequest
- type AutoDeleteBranchRequest
- type Backup
- type BackupPoliciesService
- type BackupPolicy
- type BackupsService
- type BillingPaymentMethod
- type BillingPaymentMethodSetup
- type BillingPaymentMethodSetupsService
- type BillingPaymentMethodsService
- type BillingPlan
- type BranchInfraPod
- type BranchInfrastructure
- type BranchInfrastructureService
- type BranchMaintenanceService
- type BranchResizeRequest
- type BranchResizeStatusRequest
- type BranchRoutingRulesRequest
- type BranchSchemaRequest
- type CancelBranchResizeRequest
- type CancelDataImportRequest
- type CancelDeployRequestRequest
- type CancelKeyspaceResizeRequest
- type CancelPostgresBouncerResizesRequest
- type CancelPostgresBranchChangesRequest
- type CancelWorkflowRequest
- type CheckDeployRequestStorageRequest
- type Client
- type ClientOption
- func WithAccessToken(token string) ClientOption
- func WithBaseURL(baseURL string) ClientOption
- func WithHTTPClient(client *http.Client) ClientOption
- func WithRequestHeaders(headers map[string]string) ClientOption
- func WithServiceToken(name, token string) ClientOption
- func WithUserAgent(userAgent string) ClientOption
- type CloseDeployRequestRequest
- type CloseRequest
- type ClosedByDeployRequest
- type ClusterSKU
- type CompleteWorkflowRequest
- type Correlation
- type CreateAuthAttemptExportRequest
- type CreateBackupPolicyRequest
- type CreateBackupRequest
- type CreateBillingPaymentMethodSetupRequest
- type CreateD1ImportNotificationRequest
- type CreateDatabaseBranchRequest
- type CreateDatabaseRequest
- type CreateDeployRequestRequest
- type CreateKeyspaceRequest
- type CreateOrganizationTeamRequest
- type CreatePostgresBouncerRequest
- type CreatePostgresBranchRequest
- type CreatePostgresCIDRRequest
- type CreatePostgresReadOnlyReplicaRequest
- type CreatePostgresRoleRequest
- type CreatePostgresSwitchoverRequest
- type CreateQueryPatternsReportRequest
- type CreateServiceTokenRequest
- type CreateTrafficBudgetRequest
- type CreateTrafficBudgetRuleRequest
- type CreateTrafficRuleRequest
- type CreateWebhookRequest
- type CreateWorkflowRequest
- type CursorPaginatedResponse
- type CutoverWorkflowRequest
- type D1ImportNotificationsService
- type DataImport
- type DataImportSource
- type DataImportState
- type DataImportsService
- type DataSourceIncompatibilityError
- type Database
- type DatabaseBranch
- type DatabaseBranchPassword
- type DatabaseBranchPasswordRequest
- type DatabaseBranchesService
- type DatabaseDeletionRequest
- type DatabaseEngine
- type DatabaseState
- type DatabaseThrottler
- type DatabasesService
- type DeleteBackupPolicyRequest
- type DeleteBackupRequest
- type DeleteBillingPaymentMethodRequest
- type DeleteDatabaseBranchPasswordRequest
- type DeleteDatabaseBranchRequest
- type DeleteDatabaseRequest
- type DeleteKeyspaceRequest
- type DeleteOrganizationTeamRequest
- type DeletePostgresBouncerRequest
- type DeletePostgresBranchRequest
- type DeletePostgresCIDRRequest
- type DeletePostgresReadOnlyReplicaRequest
- type DeletePostgresRoleRequest
- type DeleteQueryPatternsReportRequest
- type DeleteServiceTokenAccessRequest
- type DeleteServiceTokenRequest
- type DeleteTrafficBudgetRequest
- type DeleteTrafficRuleRequest
- type DeleteWebhookRequest
- type DemoteRequest
- type DeployOperation
- type DeployRequest
- type DeployRequestReview
- type DeployRequestStorageCheck
- type DeployRequestThrottler
- type DeployRequestsService
- type Deployment
- type DeploymentLintError
- type DetachExternalDatabaseRequest
- type Diff
- type DiffBranchRequest
- type DiffRequest
- type DisableSafeMigrationsRequest
- type DiskAutoscaling
- type DiskAutoscalingUpdate
- type DismissSchemaRecommendationRequest
- type DownloadAuthAttemptExportRequest
- type DownloadQueryPatternsReportRequest
- type EnableSafeMigrationsRequest
- type Error
- type ErrorCode
- type ExternalDataSourceSSLVerificationMode
- type ForceCutoverDeployRequestRequest
- type GetAnomalyRequest
- type GetAuthAttemptExportRequest
- type GetBackupPolicyRequest
- type GetBackupRequest
- type GetBillingPaymentMethodRequest
- type GetBillingPaymentMethodSetupRequest
- type GetBranchInfrastructureRequest
- type GetBranchMetricsRequest
- type GetDatabaseBranchPasswordRequest
- type GetDatabaseBranchRequest
- type GetDatabaseRequest
- type GetDatabaseThrottlerRequest
- type GetDefaultPostgresRoleRequest
- type GetDeployOperationsRequest
- type GetDeployQueueRequest
- type GetDeployRequestRequest
- type GetDeployRequestThrottlerRequest
- type GetDeploymentRequest
- type GetImportStatusRequest
- type GetInstantMetricsRequest
- type GetInstantTabletMetricsRequest
- type GetInvoiceRequest
- type GetKeyspaceRequest
- type GetKeyspaceVSchemaRequest
- type GetMaintenanceScheduleRequest
- type GetMetricSeriesRequest
- type GetOrganizationMemberRequest
- type GetOrganizationRequest
- type GetOrganizationTeamRequest
- type GetPlannedReparentShardRequest
- type GetPostgresBouncerRequest
- type GetPostgresBranchChangeRequest
- type GetPostgresBranchRequest
- type GetPostgresCIDRRequest
- type GetPostgresReadOnlyReplicaRequest
- type GetPostgresRoleRequest
- type GetPostgresSwitchoverRequest
- type GetQueryMetricSeriesRequest
- type GetQueryPatternsReportRequest
- type GetQueryRequest
- type GetQuerySummaryRequest
- type GetQueryTagRequest
- type GetSchemaRecommendationRequest
- type GetServiceTokenAccessRequest
- type GetServiceTokenRequest
- type GetTabletMetricSeriesRequest
- type GetTagMetricSeriesRequest
- type GetTrafficBudgetRequest
- type GetVtctldOperationRequest
- type GetWebhookRequest
- type GetWorkflowRequest
- type IndexUsage
- type InstantMetric
- type InstantMetrics
- type Invoice
- type InvoiceAmount
- type InvoiceBudgetAmount
- type InvoiceLineItem
- type InvoiceLineItemPage
- type InvoiceLineItemResource
- type InvoicePage
- type InvoicesService
- type Keyspace
- type KeyspaceResizeRequest
- type KeyspaceResizeStatusRequest
- type KeyspaceRollout
- type KeyspaceRolloutStatusRequest
- type KeyspacesService
- type KillProcessRequest
- type KillProcessResult
- type LintSchemaRequest
- type ListAnomaliesRequest
- type ListAuditLogsRequest
- type ListBackupPoliciesRequest
- type ListBackupsRequest
- type ListBranchClusterSKUsRequest
- type ListBranchResizesRequest
- type ListBranchTabletsRequest
- type ListDatabaseBranchPasswordRequest
- type ListDatabaseBranchesRequest
- type ListDatabaseRegionsRequest
- type ListDatabasesRequest
- type ListDeployRequestReviewsRequest
- type ListDeployRequestsRequest
- type ListErrorQueriesRequest
- type ListInvoiceLineItemsRequest
- type ListInvoicesRequest
- type ListKeyspacesRequest
- type ListMaintenanceSchedulesRequest
- type ListMaintenanceWindowsRequest
- type ListOption
- func WithEventFilters(events []AuditLogEvent) ListOption
- func WithFingerprint(fingerprint string) ListOption
- func WithKeyspace(keyspace string) ListOption
- func WithLimit(limit int) ListOption
- func WithPage(page int) ListOption
- func WithPerPage(perPage int) ListOption
- func WithPeriod(period string) ListOption
- func WithPostgreSQL() ListOption
- func WithRates() ListOption
- func WithRegion(region string) ListOption
- func WithSearch(search string) ListOption
- func WithSort(sort, dir string) ListOption
- func WithStartingAfter(startingAfter string) ListOption
- func WithStatus(status string) ListOption
- func WithTags(tags []string) ListOption
- func WithTimeRange(from, to string) ListOption
- type ListOptions
- type ListOrganizationClusterSKUsRequest
- type ListOrganizationMembersRequest
- type ListOrganizationRegionsRequest
- type ListOrganizationTeamMembersRequest
- type ListOrganizationTeamsRequest
- type ListPostgresBouncerResizesRequest
- type ListPostgresBouncersRequest
- type ListPostgresBranchChangesRequest
- type ListPostgresBranchesRequest
- type ListPostgresCIDRsRequest
- type ListPostgresExtensionsRequest
- type ListPostgresParametersRequest
- type ListPostgresReadOnlyReplicasRequest
- type ListPostgresRolesRequest
- type ListPostgresSwitchoversRequest
- type ListQueryInsightsErrorsRequest
- type ListQueryInsightsRequest
- type ListQueryPatternsReportsRequest
- type ListQuerySamplesRequest
- type ListQueryTagsRequest
- type ListQueryTrafficBudgetsRequest
- type ListReadOnlyRegionsRequest
- type ListRegionsRequest
- type ListSchemaRecommendationsRequest
- type ListServiceTokenGrantsRequest
- type ListServiceTokensRequest
- type ListTagSummariesRequest
- type ListTrafficBudgetsRequest
- type ListWebhooksRequest
- type ListWorkflowsRequest
- type LookupVindexCancelRequest
- type LookupVindexCompleteRequest
- type LookupVindexCreateRequest
- type LookupVindexExternalizeRequest
- type LookupVindexInternalizeRequest
- type LookupVindexService
- type LookupVindexShowRequest
- type MaintenanceSchedule
- type MaintenanceSchedulesService
- type MaintenanceWindow
- type MakePlanetScalePrimaryRequest
- type MakePlanetScaleReplicaRequest
- type MaterializeCancelRequest
- type MaterializeCreateRequest
- type MaterializeService
- type MaterializeShowRequest
- type MaterializeStartRequest
- type MaterializeStopRequest
- type MetricSeries
- type MetricsService
- type MoveTablesCancelRequest
- type MoveTablesCompleteRequest
- type MoveTablesCreateRequest
- type MoveTablesReverseTrafficRequest
- type MoveTablesService
- type MoveTablesShowRequest
- type MoveTablesStatusRequest
- type MoveTablesSwitchTrafficRequest
- type Organization
- type OrganizationDomain
- type OrganizationMemberUser
- type OrganizationMembership
- type OrganizationSSO
- type OrganizationSSODomainRequest
- type OrganizationSSORequest
- type OrganizationSSOService
- type OrganizationTeam
- type OrganizationTeamActor
- type OrganizationTeamDatabase
- type OrganizationTeamMembership
- type OrganizationTeamUser
- type OrganizationsService
- type PasswordsService
- type PerformDeployRequest
- type PlannedReparentShardRequest
- type PlannedReparentShardService
- type PostgresBouncer
- type PostgresBouncerBranch
- type PostgresBouncerParameter
- type PostgresBouncerResizeRequest
- type PostgresBouncerSKU
- type PostgresBouncersService
- type PostgresBranch
- type PostgresBranchClusterResizeRequest
- type PostgresBranchInfrastructure
- type PostgresBranchSchema
- type PostgresBranchSchemaRequest
- type PostgresBranchesService
- type PostgresCIDR
- type PostgresCIDRsService
- type PostgresExtension
- type PostgresInfraBouncer
- type PostgresInfraBouncerSKU
- type PostgresInfraDiskReplacement
- type PostgresInfraNode
- type PostgresParameter
- type PostgresReadOnlyReplica
- type PostgresReadOnlyReplicasService
- type PostgresRole
- type PostgresRolesService
- type PostgresSwitchover
- type PostgresSwitchoversService
- type Process
- type ProcesslistRequest
- type ProcesslistResult
- type ProcesslistService
- type PromoteRequest
- type Query
- type QueryInsight
- type QueryInsightError
- type QueryInsightsService
- type QueryPatternsReport
- type QueryPatternsService
- type QuerySample
- type QuerySampleTag
- type QuerySummary
- type QueryTag
- type QueryTagValue
- type QueuedDeployment
- type ReadOnlyRegion
- type ReadOnlyRegionKeyspace
- type ReadOnlyRegionKeyspaceConfig
- type ReadOnlyRegionsService
- type ReassignPostgresRoleObjectsRequest
- type RefreshSchemaRequest
- type Region
- type RegionsService
- type RemoveOrganizationMemberRequest
- type RemoveOrganizationTeamMemberRequest
- type RenewDatabaseBranchPasswordRequest
- type RenewPostgresRoleRequest
- type ReplicationDurabilityConstraints
- type RequestOption
- type ResetDefaultRoleRequest
- type ResetPostgresRolePasswordRequest
- type ResizeBranchRequest
- type ResizeKeyspaceRequest
- type ResizePostgresBouncerRequest
- type ResizePostgresBranchRequest
- type RetryWorkflowRequest
- type ReverseCutoverWorkflowRequest
- type ReverseTrafficWorkflowRequest
- type RevertDeployRequestRequest
- type ReviewAction
- type ReviewDeployRequestRequest
- type RoutingRules
- type RunBranchMaintenanceRequest
- type SSOPortal
- type SchemaLintError
- type SchemaRecommendation
- type SchemaRecommendationService
- type ServiceToken
- type ServiceTokenAccess
- type ServiceTokenGrant
- type ServiceTokenGrantAccess
- type ServiceTokenResource
- type ServiceTokenService
- type ShardRollout
- type SkipRevertDeployRequestRequest
- type StartDataImportRequest
- type StorageConfig
- type SwitchPrimariesWorkflowRequest
- type SwitchReplicasWorkflowRequest
- type Tablet
- type TabletGroup
- type TagSummary
- type TestDataImportSourceRequest
- type TestDataImportSourceResponse
- type TestWebhookRequest
- type ThrottlerConfigurable
- type ThrottlerConfiguration
- type TimeSeries
- type TrafficBudget
- type TrafficBudgetsService
- type TrafficRule
- type TrafficRuleTag
- type TrafficRulesService
- type UnblockDeployRequestRequest
- type UpdateBackupPolicyRequest
- type UpdateBackupRequest
- type UpdateBranchRoutingRulesRequest
- type UpdateDatabaseBranchPasswordRequest
- type UpdateDatabaseBranchRequest
- type UpdateDatabaseSettingsRequest
- type UpdateDatabaseThrottlerRequest
- type UpdateDeployRequestThrottlerRequest
- type UpdateKeyspaceSettingsRequest
- type UpdateKeyspaceVSchemaRequest
- type UpdateOrganizationMemberRequest
- type UpdateOrganizationRequest
- type UpdateOrganizationTeamRequest
- type UpdatePostgresBranchRequest
- type UpdatePostgresCIDRRequest
- type UpdatePostgresReadOnlyReplicaRequest
- type UpdatePostgresRoleRequest
- type UpdateReadOnlyRegionsRequest
- type UpdateThrottlerConfiguration
- type UpdateTrafficBudgetRequest
- type UpdateWebhookRequest
- type UserShouldUpgradePlanError
- type VDiffCreateRequest
- type VDiffDeleteRequest
- type VDiffListRequest
- type VDiffResumeRequest
- type VDiffService
- type VDiffShowRequest
- type VDiffStopRequest
- type VReplicationFlags
- type VSchema
- type VerifyDataWorkflowRequest
- type VitessBranchInfrastructure
- type VtctldApplyKeyspaceRoutingRulesRequest
- type VtctldCheckThrottlerRequest
- type VtctldGetKeyspaceRoutingRulesRequest
- type VtctldGetRoutingRulesRequest
- type VtctldGetShardRequest
- type VtctldGetThrottlerStatusRequest
- type VtctldKeyspaceRoutingRule
- type VtctldKeyspaceRoutingRules
- type VtctldListKeyspacesRequest
- type VtctldListWorkflowsRequest
- type VtctldOperation
- type VtctldOperationReference
- type VtctldRefreshStateByShardRequest
- type VtctldService
- type VtctldSetShardTabletControlRequest
- type VtctldStartWorkflowRequest
- type VtctldStopWorkflowRequest
- type VtctldThrottledAppConfig
- type VtctldUpdateThrottlerConfigRequest
- type Webhook
- type WebhooksService
- type Workflow
- type WorkflowStream
- type WorkflowStreamLog
- type WorkflowTable
- type WorkflowVDiff
- type WorkflowVDiffTableReport
- type WorkflowsService
Constants ¶
const ( PostgresBouncerResizeStatePending = "pending" PostgresBouncerResizeStateResizing = "resizing" PostgresBouncerResizeStateCanceled = "canceled" PostgresBouncerResizeStateCompleted = "completed" )
const ( PostgresBranchChangeStateCompleted = "completed" PostgresBranchChangeStateCanceled = "canceled" )
Terminal states for a PostgresBranchClusterResizeRequest. Non-terminal states are "queued", "pending", and "resizing".
const (
DefaultBaseURL = "https://api.planetscale.com/"
)
Variables ¶
This section is empty.
Functions ¶
func IsSignedDownloadTransportError ¶ added in v0.313.0
IsSignedDownloadTransportError reports whether a signed download failed before its response body was available.
func NewAuditLogsService ¶
func NewAuditLogsService(client *Client) *auditlogsService
func NewBackupPoliciesService ¶ added in v0.313.0
func NewBackupPoliciesService(client *Client) *backupPoliciesService
func NewBackupsService ¶
func NewBackupsService(client *Client) *backupsService
func NewBranchInfrastructureService ¶
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 ¶
func NewKeyspacesService(client *Client) *keyspacesService
func NewOrganizationsService ¶
func NewOrganizationsService(client *Client) *organizationsService
func NewPasswordsService ¶
func NewPasswordsService(client *Client) *passwordsService
func NewPostgresBranchesService ¶
func NewPostgresBranchesService(client *Client) *postgresBranchesService
func NewPostgresCIDRsService ¶ added in v0.313.0
func NewPostgresCIDRsService(client *Client) *postgresCIDRsService
NewPostgresCIDRsService returns a PostgresCIDRsService that uses the given client.
func NewPostgresRolesService ¶
func NewPostgresRolesService(client *Client) *postgresRolesService
func NewQueryPatternsService ¶
func NewQueryPatternsService(client *Client) *queryPatternsService
func NewRegionsSevice ¶
func NewRegionsSevice(client *Client) *regionsService
func NewTrafficBudgetsService ¶
func NewTrafficBudgetsService(client *Client) *trafficBudgetsService
NewTrafficBudgetsService returns a TrafficBudgetsService backed by client.
func NewTrafficRulesService ¶
func NewTrafficRulesService(client *Client) *trafficRulesService
NewTrafficRulesService returns a TrafficRulesService backed by client.
func NewWorkflowsService ¶
func NewWorkflowsService(client *Client) *workflowsService
Types ¶
type Actor ¶
type Actor struct {
Type string `json:"type"`
ID string `json:"id"`
Name string `json:"display_name"`
}
Actor represents a user or service token
type AddOrganizationTeamMemberRequest ¶ added in v0.327.0
type AggressiveCutover ¶ added in v0.322.0
type AggressiveCutover struct {
Enabled bool `json:"enabled"`
}
AggressiveCutover is the database-level Vitess setting that makes future deploy requests cut over more aggressively when waiting on table locks. Distinct from per-deploy-request force cutover.
type AggressiveCutoverRequest ¶ added in v0.322.0
AggressiveCutoverRequest identifies a database for aggressive cutover ops.
type Anomaly ¶ added in v0.307.0
type Anomaly struct {
ID string `json:"id"`
PeriodStart time.Time `json:"period_start"`
PeriodEnd time.Time `json:"period_end"`
MinutesInViolation int64 `json:"minutes_in_violation"`
Active bool `json:"active"`
Duration float64 `json:"duration"`
MetricsStart time.Time `json:"metrics_start"`
MetricsEnd time.Time `json:"metrics_end"`
Correlations []Correlation `json:"correlations"`
}
Anomaly is a detected resource-usage anomaly on a branch's primary. Correlations are only returned when retrieving a single anomaly.
type AuditLog ¶
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 ¶
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 ¶
type AuditLogsService interface {
List(context.Context, *ListAuditLogsRequest, ...ListOption) (*CursorPaginatedResponse[*AuditLog], error)
}
AuditLogsService is an interface for communicating with the PlanetScale AuditLogs API endpoints.
type AuthAttemptExport ¶ added in v0.313.0
type AuthAttemptExport struct {
PublicID string `json:"id"`
State string `json:"state"`
Expired bool `json:"expired"`
StartAt time.Time `json:"start_at"`
EndAt time.Time `json:"end_at"`
Filters AuthAttemptExportFilters `json:"filters"`
Format string `json:"format"`
ResolvedBranchPublicIDs []string `json:"resolved_branch_public_ids"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at"`
GeneratedAt *time.Time `json:"generated_at"`
FinishedAt *time.Time `json:"finished_at"`
ExpiresAt *time.Time `json:"expires_at"`
FailureReason string `json:"failure_reason"`
FailureDetail string `json:"failure_detail"`
RecoveryHint string `json:"recovery_hint"`
RetryAfter time.Duration `json:"-"`
}
type AuthAttemptExportFilters ¶ added in v0.313.0
type AuthAttemptExportFilters struct {
SourceIPs []string `json:"source_ips,omitempty"`
Branches []string `json:"branches,omitempty"`
Outcomes []string `json:"outcomes,omitempty"`
Usernames []string `json:"usernames,omitempty"`
StartupDatabases []string `json:"startup_databases,omitempty"`
FailureReasons []string `json:"failure_reasons,omitempty"`
BackendRoutes []string `json:"backend_routes,omitempty"`
}
type AuthAttemptExportsService ¶ added in v0.313.0
type AuthAttemptExportsService interface {
CreateExport(context.Context, *CreateAuthAttemptExportRequest) (*AuthAttemptExport, error)
GetExport(context.Context, *GetAuthAttemptExportRequest) (*AuthAttemptExport, error)
DownloadExport(context.Context, *DownloadAuthAttemptExportRequest) (io.ReadCloser, error)
}
type AutoDeleteBranchRequest ¶ added in v0.323.0
type Backup ¶
type Backup struct {
PublicID string `json:"id"`
Name string `json:"name"`
State string `json:"state"`
Size int64 `json:"size"`
Protected bool `json:"protected"`
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 BackupPoliciesService ¶ added in v0.313.0
type BackupPoliciesService interface {
List(context.Context, *ListBackupPoliciesRequest, ...ListOption) ([]*BackupPolicy, error)
Get(context.Context, *GetBackupPolicyRequest) (*BackupPolicy, error)
Create(context.Context, *CreateBackupPolicyRequest) (*BackupPolicy, error)
Update(context.Context, *UpdateBackupPolicyRequest) (*BackupPolicy, error)
Delete(context.Context, *DeleteBackupPolicyRequest) error
}
BackupPoliciesService is an interface for the PlanetScale backup policies API.
type BackupPolicy ¶ added in v0.313.0
type BackupPolicy struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Name string `json:"name"`
Target string `json:"target"`
RetentionValue int `json:"retention_value"`
RetentionUnit string `json:"retention_unit"`
FrequencyValue int `json:"frequency_value"`
FrequencyUnit string `json:"frequency_unit"`
ScheduleTime string `json:"schedule_time"`
ScheduleDay *int `json:"schedule_day"`
ScheduleWeek *int `json:"schedule_week"`
Required bool `json:"required"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastRanAt *time.Time `json:"last_ran_at"`
NextRunAt *time.Time `json:"next_run_at"`
}
BackupPolicy represents a scheduled backup policy for a database.
type BackupsService ¶
type BackupsService interface {
Create(context.Context, *CreateBackupRequest) (*Backup, error)
List(context.Context, *ListBackupsRequest) ([]*Backup, error)
Get(context.Context, *GetBackupRequest) (*Backup, error)
Update(context.Context, *UpdateBackupRequest) (*Backup, error)
Delete(context.Context, *DeleteBackupRequest) error
}
type BillingPaymentMethod ¶ added in v0.326.0
type BillingPaymentMethod struct {
ID string `json:"id"`
Brand string `json:"brand"`
Last4 string `json:"last4"`
ExpMonth int `json:"exp_month"`
ExpYear int `json:"exp_year"`
Name string `json:"name,omitempty"`
}
BillingPaymentMethod is the organization's current card.
type BillingPaymentMethodSetup ¶ added in v0.326.0
type BillingPaymentMethodSetup struct {
ID string `json:"id"`
State string `json:"state"`
CheckoutURL string `json:"checkout_url,omitempty"`
Error string `json:"error,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
FailedAt *time.Time `json:"failed_at,omitempty"`
}
type BillingPaymentMethodSetupsService ¶ added in v0.326.0
type BillingPaymentMethodSetupsService interface {
Create(context.Context, *CreateBillingPaymentMethodSetupRequest) (*BillingPaymentMethodSetup, error)
Get(context.Context, *GetBillingPaymentMethodSetupRequest) (*BillingPaymentMethodSetup, error)
}
type BillingPaymentMethodsService ¶ added in v0.326.0
type BillingPaymentMethodsService interface {
Get(context.Context, *GetBillingPaymentMethodRequest) (*BillingPaymentMethod, error)
Delete(context.Context, *DeleteBillingPaymentMethodRequest) error
}
type BillingPlan ¶
type BillingPlan int
const ( HobbyPlan BillingPlan = iota ScalerProPlan )
func (BillingPlan) String ¶
func (bp BillingPlan) String() string
type BranchInfraPod ¶
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 ¶
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 ¶
func (b *BranchInfrastructure) UnmarshalJSON(data []byte) error
type BranchInfrastructureService ¶
type BranchInfrastructureService interface {
Get(ctx context.Context, req *GetBranchInfrastructureRequest) (*BranchInfrastructure, error)
}
BranchInfrastructureService is an interface for interacting with the branch infrastructure API.
type BranchMaintenanceService ¶ added in v0.323.0
type BranchMaintenanceService interface {
Run(context.Context, *RunBranchMaintenanceRequest) error
}
BranchMaintenanceService is an interface for communicating with the PlanetScale branch maintenance API endpoint.
type BranchResizeRequest ¶ added in v0.310.0
type BranchResizeRequest struct {
ID string `json:"id"`
Type string `json:"type"`
State string `json:"state"`
Actor *Actor `json:"actor"`
VTGateSize string `json:"vtgate_size"`
PreviousVTGateSize string `json:"previous_vtgate_size"`
VTGateName string `json:"vtgate_name"`
VTGateDisplayName string `json:"vtgate_display_name"`
PreviousVTGateName string `json:"previous_vtgate_name"`
PreviousVTGateDisplayName string `json:"previous_vtgate_display_name"`
VTGateCount int `json:"vtgate_count"`
PreviousVTGateCount int `json:"previous_vtgate_count"`
VTGateMaxCount *int `json:"vtgate_max_count"`
PreviousVTGateMaxCount *int `json:"previous_vtgate_max_count"`
VTGateAutoscaling bool `json:"vtgate_autoscaling"`
PreviousVTGateAutoscaling bool `json:"previous_vtgate_autoscaling"`
VTGateTargetCPUUtilization *int `json:"vtgate_target_cpu_utilization"`
PreviousVTGateTargetCPUUtilization *int `json:"previous_vtgate_target_cpu_utilization"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
StartedAt *time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at"`
}
BranchResizeRequest represents a Vitess branch VTGate resize request.
type BranchResizeStatusRequest ¶ added in v0.310.0
BranchResizeStatusRequest encapsulates a request for the latest branch VTGate resize status.
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 CancelBranchResizeRequest ¶ added in v0.310.0
CancelBranchResizeRequest encapsulates a request to cancel a queued branch VTGate resize.
type CancelDataImportRequest ¶
type CancelPostgresBouncerResizesRequest ¶ added in v0.314.0
type CancelPostgresBouncerResizesRequest struct {
Organization string
Database string
Branch string
Bouncer string
}
CancelPostgresBouncerResizesRequest cancels unfinished resize requests.
type CancelPostgresBranchChangesRequest ¶ added in v0.304.0
type CancelPostgresBranchChangesRequest struct {
Organization string
Database string
Branch string
}
CancelPostgresBranchChangesRequest encapsulates the request to cancel the queued change requests for a Postgres branch.
type CancelWorkflowRequest ¶
type CheckDeployRequestStorageRequest ¶ added in v0.317.0
type CheckDeployRequestStorageRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Number uint64 `json:"-"`
}
CheckDeployRequestStorageRequest checks storage readiness for a deploy request.
type Client ¶
type Client struct {
// UserAgent is the version of the planetscale-go library that is being used
UserAgent string
AuditLogs AuditLogsService
AuthAttemptExports AuthAttemptExportsService
BackupPolicies BackupPoliciesService
Backups BackupsService
BranchInfrastructure BranchInfrastructureService
BranchMaintenance BranchMaintenanceService
D1ImportNotifications D1ImportNotificationsService
DatabaseBranches DatabaseBranchesService
Databases DatabasesService
DataImports DataImportsService
DeployRequests DeployRequestsService
Invoices InvoicesService
Keyspaces KeyspacesService
LookupVindex LookupVindexService
MaintenanceSchedules MaintenanceSchedulesService
Materialize MaterializeService
Metrics MetricsService
MoveTables MoveTablesService
Organizations OrganizationsService
OrganizationSSO OrganizationSSOService
Passwords PasswordsService
PaymentMethods BillingPaymentMethodsService
PaymentMethodSetups BillingPaymentMethodSetupsService
PlannedReparentShard PlannedReparentShardService
PostgresBranches PostgresBranchesService
PostgresBouncers PostgresBouncersService
PostgresCIDRs PostgresCIDRsService
PostgresReadOnlyReplicas PostgresReadOnlyReplicasService
PostgresRoles PostgresRolesService
PostgresSwitchovers PostgresSwitchoversService
Processlist ProcesslistService
QueryInsights QueryInsightsService
QueryPatterns QueryPatternsService
ReadOnlyRegions ReadOnlyRegionsService
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 ¶
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 ¶
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 ¶
func WithUserAgent(userAgent string) ClientOption
WithUserAgent overrides the User-Agent header.
type CloseRequest ¶
type CloseRequest struct {
State string `json:"state"`
}
type ClosedByDeployRequest ¶
type ClusterSKU ¶
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 ¶
type Correlation ¶ added in v0.322.0
type Correlation struct {
ID string `json:"id"`
R float64 `json:"r"`
Keyspace string `json:"keyspace"`
Fingerprint string `json:"fingerprint"`
NormalizedSQL string `json:"normalized_sql"`
TabletType string `json:"tablet_type"`
}
Correlation is a query correlated with an anomaly.
type CreateAuthAttemptExportRequest ¶ added in v0.313.0
type CreateBackupPolicyRequest ¶ added in v0.313.0
type CreateBackupPolicyRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Name string `json:"name,omitempty"`
Target string `json:"target"`
RetentionValue int `json:"retention_value"`
RetentionUnit string `json:"retention_unit"`
FrequencyValue int `json:"frequency_value"`
FrequencyUnit string `json:"frequency_unit"`
ScheduleTime string `json:"schedule_time"`
ScheduleDay *int `json:"schedule_day,omitempty"`
ScheduleWeek *int `json:"schedule_week,omitempty"`
}
CreateBackupPolicyRequest encapsulates creating a backup policy.
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 CreateBillingPaymentMethodSetupRequest ¶ added in v0.326.0
type CreateBillingPaymentMethodSetupRequest struct {
Organization string `json:"-"`
}
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"`
CloudflareAccountID string `json:"cloudflare_account_id,omitempty"`
CloudflareTimestamp string `json:"cloudflare_timestamp,omitempty"`
CloudflareSignature string `json:"cloudflare_signature,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 ¶
type CreateOrganizationTeamRequest ¶ added in v0.327.0
type CreatePostgresBouncerRequest ¶ added in v0.314.0
type CreatePostgresBouncerRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
Name string `json:"name,omitempty"`
Target string `json:"target"`
BouncerSize string `json:"bouncer_size,omitempty"`
ReplicasPerCell *int `json:"replicas_per_cell,omitempty"`
}
CreatePostgresBouncerRequest encapsulates creating a dedicated PgBouncer.
type CreatePostgresBranchRequest ¶
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"`
RestorePoint string `json:"restore_point,omitempty"`
ClusterName string `json:"cluster_name,omitempty"`
MajorVersion string `json:"major_version,omitempty"`
Replicas *int `json:"replicas,omitempty"`
Storage *StorageConfig `json:"storage,omitempty"`
}
CreatePostgresBranchRequest encapsulates the request to create a Postgres branch.
type CreatePostgresCIDRRequest ¶ added in v0.313.0
type CreatePostgresCIDRRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Schema string `json:"schema,omitempty"`
Role string `json:"role,omitempty"`
CIDRs []string `json:"cidrs"`
Description string `json:"description,omitempty"`
}
CreatePostgresCIDRRequest encapsulates creating an IP restriction entry.
type CreatePostgresReadOnlyReplicaRequest ¶ added in v0.329.0
type CreatePostgresReadOnlyReplicaRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
Name string `json:"name"`
Region string `json:"region"`
Replicas *int `json:"replicas,omitempty"`
ClusterSize string `json:"cluster_size,omitempty"`
}
CreatePostgresReadOnlyReplicaRequest encapsulates creating a read-only replica.
type CreatePostgresRoleRequest ¶
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 CreatePostgresSwitchoverRequest ¶ added in v0.322.0
type CreatePostgresSwitchoverRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
Candidate string `json:"candidate,omitempty"`
}
CreatePostgresSwitchoverRequest encapsulates creating a switchover for a Postgres branch.
type CreateTrafficBudgetRequest ¶
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 ¶
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 ¶
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 ¶
type CreateWebhookRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
URL string `json:"url"`
AuthorizationHeader string `json:"authorization_header,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Events []string `json:"events,omitempty"`
}
CreateWebhookRequest is the request for creating a webhook.
type CreateWorkflowRequest ¶
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 ¶
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 ¶
type D1ImportNotificationsService ¶
type D1ImportNotificationsService interface {
Create(ctx context.Context, req *CreateD1ImportNotificationRequest) error
}
type DataImport ¶
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 ¶
func (di *DataImport) ParseState()
type DataImportSource ¶
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 ¶
type DataImportState int
const ( DataImportPreparingDataCopy DataImportState = iota DataImportPreparingDataCopyFailed DataImportCopyingData DataImportCopyingDataFailed DataImportSwitchTrafficPending DataImportSwitchTrafficRunning DataImportSwitchTrafficCompleted DataImportSwitchTrafficError DataImportReverseTrafficRunning DataImportReverseTrafficCompleted DataImportReverseTrafficError DataImportDetachExternalDatabaseRunning DataImportDetachExternalDatabaseError DataImportReady )
func (DataImportState) String ¶
func (d DataImportState) String() string
type DataImportsService ¶
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 ¶
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"`
DefaultBranch string `json:"default_branch"`
RequireApprovalForDeploy bool `json:"require_approval_for_deploy"`
RestrictBranchRegion bool `json:"restrict_branch_region"`
AllowDataBranching bool `json:"allow_data_branching"`
ForeignKeysEnabled bool `json:"foreign_keys_enabled"`
AutomaticMigrations *bool `json:"automatic_migrations"`
InsightsRawQueries bool `json:"insights_raw_queries"`
InsightsEnabled bool `json:"insights_enabled"`
ProductionBranchWebConsole bool `json:"production_branch_web_console"`
MigrationTableName *string `json:"migration_table_name"`
MigrationFramework *string `json:"migration_framework"`
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"`
VTGateSize string `json:"vtgate_size"`
VTGateCount int `json:"vtgate_count"`
}
DatabaseBranch represents a database branch.
type DatabaseBranchPassword ¶
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"`
Region Region `json:"region"`
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"`
CIDRs []string `json:"cidrs"`
// ReadOnlyRegion is set client-side when the password is known to be scoped to a
// Vitess read-only region (the API does not currently return a dedicated flag).
ReadOnlyRegion bool `json:"-"`
}
type DatabaseBranchPasswordRequest ¶
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"`
ReadOnlyRegionID string `json:"read_only_region_id,omitempty"`
}
DatabaseBranchPasswordRequest encapsulates the request for creating/getting/deleting a database branch password.
type DatabaseBranchesService ¶
type DatabaseBranchesService interface {
Create(context.Context, *CreateDatabaseBranchRequest) (*DatabaseBranch, error)
List(context.Context, *ListDatabaseBranchesRequest, ...ListOption) ([]*DatabaseBranch, error)
Get(context.Context, *GetDatabaseBranchRequest) (*DatabaseBranch, error)
Update(context.Context, *UpdateDatabaseBranchRequest) (*DatabaseBranch, error)
Delete(context.Context, *DeleteDatabaseBranchRequest) error
Diff(context.Context, *DiffBranchRequest) ([]*Diff, error)
Schema(context.Context, *BranchSchemaRequest) ([]*Diff, error)
RoutingRules(context.Context, *BranchRoutingRulesRequest) (*RoutingRules, error)
UpdateRoutingRules(context.Context, *UpdateBranchRoutingRulesRequest) (*RoutingRules, error)
RefreshSchema(context.Context, *RefreshSchemaRequest) error
Demote(context.Context, *DemoteRequest) (*DatabaseBranch, error)
Promote(context.Context, *PromoteRequest) (*DatabaseBranch, error)
EnableSafeMigrations(context.Context, *EnableSafeMigrationsRequest) (*DatabaseBranch, error)
DisableSafeMigrations(context.Context, *DisableSafeMigrationsRequest) (*DatabaseBranch, error)
LintSchema(context.Context, *LintSchemaRequest) ([]*SchemaLintError, error)
ListClusterSKUs(context.Context, *ListBranchClusterSKUsRequest, ...ListOption) ([]*ClusterSKU, error)
Resize(context.Context, *ResizeBranchRequest) (*BranchResizeRequest, error)
ListResizes(context.Context, *ListBranchResizesRequest) ([]*BranchResizeRequest, error)
CancelResize(context.Context, *CancelBranchResizeRequest) error
ResizeStatus(context.Context, *BranchResizeStatusRequest) (*BranchResizeRequest, error)
}
DatabaseBranchesService is an interface for communicating with the PlanetScale Database Branch API endpoint.
type DatabaseDeletionRequest ¶
DatabaseDeletionRequest encapsulates the request for deleting a database from an organization.
type DatabaseEngine ¶
type DatabaseEngine string
const ( DatabaseEngineMySQL DatabaseEngine = "mysql" DatabaseEnginePostgres DatabaseEngine = "postgresql" )
type DatabaseState ¶
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 DatabaseThrottler ¶ added in v0.320.0
type DatabaseThrottler struct {
Keyspaces []string `json:"keyspaces"`
Configurable *ThrottlerConfigurable `json:"configurable"`
Configurations []*ThrottlerConfiguration `json:"configurations"`
}
DatabaseThrottler is the database-level throttler configuration for Vitess deploy request migrations. Distinct from per-deploy-request throttler and from tablet/vtctld throttler.
type DatabasesService ¶
type DatabasesService interface {
Create(context.Context, *CreateDatabaseRequest) (*Database, error)
Get(context.Context, *GetDatabaseRequest) (*Database, error)
List(context.Context, *ListDatabasesRequest, ...ListOption) ([]*Database, error)
ListRegions(context.Context, *ListDatabaseRegionsRequest, ...ListOption) ([]*Region, error)
Delete(context.Context, *DeleteDatabaseRequest) (*DatabaseDeletionRequest, error)
UpdateSettings(context.Context, *UpdateDatabaseSettingsRequest) (*Database, error)
GetThrottler(context.Context, *GetDatabaseThrottlerRequest) (*DatabaseThrottler, error)
UpdateThrottler(context.Context, *UpdateDatabaseThrottlerRequest) (*DatabaseThrottler, error)
GetAggressiveCutover(context.Context, *AggressiveCutoverRequest) (*AggressiveCutover, error)
EnableAggressiveCutover(context.Context, *AggressiveCutoverRequest) (*AggressiveCutover, error)
DisableAggressiveCutover(context.Context, *AggressiveCutoverRequest) (*AggressiveCutover, error)
}
DatabaseService is an interface for communicating with the PlanetScale Databases API endpoint.
type DeleteBackupPolicyRequest ¶ added in v0.313.0
DeleteBackupPolicyRequest encapsulates deleting a backup policy.
type DeleteBackupRequest ¶
type DeleteBillingPaymentMethodRequest ¶ added in v0.326.0
type DeleteBillingPaymentMethodRequest struct {
Organization string
}
type DeleteDatabaseBranchPasswordRequest ¶
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 ¶
DeleteDatabaseRequest encapsulates the request for deleting a database from an organization.
type DeleteKeyspaceRequest ¶ added in v0.316.0
type DeleteOrganizationTeamRequest ¶ added in v0.327.0
type DeletePostgresBouncerRequest ¶ added in v0.314.0
type DeletePostgresBouncerRequest struct {
Organization string
Database string
Branch string
Bouncer string
}
DeletePostgresBouncerRequest encapsulates deleting a PgBouncer by name.
type DeletePostgresBranchRequest ¶
type DeletePostgresBranchRequest struct {
Organization string
Database string
Branch string
DeleteDescendants bool
}
DeletePostgresBranchRequest encapsulates the request to delete a Postgres branch.
type DeletePostgresCIDRRequest ¶ added in v0.313.0
DeletePostgresCIDRRequest encapsulates deleting an IP restriction entry.
type DeletePostgresReadOnlyReplicaRequest ¶ added in v0.329.0
type DeletePostgresReadOnlyReplicaRequest struct {
Organization string
Database string
Branch string
Replica string
}
DeletePostgresReadOnlyReplicaRequest encapsulates deleting a read-only replica.
type DeletePostgresRoleRequest ¶
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 DeleteQueryPatternsReportRequest ¶ added in v0.323.0
type DeleteTrafficBudgetRequest ¶
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 ¶
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 ¶
type DeleteWebhookRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
ID string `json:"-"`
}
DeleteWebhookRequest is the request for deleting a webhook.
type DemoteRequest ¶
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 DeployRequestStorageCheck ¶ added in v0.317.0
type DeployRequestStorageCheck struct {
EnoughStorage bool `json:"enough_storage"`
Upgradeable bool `json:"upgradeable"`
StorageBytesNeeded int64 `json:"storage_bytes_needed"`
StorageReport map[string]any `json:"storage_report"`
}
DeployRequestStorageCheck is the storage check response for a deploy request.
type DeployRequestThrottler ¶ added in v0.317.0
type DeployRequestThrottler struct {
Keyspaces []string `json:"keyspaces"`
Configurable *ThrottlerConfigurable `json:"configurable"`
Configurations []*ThrottlerConfiguration `json:"configurations"`
}
DeployRequestThrottler is the throttler configuration for a deploy request.
type DeployRequestsService ¶
type DeployRequestsService interface {
ApplyDeploy(context.Context, *ApplyDeployRequestRequest) (*DeployRequest, error)
AutoApplyDeploy(context.Context, *AutoApplyDeployRequestRequest) (*DeployRequest, error)
AutoDeleteBranch(context.Context, *AutoDeleteBranchRequest) (*DeployRequest, error)
CancelDeploy(context.Context, *CancelDeployRequestRequest) (*DeployRequest, error)
CloseDeploy(context.Context, *CloseDeployRequestRequest) (*DeployRequest, error)
Create(context.Context, *CreateDeployRequestRequest) (*DeployRequest, error)
CreateReview(context.Context, *ReviewDeployRequestRequest) (*DeployRequestReview, error)
Deploy(context.Context, *PerformDeployRequest) (*DeployRequest, error)
Diff(ctx context.Context, diffReq *DiffRequest) ([]*Diff, error)
ForceCutover(context.Context, *ForceCutoverDeployRequestRequest) (*DeployRequest, error)
Get(context.Context, *GetDeployRequestRequest) (*DeployRequest, error)
List(context.Context, *ListDeployRequestsRequest) ([]*DeployRequest, error)
GetDeployOperations(context.Context, *GetDeployOperationsRequest) ([]*DeployOperation, error)
GetDeployQueue(context.Context, *GetDeployQueueRequest) ([]*Deployment, error)
GetDeployment(context.Context, *GetDeploymentRequest) (*Deployment, error)
ListReviews(context.Context, *ListDeployRequestReviewsRequest) ([]*DeployRequestReview, error)
CheckStorage(context.Context, *CheckDeployRequestStorageRequest) (*DeployRequestStorageCheck, error)
GetThrottler(context.Context, *GetDeployRequestThrottlerRequest) (*DeployRequestThrottler, error)
UpdateThrottler(context.Context, *UpdateDeployRequestThrottlerRequest) (*DeployRequestThrottler, error)
SkipRevertDeploy(context.Context, *SkipRevertDeployRequestRequest) (*DeployRequest, error)
RevertDeploy(context.Context, *RevertDeployRequestRequest) (*DeployRequest, error)
UnblockDeploy(context.Context, *UnblockDeployRequestRequest) (*DeployRequest, error)
}
DeployRequestsService is an interface for communicating with the PlanetScale deploy requests API.
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"`
AutoCutover bool `json:"auto_cutover"`
AutoDeleteBranch bool `json:"auto_delete_branch"`
CutoverExpiring bool `json:"cutover_expiring"`
TableLocked bool `json:"table_locked"`
QueuePaused bool `json:"queue_paused"`
ParallelLaneBlocked bool `json:"parallel_lane_blocked"`
DeployCheckErrors string `json:"deploy_check_errors"`
LockedTableName string `json:"locked_table_name"`
QueuePauseReason string `json:"queue_pause_reason"`
Strategy string `json:"strategy"`
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"`
SubmittedAt *time.Time `json:"submitted_at"`
CutoverAt *time.Time `json:"cutover_at"`
ReadyToCutoverAt *time.Time `json:"ready_to_cutover_at"`
ForceCutoverRequestedAt *time.Time `json:"force_cutover_requested_at"`
SchemaLastUpdatedAt *time.Time `json:"schema_last_updated_at"`
}
Deployment encapsulates a deployment for a deploy request.
type DeploymentLintError ¶
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 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 DisableSafeMigrationsRequest ¶
type DisableSafeMigrationsRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
}
DisableSafeMigrationsRequest encapsulates the request for disabling safe migrations on a branch.
type DiskAutoscaling ¶ added in v0.331.0
type DiskAutoscaling struct {
// Strategy is the disk autoscaling strategy: "grow" or "disable".
Strategy string `json:"strategy"`
// StorageLimitBytes is the maximum size in bytes disks may autoscale to.
StorageLimitBytes int64 `json:"storage_limit_bytes"`
}
DiskAutoscaling configures how a keyspace's dedicated disks autoscale.
type DiskAutoscalingUpdate ¶ added in v0.331.0
type DiskAutoscalingUpdate struct {
Strategy *string `json:"strategy,omitempty"`
StorageLimitBytes *int64 `json:"storage_limit_bytes,omitempty"`
}
DiskAutoscalingUpdate is the request body for changing a keyspace's disk autoscaling settings. Only the fields that are set are sent to the API.
type DismissSchemaRecommendationRequest ¶
type DismissSchemaRecommendationRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
ID string `json:"-"`
Reason string `json:"reason,omitempty"`
}
DismissSchemaRecommendationRequest is the request for dismissing a schema recommendation. ID is the recommendation sequence number from list/show (path param `number`).
type DownloadAuthAttemptExportRequest ¶ added in v0.313.0
type EnableSafeMigrationsRequest ¶
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
// APICode is the raw code from the API error JSON body (e.g.
// "schema_mutation_blocked"). Empty when the response had no code field.
APICode string
// 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.
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 ¶
type ExternalDataSourceSSLVerificationMode int
const ( SSLModeDisabled ExternalDataSourceSSLVerificationMode = iota SSLModePreferred SSLModeRequired SSLModeVerifyCA SSLModeVerifyIdentity )
func (ExternalDataSourceSSLVerificationMode) String ¶
func (sm ExternalDataSourceSSLVerificationMode) String() string
type ForceCutoverDeployRequestRequest ¶ added in v0.316.0
type GetAnomalyRequest ¶ added in v0.322.0
type GetAnomalyRequest struct {
Organization string
Database string
Branch string
AnomalyID string
}
GetAnomalyRequest is the request for retrieving a single anomaly.
type GetAuthAttemptExportRequest ¶ added in v0.313.0
type GetBackupPolicyRequest ¶ added in v0.313.0
GetBackupPolicyRequest encapsulates getting a single backup policy.
type GetBackupRequest ¶
type GetBillingPaymentMethodRequest ¶ added in v0.326.0
type GetBillingPaymentMethodRequest struct {
Organization string
}
type GetBillingPaymentMethodSetupRequest ¶ added in v0.326.0
type GetBranchInfrastructureRequest ¶
GetBranchInfrastructureRequest encapsulates the request for getting branch infrastructure.
type GetBranchMetricsRequest ¶ added in v0.327.0
type GetDatabaseBranchPasswordRequest ¶
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 ¶
GetDatabaseBranchRequest encapsulates the request for getting a single database branch for a database.
type GetDatabaseRequest ¶
DatabaseRequest encapsulates the request for getting a single database.
type GetDatabaseThrottlerRequest ¶ added in v0.320.0
type GetDatabaseThrottlerRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
}
GetDatabaseThrottlerRequest gets the database-level Vitess migration throttler.
type GetDefaultPostgresRoleRequest ¶ added in v0.323.0
GetDefaultPostgresRoleRequest encapsulates fetching the default postgres role.
type GetDeployOperationsRequest ¶
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 GetDeployQueueRequest ¶ added in v0.317.0
GetDeployQueueRequest gets the deploy queue for a database.
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 GetDeployRequestThrottlerRequest ¶ added in v0.317.0
type GetDeployRequestThrottlerRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Number uint64 `json:"-"`
}
GetDeployRequestThrottlerRequest gets throttler config for a deploy request.
type GetDeploymentRequest ¶ added in v0.317.0
type GetDeploymentRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Number uint64 `json:"-"`
}
GetDeploymentRequest gets the deployment for a deploy request.
type GetImportStatusRequest ¶
type GetInstantMetricsRequest ¶ added in v0.321.0
type GetInstantMetricsRequest struct {
Organization string
Database string
Branch string
Metrics []string
Role string
Shard string
Container string
Pod string
}
GetInstantMetricsRequest describes a branch instant metrics query.
type GetInstantTabletMetricsRequest ¶ added in v0.327.0
type GetInvoiceRequest ¶ added in v0.327.0
type GetKeyspaceRequest ¶
type GetMaintenanceScheduleRequest ¶ added in v0.318.0
GetMaintenanceScheduleRequest encapsulates getting a single maintenance schedule.
type GetMetricSeriesRequest ¶ added in v0.321.0
type GetMetricSeriesRequest struct {
Organization string
Database string
Branch string
Metrics []string
Period string
From string
To string
Steps int
TabletType string
Keyspace string
Shard string
Role string
Container string
Pod string
Pods []string
QueryIDs []string
Fingerprint string
BudgetID string
RuleID string
Search string
}
GetMetricSeriesRequest describes a branch time-series metrics query.
type GetOrganizationMemberRequest ¶ added in v0.323.0
type GetOrganizationRequest ¶
type GetOrganizationRequest struct {
Organization string
}
GetOrganizationRequest encapsulates the request for getting a single organization.
type GetOrganizationTeamRequest ¶ added in v0.327.0
type GetPlannedReparentShardRequest ¶
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 GetPostgresBouncerRequest ¶ added in v0.314.0
type GetPostgresBouncerRequest struct {
Organization string
Database string
Branch string
Bouncer string
}
GetPostgresBouncerRequest encapsulates getting a PgBouncer by name.
type GetPostgresBranchChangeRequest ¶ added in v0.304.0
type GetPostgresBranchChangeRequest struct {
Organization string
Database string
Branch string
ID string
}
GetPostgresBranchChangeRequest encapsulates the request to get a single change request for a Postgres branch.
type GetPostgresBranchRequest ¶
GetPostgresBranchRequest encapsulates the request to get a specific Postgres branch.
type GetPostgresCIDRRequest ¶ added in v0.313.0
GetPostgresCIDRRequest encapsulates getting a single IP restriction entry.
type GetPostgresReadOnlyReplicaRequest ¶ added in v0.329.0
type GetPostgresReadOnlyReplicaRequest struct {
Organization string
Database string
Branch string
Replica string
}
GetPostgresReadOnlyReplicaRequest encapsulates getting a read-only replica by name.
type GetPostgresRoleRequest ¶
type GetPostgresRoleRequest struct {
Organization string
Database string
Branch string
RoleId string
Replica bool
ReadOnlyReplica string
Bouncer string
}
GetPostgresRoleRequest encapsulates the request for getting a specific role for a given database branch.
type GetPostgresSwitchoverRequest ¶ added in v0.327.0
type GetQueryMetricSeriesRequest ¶ added in v0.327.0
type GetQueryRequest ¶ added in v0.327.0
type GetQuerySummaryRequest ¶ added in v0.327.0
type GetQueryTagRequest ¶ added in v0.315.0
GetQueryTagRequest retrieves one tag key and its values. Tag is the dimension id (e.g. "Sapp"), not the display name.
type GetSchemaRecommendationRequest ¶
type GetSchemaRecommendationRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
ID string `json:"-"`
}
GetSchemaRecommendationRequest is the request for getting a schema recommendation.
type GetServiceTokenRequest ¶ added in v0.327.0
type GetTabletMetricSeriesRequest ¶ added in v0.327.0
type GetTagMetricSeriesRequest ¶ added in v0.327.0
type GetTrafficBudgetRequest ¶
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 ¶
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 ¶
type GetWebhookRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
ID string `json:"-"`
}
GetWebhookRequest is the request for getting a webhook.
type GetWorkflowRequest ¶
type IndexUsage ¶ added in v0.307.0
type IndexUsage struct {
Name string `json:"name"`
Count int64 `json:"count"`
Percent float64 `json:"percent"`
}
IndexUsage records how often an index served a query pattern.
type InstantMetric ¶ added in v0.321.0
type InstantMetric struct {
Metric string `json:"metric"`
Label string `json:"label"`
Values []map[string]any `json:"values"`
}
InstantMetric contains the current values for one metric.
type InstantMetrics ¶ added in v0.321.0
type InstantMetrics struct {
Type string `json:"type"`
Branch map[string]any `json:"branch"`
Metrics []*InstantMetric `json:"metrics"`
}
InstantMetrics contains current metric values grouped by their dimensions.
type InvoiceAmount ¶ added in v0.327.0
type InvoiceAmount string
func (*InvoiceAmount) UnmarshalJSON ¶ added in v0.327.0
func (a *InvoiceAmount) UnmarshalJSON(b []byte) error
type InvoiceBudgetAmount ¶ added in v0.327.0
type InvoiceBudgetAmount string
InvoiceBudgetAmount is the organization's expected monthly budget. Responses encode this as a JSON string; PATCH accepts an integer.
func (*InvoiceBudgetAmount) UnmarshalJSON ¶ added in v0.327.0
func (a *InvoiceBudgetAmount) UnmarshalJSON(b []byte) error
type InvoiceLineItem ¶ added in v0.327.0
type InvoiceLineItem struct {
ID string `json:"id"`
Subtotal InvoiceAmount `json:"subtotal"`
Description string `json:"description"`
MetricName string `json:"metric_name"`
CloudflareBilled bool `json:"cloudflare_billed"`
DatabaseID string `json:"database_id"`
DatabaseName string `json:"database_name"`
Resource InvoiceLineItemResource `json:"resource"`
}
type InvoiceLineItemPage ¶ added in v0.327.0
type InvoiceLineItemPage struct {
Data []*InvoiceLineItem
NextPage *int
}
type InvoiceLineItemResource ¶ added in v0.327.0
type InvoicePage ¶ added in v0.327.0
type InvoicesService ¶ added in v0.327.0
type InvoicesService interface {
List(context.Context, *ListInvoicesRequest, ...ListOption) (*InvoicePage, error)
Get(context.Context, *GetInvoiceRequest) (*Invoice, error)
ListLineItems(context.Context, *ListInvoiceLineItemsRequest, ...ListOption) (*InvoiceLineItemPage, error)
}
type Keyspace ¶
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"`
ReadOnlyRegions []*ReadOnlyRegionKeyspace `json:"read_only_regions"`
DiskAutoscaling *DiskAutoscaling `json:"disk_autoscaling"`
}
type KeyspaceResizeRequest ¶
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 KeyspaceRollout ¶
type KeyspaceRollout struct {
Name string `json:"name"`
State string `json:"state"`
Shards []ShardRollout `json:"shards"`
}
type KeyspacesService ¶
type KeyspacesService interface {
Create(context.Context, *CreateKeyspaceRequest) (*Keyspace, error)
List(context.Context, *ListKeyspacesRequest) ([]*Keyspace, error)
Get(context.Context, *GetKeyspaceRequest) (*Keyspace, error)
Delete(context.Context, *DeleteKeyspaceRequest) error
UpdateReadOnlyRegions(context.Context, *UpdateReadOnlyRegionsRequest) ([]*ReadOnlyRegionKeyspace, error)
VSchema(context.Context, *GetKeyspaceVSchemaRequest) (*VSchema, error)
UpdateVSchema(context.Context, *UpdateKeyspaceVSchemaRequest) (*VSchema, error)
Resize(context.Context, *ResizeKeyspaceRequest) (*KeyspaceResizeRequest, error)
CancelResize(context.Context, *CancelKeyspaceResizeRequest) error
ResizeStatus(context.Context, *KeyspaceResizeStatusRequest) (*KeyspaceResizeRequest, error)
RolloutStatus(context.Context, *KeyspaceRolloutStatusRequest) (*KeyspaceRollout, error)
UpdateSettings(context.Context, *UpdateKeyspaceSettingsRequest) (*Keyspace, error)
}
KeyspacesService is an interface for interacting with the keyspace endpoints of the PlanetScale API
type KillProcessRequest ¶
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 ¶
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 ¶
type LintSchemaRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
}
LintSchemaRequest encapsulates the request for linting a branch's schema.
type ListAnomaliesRequest ¶ added in v0.307.0
ListAnomaliesRequest is the request for listing anomalies for a branch.
type ListAuditLogsRequest ¶
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 ListBackupPoliciesRequest ¶ added in v0.313.0
ListBackupPoliciesRequest encapsulates listing backup policies for a database.
type ListBackupsRequest ¶
type ListBranchClusterSKUsRequest ¶
ListBranchClusterSKUsRequest encapsulates the request for getting a list of Cluster SKUs for a branch.
type ListBranchResizesRequest ¶ added in v0.310.0
ListBranchResizesRequest encapsulates a request to list branch VTGate resize requests.
type ListBranchTabletsRequest ¶
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 ¶
ListDatabaseBranchPasswordRequest encapsulates the request for listing all passwords for a given database branch.
type ListDatabaseBranchesRequest ¶
ListDatabaseBranchesRequest encapsulates the request for listing the branches of a database.
type ListDatabaseRegionsRequest ¶ added in v0.327.0
type ListDatabasesRequest ¶
type ListDatabasesRequest struct {
Organization string
}
ListDatabasesRequest encapsulates the request for listing all databases in an organization.
type ListDeployRequestReviewsRequest ¶ added in v0.317.0
type ListDeployRequestReviewsRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Number uint64 `json:"-"`
}
ListDeployRequestReviewsRequest lists reviews for a deploy request.
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 ListErrorQueriesRequest ¶ added in v0.322.0
type ListErrorQueriesRequest struct {
Organization string
Database string
Branch string
Fingerprint string
}
ListErrorQueriesRequest is the request for listing the individual queries that failed with a given error fingerprint.
type ListInvoiceLineItemsRequest ¶ added in v0.327.0
type ListInvoicesRequest ¶ added in v0.327.0
type ListInvoicesRequest struct {
Organization string
}
type ListKeyspacesRequest ¶
type ListMaintenanceSchedulesRequest ¶ added in v0.318.0
ListMaintenanceSchedulesRequest encapsulates listing maintenance schedules for a database.
type ListMaintenanceWindowsRequest ¶ added in v0.318.0
ListMaintenanceWindowsRequest encapsulates listing windows for a maintenance schedule.
type ListOption ¶
type ListOption func(*ListOptions) error
func WithEventFilters ¶
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 WithFingerprint ¶ added in v0.315.0
func WithFingerprint(fingerprint string) ListOption
WithFingerprint sets the fingerprint query parameter.
func WithKeyspace ¶ added in v0.315.0
func WithKeyspace(keyspace string) ListOption
WithKeyspace sets the keyspace query parameter.
func WithLimit ¶
func WithLimit(limit int) ListOption
WithLimit returns a ListOption that sets the "limit" URL parameter.
func WithPage ¶
func WithPage(page int) ListOption
WithPage returns a ListOption that sets the "page" URL parameter.
func WithPerPage ¶
func WithPerPage(perPage int) ListOption
WithPerPage returns a ListOption that sets the "per_page" URL paramter.
func WithPeriod ¶ added in v0.307.0
func WithPeriod(period string) ListOption
WithPeriod returns a ListOption that sets the "period" URL parameter (e.g. "1h", "1d").
func WithPostgreSQL ¶
func WithPostgreSQL() ListOption
WithPostgreSQL returns a ListOption that sets the "postgresql" URL parameter.
func WithRates ¶
func WithRates() ListOption
WithRates returns a ListOption that sets the "rates" URL parameter.
func WithRegion ¶
func WithRegion(region string) ListOption
WithRegion returns a ListOption sets the "region" URL parameter.
func WithSearch ¶ added in v0.303.0
func WithSearch(search string) ListOption
WithSearch returns a ListOption that sets the "q" URL parameter.
func WithSort ¶ added in v0.307.0
func WithSort(sort, dir string) ListOption
WithSort returns a ListOption that sets the "sort" and "dir" URL parameters.
func WithStartingAfter ¶
func WithStartingAfter(startingAfter string) ListOption
WithStartingAfter returns a ListOption that sets the "starting_after" URL parameter.
func WithStatus ¶ added in v0.303.0
func WithStatus(status string) ListOption
WithStatus returns a ListOption that sets the "status" URL parameter.
func WithTags ¶ added in v0.315.0
func WithTags(tags []string) ListOption
WithTags sets the tags[] query parameters (dimension ids for summaries).
func WithTimeRange ¶ added in v0.327.0
func WithTimeRange(from, to string) ListOption
type ListOptions ¶
ListOptions are options for listing responses.
type ListOrganizationClusterSKUsRequest ¶
type ListOrganizationClusterSKUsRequest struct {
Organization string
}
ListOrganizationClusterSKUsRequest encapsulates the request for getting a list of Cluster SKUs for an organization.
type ListOrganizationMembersRequest ¶ added in v0.323.0
type ListOrganizationRegionsRequest ¶
type ListOrganizationRegionsRequest struct {
Organization string
}
ListRegionsRequest encapsulates the request for getting a list of regions for an organization.
type ListOrganizationTeamMembersRequest ¶ added in v0.327.0
type ListOrganizationTeamsRequest ¶ added in v0.327.0
type ListPostgresBouncerResizesRequest ¶ added in v0.314.0
type ListPostgresBouncerResizesRequest struct {
Organization string
Database string
Branch string
Bouncer string
}
ListPostgresBouncerResizesRequest lists resize requests for one bouncer.
type ListPostgresBouncersRequest ¶ added in v0.314.0
ListPostgresBouncersRequest encapsulates listing PgBouncers for a branch.
type ListPostgresBranchChangesRequest ¶ added in v0.304.0
ListPostgresBranchChangesRequest encapsulates the request to list change requests for a Postgres branch.
type ListPostgresBranchesRequest ¶
ListPostgresBranchesRequest encapsulates the request to list Postgres branches for a database.
type ListPostgresCIDRsRequest ¶ added in v0.313.0
ListPostgresCIDRsRequest encapsulates listing IP restriction entries for a database.
type ListPostgresExtensionsRequest ¶ added in v0.323.0
ListPostgresExtensionsRequest lists extensions available on a Postgres branch's cluster image.
type ListPostgresParametersRequest ¶ added in v0.304.0
type ListPostgresParametersRequest struct {
Organization string
Database string
Branch string
// Extension filters parameters by whether they configure an extension.
// Nil returns both.
Extension *bool
// Internal filters parameters by whether they are internal (immutable).
// Nil returns both.
Internal *bool
}
ListPostgresParametersRequest encapsulates the request to list the configuration parameters of a Postgres branch.
type ListPostgresReadOnlyReplicasRequest ¶ added in v0.329.0
type ListPostgresReadOnlyReplicasRequest struct {
Organization string
Database string
Branch string
}
ListPostgresReadOnlyReplicasRequest encapsulates listing read-only replicas.
type ListPostgresRolesRequest ¶
ListPostgresRolesRequest encapsulates the request for listing all roles for a given database branch.
type ListPostgresSwitchoversRequest ¶ added in v0.327.0
type ListQueryInsightsErrorsRequest ¶ added in v0.307.0
ListQueryInsightsErrorsRequest is the request for listing query errors for a branch.
type ListQueryInsightsRequest ¶ added in v0.307.0
ListQueryInsightsRequest is the request for listing query statistics for a branch.
type ListQueryPatternsReportsRequest ¶ added in v0.323.0
type ListQuerySamplesRequest ¶ added in v0.315.0
type ListQuerySamplesRequest struct {
Organization string
Database string
Branch string
Fingerprint string
}
ListQuerySamplesRequest lists individual executions for a query fingerprint.
type ListQueryTagsRequest ¶ added in v0.315.0
ListQueryTagsRequest lists tag keys for a branch.
type ListQueryTrafficBudgetsRequest ¶ added in v0.327.0
type ListReadOnlyRegionsRequest ¶ added in v0.312.0
type ListRegionsRequest ¶
type ListRegionsRequest struct{}
type ListSchemaRecommendationsRequest ¶
type ListSchemaRecommendationsRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
}
ListSchemaRecommendationsRequest is the request for listing schema recommendations.
type ListServiceTokensRequest ¶
type ListServiceTokensRequest struct {
Organization string `json:"-"`
}
type ListTagSummariesRequest ¶ added in v0.315.0
type ListTagSummariesRequest struct {
Organization string
Database string
Branch string
Tags []string
}
ListTagSummariesRequest lists query stats grouped by tag dimensions. Tags are dimension ids from the tags list endpoint (e.g. "Sapp").
type ListTrafficBudgetsRequest ¶
type ListTrafficBudgetsRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
// Fingerprint, when set, returns only budgets with a rule for that query
// fingerprint.
Fingerprint string `json:"-"`
}
ListTrafficBudgetsRequest is the request for listing traffic budgets.
type ListWebhooksRequest ¶
ListWebhooksRequest is the request for listing webhooks.
type ListWorkflowsRequest ¶
type LookupVindexCreateRequest ¶
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 LookupVindexService ¶
type LookupVindexService interface {
Create(context.Context, *LookupVindexCreateRequest) (json.RawMessage, error)
Show(context.Context, *LookupVindexShowRequest) (json.RawMessage, error)
Externalize(context.Context, *LookupVindexExternalizeRequest) (json.RawMessage, error)
Internalize(context.Context, *LookupVindexInternalizeRequest) (json.RawMessage, error)
Cancel(context.Context, *LookupVindexCancelRequest) (json.RawMessage, error)
Complete(context.Context, *LookupVindexCompleteRequest) (json.RawMessage, error)
}
LookupVindexService is an interface for interacting with the LookupVindex endpoints of the PlanetScale API.
type LookupVindexShowRequest ¶
type MaintenanceSchedule ¶ added in v0.318.0
type MaintenanceSchedule struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastWindowDatetime time.Time `json:"last_window_datetime"`
NextWindowDatetime time.Time `json:"next_window_datetime"`
Duration int `json:"duration"`
Day int `json:"day"`
Hour int `json:"hour"`
Week int `json:"week"`
FrequencyValue int `json:"frequency_value"`
FrequencyUnit string `json:"frequency_unit"`
Enabled bool `json:"enabled"`
ExpiresAt *time.Time `json:"expires_at"`
DeadlineAt *time.Time `json:"deadline_at"`
Required bool `json:"required"`
PendingVitessVersionUpdate bool `json:"pending_vitess_version_update"`
PendingVitessVersion *string `json:"pending_vitess_version"`
PendingMySQLVersionUpdate bool `json:"pending_mysql_version_update"`
PendingMySQLVersion *string `json:"pending_mysql_version"`
}
MaintenanceSchedule represents a database maintenance schedule. Available for Vitess databases on Enterprise plans.
type MaintenanceSchedulesService ¶ added in v0.318.0
type MaintenanceSchedulesService interface {
List(context.Context, *ListMaintenanceSchedulesRequest, ...ListOption) ([]*MaintenanceSchedule, error)
Get(context.Context, *GetMaintenanceScheduleRequest) (*MaintenanceSchedule, error)
ListWindows(context.Context, *ListMaintenanceWindowsRequest, ...ListOption) ([]*MaintenanceWindow, error)
}
MaintenanceSchedulesService is an interface for the PlanetScale maintenance schedules API.
type MaintenanceWindow ¶ added in v0.318.0
type MaintenanceWindow struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
StartedAt *time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at"`
}
MaintenanceWindow represents a past or ongoing maintenance window for a schedule.
type MaterializeCancelRequest ¶
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 ¶
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 ¶
type MaterializeService interface {
Create(context.Context, *MaterializeCreateRequest) (json.RawMessage, error)
Show(context.Context, *MaterializeShowRequest) (json.RawMessage, error)
Start(context.Context, *MaterializeStartRequest) (json.RawMessage, error)
Stop(context.Context, *MaterializeStopRequest) (json.RawMessage, error)
Cancel(context.Context, *MaterializeCancelRequest) (json.RawMessage, error)
}
MaterializeService is an interface for interacting with the Materialize endpoints of the PlanetScale API.
type MaterializeShowRequest ¶
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 ¶
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 ¶
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 MetricSeries ¶ added in v0.321.0
type MetricSeries struct {
Type string `json:"type"`
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
Interval int `json:"interval"`
Series []*TimeSeries `json:"series"`
}
MetricSeries is a collection of sampled time series over a common range.
type MetricsService ¶ added in v0.321.0
type MetricsService interface {
GetSeries(context.Context, *GetMetricSeriesRequest) (*MetricSeries, error)
GetInstant(context.Context, *GetInstantMetricsRequest) (*InstantMetrics, error)
GetQuerySeries(context.Context, *GetQueryMetricSeriesRequest) (*MetricSeries, error)
GetTables(context.Context, *GetBranchMetricsRequest) (json.RawMessage, error)
GetKeyspaceTables(context.Context, *GetBranchMetricsRequest) (json.RawMessage, error)
GetTabletSeries(context.Context, *GetTabletMetricSeriesRequest) (*MetricSeries, error)
GetInstantTablets(context.Context, *GetInstantTabletMetricsRequest) (*InstantMetrics, error)
GetTagSeries(context.Context, *GetTagMetricSeriesRequest) (*MetricSeries, error)
}
MetricsService provides access to branch time-series and instant metrics.
type MoveTablesCancelRequest ¶
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 ¶
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 ¶
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 ¶
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 MoveTablesService ¶
type MoveTablesService interface {
Create(context.Context, *MoveTablesCreateRequest) (*VtctldOperationReference, error)
Show(context.Context, *MoveTablesShowRequest) (json.RawMessage, error)
Status(context.Context, *MoveTablesStatusRequest) (json.RawMessage, error)
SwitchTraffic(context.Context, *MoveTablesSwitchTrafficRequest) (*VtctldOperationReference, error)
ReverseTraffic(context.Context, *MoveTablesReverseTrafficRequest) (*VtctldOperationReference, error)
Cancel(context.Context, *MoveTablesCancelRequest) (*VtctldOperationReference, error)
Complete(context.Context, *MoveTablesCompleteRequest) (*VtctldOperationReference, error)
}
MoveTablesService is an interface for interacting with the MoveTables endpoints of the PlanetScale API.
type MoveTablesShowRequest ¶
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 ¶
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 ¶
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"`
BillingEmail string `json:"billing_email"`
IDPManagedRoles bool `json:"idp_managed_roles"`
IDPSSOManagedRoles bool `json:"idp_sso_managed_roles"`
InvoiceBudgetAlerts bool `json:"invoice_budget_alerts"`
InvoiceBudgetAmount InvoiceBudgetAmount `json:"invoice_budget_amount"`
SuggestedInvoiceBudgetAmount InvoiceBudgetAmount `json:"suggested_invoice_budget_amount"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
RemainingFreeDatabases int `json:"free_databases_remaining"`
}
Organization represents a PlanetScale organization.
type OrganizationDomain ¶ added in v0.328.0
type OrganizationDomain struct {
ID string `json:"id"`
Type string `json:"type"`
Domain string `json:"domain"`
State string `json:"state"`
VerifiedAt *time.Time `json:"verified_at"`
FailureReason *string `json:"failure_reason"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
OrganizationDomain is an email domain registered for organization SSO.
type OrganizationMemberUser ¶ added in v0.323.0
type OrganizationMemberUser struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Name string `json:"name"`
Email string `json:"email"`
AvatarURL string `json:"avatar_url"`
TwoFactorAuthConfigured bool `json:"two_factor_auth_configured"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
OrganizationMemberUser is the user nested on an organization membership.
type OrganizationMembership ¶ added in v0.323.0
type OrganizationMembership struct {
ID string `json:"id"`
Role string `json:"role"`
User OrganizationMemberUser `json:"user"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
OrganizationMembership is a user's membership in an organization. ID is the membership public id. PATCH/DELETE/GET member routes take the nested user's public id (User.ID), not this ID.
type OrganizationSSO ¶ added in v0.328.0
type OrganizationSSO struct {
ID string `json:"id"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
Configured bool `json:"configured"`
Directory bool `json:"directory"`
HasVerifiedDomain bool `json:"has_verified_domain"`
Domains []*OrganizationDomain `json:"domains"`
DomainVerificationURL *string `json:"domain_verification_url"`
}
OrganizationSSO is the SSO status for an organization.
type OrganizationSSODomainRequest ¶ added in v0.328.0
type OrganizationSSORequest ¶ added in v0.328.0
type OrganizationSSORequest struct {
Organization string
}
type OrganizationSSOService ¶ added in v0.328.0
type OrganizationSSOService interface {
Get(context.Context, *OrganizationSSORequest) (*OrganizationSSO, error)
Enable(context.Context, *OrganizationSSORequest) (*OrganizationSSO, error)
Disable(context.Context, *OrganizationSSORequest) (*OrganizationSSO, error)
Configure(context.Context, *OrganizationSSORequest) (*SSOPortal, error)
EnableDirectory(context.Context, *OrganizationSSORequest) (*SSOPortal, error)
DisableDirectory(context.Context, *OrganizationSSORequest) (*OrganizationSSO, error)
ListDomains(context.Context, *OrganizationSSORequest) ([]*OrganizationDomain, error)
GetDomain(context.Context, *OrganizationSSODomainRequest) (*OrganizationDomain, error)
VerifyDomain(context.Context, *OrganizationSSORequest) (*SSOPortal, error)
DeleteDomain(context.Context, *OrganizationSSODomainRequest) error
}
OrganizationSSOService is an interface for communicating with the PlanetScale organization SSO API endpoints.
type OrganizationTeam ¶ added in v0.327.0
type OrganizationTeam struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Creator OrganizationTeamActor `json:"creator"`
Members []OrganizationTeamUser `json:"members"`
Databases []OrganizationTeamDatabase `json:"databases"`
AnalystDatabases []OrganizationTeamDatabase `json:"analyst_databases"`
Name string `json:"name"`
Slug string `json:"slug"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Description *string `json:"description"`
Managed bool `json:"managed"`
}
type OrganizationTeamActor ¶ added in v0.327.0
type OrganizationTeamDatabase ¶ added in v0.327.0
type OrganizationTeamMembership ¶ added in v0.327.0
type OrganizationTeamMembership struct {
ID string `json:"id"`
User OrganizationTeamUser `json:"user"`
Actor OrganizationTeamActor `json:"actor"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Passwords []json.RawMessage `json:"passwords"`
}
type OrganizationTeamUser ¶ added in v0.327.0
type OrganizationTeamUser struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Name string `json:"name"`
Email string `json:"email"`
AvatarURL string `json:"avatar_url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
TwoFactorAuthConfigured bool `json:"two_factor_auth_configured"`
DefaultOrganization json.RawMessage `json:"default_organization"`
SSO *bool `json:"sso"`
Managed *bool `json:"managed"`
DirectoryManaged *bool `json:"directory_managed"`
EmailVerified *bool `json:"email_verified"`
}
type OrganizationsService ¶
type OrganizationsService interface {
Get(context.Context, *GetOrganizationRequest) (*Organization, error)
Update(context.Context, *UpdateOrganizationRequest) (*Organization, error)
List(context.Context) ([]*Organization, error)
ListRegions(context.Context, *ListOrganizationRegionsRequest) ([]*Region, error)
ListClusterSKUs(context.Context, *ListOrganizationClusterSKUsRequest, ...ListOption) ([]*ClusterSKU, error)
ListMembers(context.Context, *ListOrganizationMembersRequest, ...ListOption) ([]*OrganizationMembership, error)
GetMember(context.Context, *GetOrganizationMemberRequest) (*OrganizationMembership, error)
UpdateMember(context.Context, *UpdateOrganizationMemberRequest) (*OrganizationMembership, error)
RemoveMember(context.Context, *RemoveOrganizationMemberRequest) error
ListTeams(context.Context, *ListOrganizationTeamsRequest, ...ListOption) ([]*OrganizationTeam, error)
GetTeam(context.Context, *GetOrganizationTeamRequest) (*OrganizationTeam, error)
CreateTeam(context.Context, *CreateOrganizationTeamRequest) (*OrganizationTeam, error)
UpdateTeam(context.Context, *UpdateOrganizationTeamRequest) (*OrganizationTeam, error)
DeleteTeam(context.Context, *DeleteOrganizationTeamRequest) error
ListTeamMembers(context.Context, *ListOrganizationTeamMembersRequest, ...ListOption) ([]*OrganizationTeamMembership, error)
AddTeamMember(context.Context, *AddOrganizationTeamMemberRequest) (*OrganizationTeamMembership, error)
RemoveTeamMember(context.Context, *RemoveOrganizationTeamMemberRequest) error
}
OrganizationsService is an interface for communicating with the PlanetScale Organizations API endpoints.
type PasswordsService ¶
type PasswordsService interface {
Create(context.Context, *DatabaseBranchPasswordRequest) (*DatabaseBranchPassword, error)
// List returns passwords with optional pagination support via ListOption parameters
List(context.Context, *ListDatabaseBranchPasswordRequest, ...ListOption) ([]*DatabaseBranchPassword, error)
Get(context.Context, *GetDatabaseBranchPasswordRequest) (*DatabaseBranchPassword, error)
Update(context.Context, *UpdateDatabaseBranchPasswordRequest) (*DatabaseBranchPassword, error)
Delete(context.Context, *DeleteDatabaseBranchPasswordRequest) error
Renew(context.Context, *RenewDatabaseBranchPasswordRequest) (*DatabaseBranchPassword, error)
}
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 ¶
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 ¶
type PlannedReparentShardService interface {
Create(context.Context, *PlannedReparentShardRequest) (*VtctldOperation, error)
Get(context.Context, *GetPlannedReparentShardRequest) (*VtctldOperation, error)
}
PlannedReparentShardService is an interface for interacting with the PlannedReparentShard endpoints of the PlanetScale API.
type PostgresBouncer ¶ added in v0.314.0
type PostgresBouncer struct {
ID string `json:"id"`
Name string `json:"name"`
SKU *PostgresBouncerSKU `json:"sku"`
Target string `json:"target"`
ReplicasPerCell int `json:"replicas_per_cell"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at"`
Actor Actor `json:"actor"`
Branch PostgresBouncerBranch `json:"branch"`
Parameters []*PostgresBouncerParameter `json:"parameters"`
// Deprecated response fields retained for compatibility with older API payloads.
BouncerSize string `json:"bouncer_size,omitempty"`
}
PostgresBouncer represents a dedicated PgBouncer for a Postgres branch.
type PostgresBouncerBranch ¶ added in v0.314.0
type PostgresBouncerBranch struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at"`
}
PostgresBouncerBranch is the branch identity embedded on a bouncer response.
type PostgresBouncerParameter ¶ added in v0.314.0
type PostgresBouncerParameter struct {
ID string `json:"id"`
Namespace string `json:"namespace"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Category string `json:"category"`
Description string `json:"description"`
Immutable bool `json:"immutable"`
ParameterType string `json:"parameter_type"`
DefaultValue string `json:"default_value"`
Value string `json:"value"`
Required bool `json:"required"`
Restart bool `json:"restart"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
PostgresBouncerParameter is a configured PgBouncer parameter on a bouncer.
type PostgresBouncerResizeRequest ¶ added in v0.314.0
type PostgresBouncerResizeRequest struct {
ID string `json:"id"`
State string `json:"state"`
ReplicasPerCell int `json:"replicas_per_cell"`
Target string `json:"target"`
Parameters map[string]any `json:"parameters"`
PreviousReplicasPerCell int `json:"previous_replicas_per_cell"`
PreviousTarget string `json:"previous_target"`
PreviousParameters map[string]any `json:"previous_parameters"`
StartedAt *time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Actor Actor `json:"actor"`
Bouncer PostgresBouncerBranch `json:"bouncer"`
SKU *PostgresBouncerSKU `json:"sku"`
PreviousSKU *PostgresBouncerSKU `json:"previous_sku"`
}
PostgresBouncerResizeRequest is an asynchronous dedicated-PgBouncer change.
func (*PostgresBouncerResizeRequest) Finished ¶ added in v0.314.0
func (r *PostgresBouncerResizeRequest) Finished() bool
Finished reports whether the resize request is in a terminal state.
type PostgresBouncerSKU ¶ added in v0.314.0
type PostgresBouncerSKU struct {
Name string `json:"name"`
DisplayName string `json:"display_name"`
CPU string `json:"cpu"`
RAM int64 `json:"ram"`
SortOrder int `json:"sort_order"`
}
PostgresBouncerSKU represents the size of a dedicated PgBouncer.
type PostgresBouncersService ¶ added in v0.314.0
type PostgresBouncersService interface {
List(context.Context, *ListPostgresBouncersRequest, ...ListOption) ([]*PostgresBouncer, error)
Get(context.Context, *GetPostgresBouncerRequest) (*PostgresBouncer, error)
Create(context.Context, *CreatePostgresBouncerRequest) (*PostgresBouncer, error)
Delete(context.Context, *DeletePostgresBouncerRequest) error
ListResizes(context.Context, *ListPostgresBouncerResizesRequest, ...ListOption) ([]*PostgresBouncerResizeRequest, error)
Resize(context.Context, *ResizePostgresBouncerRequest) (*PostgresBouncerResizeRequest, error)
CancelResizes(context.Context, *CancelPostgresBouncerResizesRequest) error
}
PostgresBouncersService is an interface for the PlanetScale PgBouncer API.
type PostgresBranch ¶
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 ¶
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"`
// Parameters and PreviousParameters are configuration parameter values
// nested by namespace. Values are left untyped since the API returns
// strings, numbers, and booleans depending on the parameter type.
Parameters map[string]map[string]any `json:"parameters"`
PreviousParameters map[string]map[string]any `json:"previous_parameters"`
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.
func (*PostgresBranchClusterResizeRequest) Finished ¶ added in v0.304.0
func (r *PostgresBranchClusterResizeRequest) Finished() bool
Finished reports whether the change request reached a terminal state.
type PostgresBranchInfrastructure ¶
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 ¶
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 ¶
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 PostgresBranchesService ¶
type PostgresBranchesService interface {
Create(context.Context, *CreatePostgresBranchRequest) (*PostgresBranch, error)
List(context.Context, *ListPostgresBranchesRequest, ...ListOption) ([]*PostgresBranch, error)
Get(context.Context, *GetPostgresBranchRequest) (*PostgresBranch, error)
Update(context.Context, *UpdatePostgresBranchRequest) (*PostgresBranch, error)
Delete(context.Context, *DeletePostgresBranchRequest) error
Schema(context.Context, *PostgresBranchSchemaRequest) ([]*PostgresBranchSchema, error)
ListClusterSKUs(context.Context, *ListBranchClusterSKUsRequest, ...ListOption) ([]*ClusterSKU, error)
Resize(context.Context, *ResizePostgresBranchRequest) (*PostgresBranchClusterResizeRequest, error)
ListChanges(context.Context, *ListPostgresBranchChangesRequest) ([]*PostgresBranchClusterResizeRequest, error)
GetChange(context.Context, *GetPostgresBranchChangeRequest) (*PostgresBranchClusterResizeRequest, error)
CancelChanges(context.Context, *CancelPostgresBranchChangesRequest) error
ListParameters(context.Context, *ListPostgresParametersRequest) ([]*PostgresParameter, error)
ListExtensions(context.Context, *ListPostgresExtensionsRequest) ([]*PostgresExtension, error)
}
type PostgresCIDR ¶ added in v0.313.0
type PostgresCIDR struct {
ID string `json:"id"`
Schema string `json:"schema"`
Role string `json:"role"`
CIDRs []string `json:"cidrs"`
Description *string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at"`
Actor Actor `json:"actor"`
}
PostgresCIDR represents a Postgres IP restriction (CIDR restriction) entry.
type PostgresCIDRsService ¶ added in v0.313.0
type PostgresCIDRsService interface {
List(context.Context, *ListPostgresCIDRsRequest, ...ListOption) ([]*PostgresCIDR, error)
Get(context.Context, *GetPostgresCIDRRequest) (*PostgresCIDR, error)
Create(context.Context, *CreatePostgresCIDRRequest) (*PostgresCIDR, error)
Update(context.Context, *UpdatePostgresCIDRRequest) (*PostgresCIDR, error)
Delete(context.Context, *DeletePostgresCIDRRequest) error
}
PostgresCIDRsService is an interface for the PlanetScale Postgres IP restriction API.
type PostgresExtension ¶ added in v0.323.0
type PostgresExtension struct {
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Internal bool `json:"internal"`
Loader string `json:"loader"`
URL string `json:"url"`
Available bool `json:"available"`
Parameters []*PostgresParameter `json:"parameters"`
}
PostgresExtension is an extension defined on the branch's cluster image. This is the catalog of what the image can load, not CREATE EXTENSION state.
type PostgresInfraBouncer ¶
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 ¶
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 ¶
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 ¶
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 PostgresParameter ¶ added in v0.304.0
type PostgresParameter struct {
ID string `json:"id"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Namespace string `json:"namespace"`
Category string `json:"category"`
Description string `json:"description"`
Extension bool `json:"extension"`
Immutable bool `json:"immutable"`
ParameterType string `json:"parameter_type"`
DefaultValue any `json:"default_value"`
Value any `json:"value"`
Required bool `json:"required"`
Restart bool `json:"restart"`
// Min, Max, and Step are numbers for plain numeric parameters but strings
// for byte- and time-typed ones (e.g. "8kB", "10s").
Max any `json:"max,omitempty"`
Min any `json:"min,omitempty"`
Step any `json:"step,omitempty"`
Options []string `json:"options,omitempty"`
Units []string `json:"units,omitempty"`
URL string `json:"url"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
}
PostgresParameter represents a configuration parameter of a Postgres branch.
type PostgresReadOnlyReplica ¶ added in v0.329.0
type PostgresReadOnlyReplica struct {
ID string `json:"id"`
Name string `json:"name"`
State string `json:"state"`
Replicas int `json:"replicas"`
ClusterName string `json:"cluster_name"`
ClusterDisplayName string `json:"cluster_display_name"`
AccessHostURL string `json:"access_host_url"`
PrivateAccessHostURL string `json:"private_access_host_url"`
PrivateConnectionServiceName *string `json:"private_connection_service_name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ReadyAt *time.Time `json:"ready_at"`
Ready bool `json:"ready"`
Actor Actor `json:"actor"`
Region Region `json:"region"`
Parameters []*PostgresParameter `json:"parameters"`
}
PostgresReadOnlyReplica represents a read-only replica for a Postgres branch.
type PostgresReadOnlyReplicasService ¶ added in v0.329.0
type PostgresReadOnlyReplicasService interface {
List(context.Context, *ListPostgresReadOnlyReplicasRequest) ([]*PostgresReadOnlyReplica, error)
Get(context.Context, *GetPostgresReadOnlyReplicaRequest) (*PostgresReadOnlyReplica, error)
Create(context.Context, *CreatePostgresReadOnlyReplicaRequest) (*PostgresReadOnlyReplica, error)
Update(context.Context, *UpdatePostgresReadOnlyReplicaRequest) (*PostgresReadOnlyReplica, error)
Delete(context.Context, *DeletePostgresReadOnlyReplicaRequest) error
}
PostgresReadOnlyReplicasService is an interface for the Postgres read-only replicas API.
type PostgresRole ¶
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"`
DisabledAt *time.Time `json:"disabled_at"`
ExpiresAt *time.Time `json:"expires_at"`
Expired bool `json:"expired"`
}
PostgresRole represents a PostgreSQL role in PlanetScale.
type PostgresRolesService ¶
type PostgresRolesService interface {
List(context.Context, *ListPostgresRolesRequest, ...ListOption) ([]*PostgresRole, error)
Get(context.Context, *GetPostgresRoleRequest) (*PostgresRole, error)
Create(context.Context, *CreatePostgresRoleRequest) (*PostgresRole, error)
Update(context.Context, *UpdatePostgresRoleRequest) (*PostgresRole, error)
Renew(context.Context, *RenewPostgresRoleRequest) (*PostgresRole, error)
Delete(context.Context, *DeletePostgresRoleRequest) error
ResetDefaultRole(context.Context, *ResetDefaultRoleRequest) (*PostgresRole, error)
GetDefaultRole(context.Context, *GetDefaultPostgresRoleRequest) (*PostgresRole, error)
ResetPassword(context.Context, *ResetPostgresRolePasswordRequest) (*PostgresRole, error)
ReassignObjects(context.Context, *ReassignPostgresRoleObjectsRequest) error
}
PostgresRolesService defines the interface for managing PostgreSQL roles in PlanetScale.
type PostgresSwitchover ¶ added in v0.322.0
type PostgresSwitchover struct {
ID string `json:"id"`
State string `json:"state"`
Method string `json:"method,omitempty"`
Error string `json:"error,omitempty"`
Actor Actor `json:"actor"`
StartedAt *time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
PostgresSwitchover represents a switchover of the primary of a Postgres branch.
type PostgresSwitchoversService ¶ added in v0.322.0
type PostgresSwitchoversService interface {
List(context.Context, *ListPostgresSwitchoversRequest, ...ListOption) ([]*PostgresSwitchover, error)
Get(context.Context, *GetPostgresSwitchoverRequest) (*PostgresSwitchover, error)
Create(context.Context, *CreatePostgresSwitchoverRequest) (*PostgresSwitchover, error)
}
PostgresSwitchoversService is an interface for the PlanetScale Postgres switchover API.
type Process ¶
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 ¶
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 ¶
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 ¶
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 ¶
type PromoteRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
}
PromoteRequest encapsulates the request for promoting a request to production.
type Query ¶ added in v0.327.0
type Query struct {
ID string `json:"id"`
Password map[string]any `json:"password"`
Tags []map[string]any `json:"tags"`
Fingerprint string `json:"fingerprint"`
StartedAt *time.Time `json:"started_at"`
StatementType string `json:"statement_type"`
Keyspace string `json:"keyspace"`
Tables []string `json:"tables"`
Username string `json:"username"`
RemoteAddress string `json:"remote_address"`
ShardQueries int64 `json:"shard_queries"`
RowsRead int64 `json:"rows_read"`
RowsAffected int64 `json:"rows_affected"`
RowsReturned int64 `json:"rows_returned"`
TotalDurationMillis float64 `json:"total_duration_millis"`
ErrorMessage string `json:"error_message"`
NormalizedSQL string `json:"normalized_sql"`
SyntaxHighlightedSQL string `json:"syntax_highlighted_sql"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Explainable bool `json:"explainable"`
Truncated bool `json:"truncated"`
}
type QueryInsight ¶ added in v0.307.0
type QueryInsight struct {
ID string `json:"id"`
Fingerprint string `json:"fingerprint"`
NormalizedSQL string `json:"normalized_sql"`
StatementType string `json:"statement_type"`
Keyspace string `json:"keyspace"`
Tables []string `json:"tables"`
IndexUsages []IndexUsage `json:"index_usages"`
QueryCount int64 `json:"query_count"`
ErrorCount int64 `json:"error_count"`
LastRunAt time.Time `json:"last_run_at"`
TimePerQuery float64 `json:"time_per_query"`
P50Latency float64 `json:"p50_latency"`
P99Latency float64 `json:"p99_latency"`
MaxLatency float64 `json:"max_latency"`
SumRowsRead int64 `json:"sum_rows_read"`
SumRowsReturned int64 `json:"sum_rows_returned"`
SumRowsAffected int64 `json:"sum_rows_affected"`
RowsReadPerReturned float64 `json:"rows_read_per_returned"`
SumTotalDurationMillis float64 `json:"sum_total_duration_millis"`
SumTotalDurationPct float64 `json:"sum_total_duration_percent"`
SumCPUDurationMillis float64 `json:"sum_cpu_duration_millis"`
SumIODurationMillis float64 `json:"sum_io_duration_millis"`
BlockCacheHitRatio float64 `json:"block_cache_hit_ratio"`
Multishard bool `json:"multishard"`
}
QueryInsight is an aggregated statistics record for a normalized query pattern on a branch.
type QueryInsightError ¶ added in v0.307.0
type QueryInsightError struct {
ID string `json:"id"`
ErrorFingerprint string `json:"error_fingerprint"`
StartedAt time.Time `json:"started_at"`
TotalDurationMillis float64 `json:"total_duration_millis"`
TimePerQuery float64 `json:"time_per_query"`
ErrorCount int64 `json:"error_count"`
ErrorMessage string `json:"error_message"`
}
QueryInsightError is an aggregated error record for a query pattern on a branch.
type QueryInsightsService ¶ added in v0.307.0
type QueryInsightsService interface {
ListQueries(context.Context, *ListQueryInsightsRequest, ...ListOption) ([]*QueryInsight, error)
ListQuerySamples(context.Context, *ListQuerySamplesRequest, ...ListOption) ([]*QuerySample, error)
ListQueryTrafficBudgets(context.Context, *ListQueryTrafficBudgetsRequest, ...ListOption) ([]*TrafficBudget, error)
GetQuery(context.Context, *GetQueryRequest) (*Query, error)
GetQuerySummary(context.Context, *GetQuerySummaryRequest, ...ListOption) (*QuerySummary, error)
ListErrors(context.Context, *ListQueryInsightsErrorsRequest, ...ListOption) ([]*QueryInsightError, error)
ListErrorQueries(context.Context, *ListErrorQueriesRequest, ...ListOption) ([]*QuerySample, error)
ListAnomalies(context.Context, *ListAnomaliesRequest, ...ListOption) ([]*Anomaly, error)
GetAnomaly(context.Context, *GetAnomalyRequest) (*Anomaly, error)
ListTags(context.Context, *ListQueryTagsRequest, ...ListOption) ([]*QueryTag, error)
GetTag(context.Context, *GetQueryTagRequest, ...ListOption) (*QueryTag, error)
ListTagSummaries(context.Context, *ListTagSummariesRequest, ...ListOption) ([]*TagSummary, error)
}
QueryInsightsService is an interface for communicating with the PlanetScale Query Insights API: aggregated query statistics, query errors, detected anomalies, per-fingerprint samples, and query tags for a database branch.
type QueryPatternsReport ¶
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 ¶
type QueryPatternsService interface {
CreateReport(context.Context, *CreateQueryPatternsReportRequest) (*QueryPatternsReport, error)
ListReports(context.Context, *ListQueryPatternsReportsRequest, ...ListOption) ([]*QueryPatternsReport, error)
GetReport(context.Context, *GetQueryPatternsReportRequest) (*QueryPatternsReport, error)
DeleteReport(context.Context, *DeleteQueryPatternsReportRequest) error
DownloadReport(context.Context, *DownloadQueryPatternsReportRequest) (io.ReadCloser, error)
}
QueryPatternsService is an interface for communicating with the PlanetScale query patterns API endpoints.
type QuerySample ¶ added in v0.315.0
type QuerySample struct {
ID string `json:"id"`
Fingerprint string `json:"fingerprint"`
NormalizedSQL string `json:"normalized_sql"`
StatementType string `json:"statement_type"`
Keyspace string `json:"keyspace"`
Tables []string `json:"tables"`
Username string `json:"username"`
RemoteAddress string `json:"remote_address"`
RowsRead int64 `json:"rows_read"`
RowsAffected int64 `json:"rows_affected"`
RowsReturned int64 `json:"rows_returned"`
TotalDurationMillis float64 `json:"total_duration_millis"`
ErrorMessage string `json:"error_message"`
StartedAt time.Time `json:"started_at"`
Tags []QuerySampleTag `json:"tags"`
}
QuerySample is an individual query execution recorded for a fingerprint.
type QuerySampleTag ¶ added in v0.315.0
QuerySampleTag is a name/value tag attached to an individual query execution.
type QuerySummary ¶ added in v0.327.0
type QuerySummary struct {
ID string `json:"id"`
Fingerprint string `json:"fingerprint"`
StatementType string `json:"statement_type"`
Keyspace string `json:"keyspace"`
NormalizedSQL string `json:"normalized_sql"`
SyntaxHighlightedSQL string `json:"syntax_highlighted_sql"`
Multishard bool `json:"multishard"`
QueryCount int64 `json:"query_count"`
ErrorCount int64 `json:"error_count"`
Tables []string `json:"tables"`
QualifiedTables []string `json:"qualified_tables"`
TableKeyspaces []map[string]any `json:"table_keyspaces"`
IndexUsages []map[string]any `json:"index_usages"`
RoutingIndexUsages []map[string]any `json:"routing_index_usages"`
SumShardQueries int64 `json:"sum_shard_queries"`
MaxShardQueries int64 `json:"max_shard_queries"`
AvgShardQueries float64 `json:"avg_shard_queries"`
AvgParallelWorkers float64 `json:"avg_parallel_workers"`
SumRowsRead int64 `json:"sum_rows_read"`
SumRowsAffected int64 `json:"sum_rows_affected"`
SumRowsReturned int64 `json:"sum_rows_returned"`
RowsReadPerReturned float64 `json:"rows_read_per_returned"`
RowsReadPerQuery float64 `json:"rows_read_per_query"`
RowsReturnedPerQuery float64 `json:"rows_returned_per_query"`
RowsAffectedPerQuery float64 `json:"rows_affected_per_query"`
SumTotalDurationMillis float64 `json:"sum_total_duration_millis"`
SumTotalDurationPercent float64 `json:"sum_total_duration_percent"`
SumCPUDurationMillis float64 `json:"sum_cpu_duration_millis"`
SumCPUDurationPercent float64 `json:"sum_cpu_duration_percent"`
SumIODurationMillis float64 `json:"sum_io_duration_millis"`
SumIODurationPercent float64 `json:"sum_io_duration_percent"`
LastRunAt *time.Time `json:"last_run_at"`
TimePerQuery float64 `json:"time_per_query"`
P50Latency float64 `json:"p50_latency"`
P99Latency float64 `json:"p99_latency"`
MaxLatency float64 `json:"max_latency"`
EgressBytes int64 `json:"egress_bytes"`
EgressBytesPerQuery float64 `json:"egress_bytes_per_query"`
MaxEgressBytes int64 `json:"max_egress_bytes"`
IngressBytes int64 `json:"ingress_bytes"`
IngressBytesPerQuery float64 `json:"ingress_bytes_per_query"`
MaxIngressBytes int64 `json:"max_ingress_bytes"`
BlocksRead int64 `json:"blocks_read"`
BlocksHit int64 `json:"blocks_hit"`
BlockCacheHitRatio float64 `json:"block_cache_hit_ratio"`
BlocksDirtied int64 `json:"blocks_dirtied"`
BlocksWritten int64 `json:"blocks_written"`
TrafficControlWarnings int64 `json:"traffic_control_warnings"`
TrafficControlThrottled int64 `json:"traffic_control_throttled"`
TrafficControlChecked int64 `json:"traffic_control_checked"`
}
type QueryTag ¶ added in v0.315.0
type QueryTag struct {
ID string `json:"id"`
Name string `json:"name"`
Source string `json:"source"`
QueryCount int64 `json:"query_count"`
Values []QueryTagValue `json:"values"`
}
QueryTag is a tag key observed on branch queries (sqlcommenter / system). ID is the dimension key used by the API (e.g. "Sapp", "Busername"). Name is the friendly key users see in the app (e.g. "app", "username"). Source is "sql" or "system".
type QueryTagValue ¶ added in v0.315.0
type QueryTagValue struct {
Name string `json:"name"`
QueryCount int64 `json:"query_count"`
Kind string `json:"kind"`
}
QueryTagValue is one observed value for a tag key.
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 ReadOnlyRegion ¶ added in v0.312.0
type ReadOnlyRegion struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Ready bool `json:"ready"`
ReadyAt time.Time `json:"ready_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Actor *Actor `json:"actor"`
Region Region `json:"region"`
}
ReadOnlyRegion represents a Vitess read-only region for a database's default branch.
func FindReadOnlyRegion ¶ added in v0.312.0
func FindReadOnlyRegion(regions []*ReadOnlyRegion, name string) (*ReadOnlyRegion, error)
FindReadOnlyRegion matches a read-only region by public id, region slug, or display name.
type ReadOnlyRegionKeyspace ¶ added in v0.312.0
type ReadOnlyRegionKeyspaceConfig ¶ added in v0.313.0
type ReadOnlyRegionsService ¶ added in v0.312.0
type ReadOnlyRegionsService interface {
List(ctx context.Context, req *ListReadOnlyRegionsRequest, opts ...ListOption) ([]*ReadOnlyRegion, error)
}
ReadOnlyRegionsService lists read-only regions for a database.
type ReassignPostgresRoleObjectsRequest ¶
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 ¶
type Region struct {
ID string `json:"id"`
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"`
PublicIPAddresses []string `json:"public_ip_addresses"`
MySQLSupported bool `json:"mysql_supported"`
PostgreSQLSupported bool `json:"postgresql_supported"`
}
type RegionsService ¶
type RegionsService interface {
List(ctx context.Context, req *ListRegionsRequest) ([]*Region, error)
}
type RemoveOrganizationMemberRequest ¶ added in v0.323.0
type RemoveOrganizationTeamMemberRequest ¶ added in v0.327.0
type RenewDatabaseBranchPasswordRequest ¶
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 ¶
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 ¶
type ReplicationDurabilityConstraints struct {
Strategy string `json:"strategy"`
}
type RequestOption ¶
type RequestOption func(*requestOptions)
RequestOption allows for customizing HTTP requests
func WithQueryParams ¶
func WithQueryParams(params url.Values) RequestOption
WithQueryParams sets query parameters for the request
type ResetDefaultRoleRequest ¶
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 ¶
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 ResizeBranchRequest ¶ added in v0.310.0
type ResizeBranchRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
VTGateSize string `json:"vtgate_size,omitempty"`
VTGateCount *int `json:"vtgate_count,omitempty"`
VTGateMaxCount *int `json:"vtgate_max_count,omitempty"`
VTGateAutoscaling *bool `json:"vtgate_autoscaling,omitempty"`
VTGateTargetCPUUtilization *int `json:"vtgate_target_cpu_utilization,omitempty"`
}
ResizeBranchRequest encapsulates a request to resize a branch's VTGates.
type ResizeKeyspaceRequest ¶
type ResizePostgresBouncerRequest ¶ added in v0.314.0
type ResizePostgresBouncerRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
Bouncer string `json:"-"`
BouncerSize string `json:"bouncer_size,omitempty"`
ReplicasPerCell *int `json:"replicas_per_cell,omitempty"`
Target string `json:"target,omitempty"`
Parameters map[string]map[string]string `json:"parameters,omitempty"`
}
ResizePostgresBouncerRequest upserts a resize request for a bouncer.
type ResizePostgresBranchRequest ¶
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"`
// Parameters holds configuration parameter values nested by namespace,
// e.g. {"pgconf": {"max_connections": "200"}}. Use the values returned by
// ListParameters. Nil leaves parameters unchanged.
Parameters map[string]map[string]string `json:"parameters,omitempty"`
}
ResizePostgresBranchRequest encapsulates the request to change a Postgres branch's cluster: its size, replica count, and/or configuration parameters. All change kinds are upserted into a single asynchronous change request via the branch changes API.
type RetryWorkflowRequest ¶
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 ¶
type RunBranchMaintenanceRequest ¶ added in v0.323.0
type RunBranchMaintenanceRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
// UpdatePostgresMinorVersion upgrades the branch to the latest PostgreSQL
// minor version as part of the maintenance run.
UpdatePostgresMinorVersion bool `json:"update_postgres_minor_version,omitempty"`
}
RunBranchMaintenanceRequest encapsulates the request for running maintenance on a branch.
type SSOPortal ¶ added in v0.328.0
type SSOPortal struct {
PortalURL string `json:"portal_url"`
}
SSOPortal is a URL for verifying a domain or configuring SSO.
type SchemaLintError ¶
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 ¶
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 ¶
type SchemaRecommendationService interface {
List(context.Context, *ListSchemaRecommendationsRequest, ...ListOption) ([]*SchemaRecommendation, error)
Get(context.Context, *GetSchemaRecommendationRequest) (*SchemaRecommendation, error)
Dismiss(context.Context, *DismissSchemaRecommendationRequest) (*SchemaRecommendation, error)
}
SchemaRecommendationService is an interface for communicating with the PlanetScale Schema recommendation API.
type ServiceToken ¶
type ServiceTokenAccess ¶
type ServiceTokenAccess struct {
ID string `json:"id"`
Access string `json:"access"`
Type string `json:"type"`
Resource ServiceTokenResource `json:"resource"`
}
type ServiceTokenGrant ¶
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 ¶
type ServiceTokenResource ¶
type ServiceTokenService ¶
type ServiceTokenService interface {
Create(context.Context, *CreateServiceTokenRequest) (*ServiceToken, error)
Get(context.Context, *GetServiceTokenRequest) (*ServiceToken, error)
List(context.Context, *ListServiceTokensRequest) ([]*ServiceToken, error)
ListGrants(context.Context, *ListServiceTokenGrantsRequest) ([]*ServiceTokenGrant, error)
Delete(context.Context, *DeleteServiceTokenRequest) error
GetAccess(context.Context, *GetServiceTokenAccessRequest) ([]*ServiceTokenAccess, error)
AddAccess(context.Context, *AddServiceTokenAccessRequest) ([]*ServiceTokenAccess, error)
DeleteAccess(context.Context, *DeleteServiceTokenAccessRequest) error
}
ServiceTokenService is an interface for communicating with the PlanetScale Service Token API.
type ShardRollout ¶
type StartDataImportRequest ¶
type StorageConfig ¶
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 Tablet ¶
type Tablet struct {
Alias string `json:"alias"`
Role string `json:"role"`
Cell string `json:"cell"`
}
Tablet represents an individual vttablet.
type TabletGroup ¶
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 TagSummary ¶ added in v0.315.0
type TagSummary struct {
Dimensions map[string]string `json:"dimensions"`
QueryCount int64 `json:"query_count"`
ErrorCount int64 `json:"error_count"`
Tables []string `json:"tables"`
SumRowsRead int64 `json:"sum_rows_read"`
SumRowsReturned int64 `json:"sum_rows_returned"`
SumRowsAffected int64 `json:"sum_rows_affected"`
RowsReadPerReturned float64 `json:"rows_read_per_returned"`
SumTotalDurationMillis float64 `json:"sum_total_duration_millis"`
SumTotalDurationPct float64 `json:"sum_total_duration_percent"`
SumCPUDurationMillis float64 `json:"sum_cpu_duration_millis"`
SumIODurationMillis float64 `json:"sum_io_duration_millis"`
LastRunAt string `json:"last_run_at"`
TimePerQuery float64 `json:"time_per_query"`
P50Latency float64 `json:"p50_latency"`
P99Latency float64 `json:"p99_latency"`
MaxLatency float64 `json:"max_latency"`
}
TagSummary is query statistics grouped by one or more tag dimensions.
type TestDataImportSourceRequest ¶
type TestDataImportSourceRequest struct {
Organization string `json:"organization"`
Database string `json:"database_name"`
Connection DataImportSource `json:"connection"`
}
type TestDataImportSourceResponse ¶
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 ¶
type TestWebhookRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
ID string `json:"-"`
}
TestWebhookRequest is the request for testing a webhook.
type ThrottlerConfigurable ¶ added in v0.317.0
type ThrottlerConfigurable struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at"`
}
ThrottlerConfigurable identifies the resource owning throttler config.
type ThrottlerConfiguration ¶ added in v0.317.0
type ThrottlerConfiguration struct {
KeyspaceName string `json:"keyspace_name"`
Ratio float64 `json:"ratio"`
}
ThrottlerConfiguration is a per-keyspace throttler ratio.
type TimeSeries ¶ added in v0.321.0
type TimeSeries struct {
Type string `json:"type"`
Metric string `json:"metric"`
Label string `json:"label"`
Labels map[string]string `json:"labels"`
Points [][]float64 `json:"points"`
}
TimeSeries contains samples for one metric and set of dimensions.
type TrafficBudget ¶
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 ¶
type TrafficBudgetsService interface {
List(context.Context, *ListTrafficBudgetsRequest) ([]*TrafficBudget, error)
Get(context.Context, *GetTrafficBudgetRequest) (*TrafficBudget, error)
Create(context.Context, *CreateTrafficBudgetRequest) (*TrafficBudget, error)
Update(context.Context, *UpdateTrafficBudgetRequest) (*TrafficBudget, error)
Delete(context.Context, *DeleteTrafficBudgetRequest) error
}
TrafficBudgetsService communicates with the PlanetScale traffic budgets API.
type TrafficRule ¶
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 ¶
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 ¶
type TrafficRulesService interface {
Create(context.Context, *CreateTrafficRuleRequest) (*TrafficRule, error)
Delete(context.Context, *DeleteTrafficRuleRequest) error
}
TrafficRulesService communicates with the PlanetScale traffic rules API.
type UnblockDeployRequestRequest ¶ added in v0.322.0
type UnblockDeployRequestRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Number uint64 `json:"-"`
}
UnblockDeployRequestRequest unblocks the deploy queue after a failed deploy or revert (complete_error / complete_revert_error).
type UpdateBackupPolicyRequest ¶ added in v0.313.0
type UpdateBackupPolicyRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Policy string `json:"-"`
Name *string `json:"name,omitempty"`
Target *string `json:"target,omitempty"`
RetentionValue *int `json:"retention_value,omitempty"`
RetentionUnit *string `json:"retention_unit,omitempty"`
FrequencyValue *int `json:"frequency_value,omitempty"`
FrequencyUnit *string `json:"frequency_unit,omitempty"`
ScheduleTime *string `json:"schedule_time,omitempty"`
ScheduleDay *int `json:"schedule_day,omitempty"`
ScheduleWeek *int `json:"schedule_week,omitempty"`
}
UpdateBackupPolicyRequest encapsulates updating a backup policy.
type UpdateBackupRequest ¶ added in v0.327.0
type UpdateBackupRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
Backup string `json:"-"`
Protected bool `json:"protected"`
}
func (*UpdateBackupRequest) MarshalJSON ¶ added in v0.327.0
func (r *UpdateBackupRequest) MarshalJSON() ([]byte, error)
MarshalJSON encodes protected as a string because the API ignores a JSON false, which would silently leave the backup protected.
type UpdateDatabaseBranchPasswordRequest ¶ added in v0.323.0
type UpdateDatabaseBranchPasswordRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
PasswordId string `json:"-"`
// Name renames the password when set.
Name string `json:"name,omitempty"`
// CIDRs replaces the IP restrictions when set. A pointer to an empty slice
// clears them.
CIDRs *[]string `json:"cidrs,omitempty"`
}
UpdateDatabaseBranchPasswordRequest encapsulates the request for updating a password's name or IP restrictions.
type UpdateDatabaseBranchRequest ¶ added in v0.322.0
type UpdateDatabaseBranchRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
NewName string `json:"new_name,omitempty"`
DeletionProtected *bool `json:"deletion_protected,omitempty"`
}
UpdateDatabaseBranchRequest encapsulates the request for updating a database branch's settings.
type UpdateDatabaseSettingsRequest ¶ added in v0.313.0
type UpdateDatabaseSettingsRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
NewName *string `json:"new_name,omitempty"`
AutomaticMigrations *bool `json:"automatic_migrations,omitempty"`
MigrationFramework *string `json:"migration_framework,omitempty"`
MigrationTableName *string `json:"migration_table_name,omitempty"`
RequireApprovalForDeploy *bool `json:"require_approval_for_deploy,omitempty"`
RestrictBranchRegion *bool `json:"restrict_branch_region,omitempty"`
AllowDataBranching *bool `json:"allow_data_branching,omitempty"`
AllowForeignKeyConstraints *bool `json:"allow_foreign_key_constraints,omitempty"`
InsightsRawQueries *bool `json:"insights_raw_queries,omitempty"`
ProductionBranchWebConsole *bool `json:"production_branch_web_console,omitempty"`
DefaultBranch *string `json:"default_branch,omitempty"`
}
UpdateDatabaseSettingsRequest encapsulates the request for updating database settings.
type UpdateDatabaseThrottlerRequest ¶ added in v0.320.0
type UpdateDatabaseThrottlerRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Ratio *int `json:"ratio,omitempty"`
Configurations []*UpdateThrottlerConfiguration `json:"configurations,omitempty"`
}
UpdateDatabaseThrottlerRequest updates the database-level Vitess migration throttler.
type UpdateDeployRequestThrottlerRequest ¶ added in v0.317.0
type UpdateDeployRequestThrottlerRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Number uint64 `json:"-"`
Ratio *int `json:"ratio,omitempty"`
Configurations []*UpdateThrottlerConfiguration `json:"configurations,omitempty"`
}
UpdateDeployRequestThrottlerRequest updates throttler config for a deploy request.
type UpdateKeyspaceSettingsRequest ¶
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"`
DiskAutoscaling *DiskAutoscalingUpdate `json:"disk_autoscaling,omitempty"`
}
type UpdateOrganizationMemberRequest ¶ added in v0.323.0
type UpdateOrganizationRequest ¶ added in v0.327.0
type UpdateOrganizationRequest struct {
Organization string `json:"-"`
BillingEmail *string `json:"billing_email,omitempty"`
IDPManagedRoles *bool `json:"idp_managed_roles,omitempty"`
IDPSSOManagedRoles *bool `json:"idp_sso_managed_roles,omitempty"`
InvoiceBudgetAlerts *bool `json:"invoice_budget_alerts,omitempty"`
InvoiceBudgetAmount *int64 `json:"invoice_budget_amount,omitempty"`
}
func (*UpdateOrganizationRequest) MarshalJSON ¶ added in v0.327.0
func (r *UpdateOrganizationRequest) MarshalJSON() ([]byte, error)
type UpdateOrganizationTeamRequest ¶ added in v0.327.0
type UpdatePostgresBranchRequest ¶ added in v0.322.0
type UpdatePostgresBranchRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
NewName string `json:"new_name,omitempty"`
DeletionProtected *bool `json:"deletion_protected,omitempty"`
}
UpdatePostgresBranchRequest encapsulates the request for updating a Postgres branch's settings.
type UpdatePostgresCIDRRequest ¶ added in v0.313.0
type UpdatePostgresCIDRRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
ID string `json:"-"`
Schema *string `json:"schema,omitempty"`
Role *string `json:"role,omitempty"`
CIDRs []string `json:"cidrs,omitempty"`
Description *string `json:"description,omitempty"`
}
UpdatePostgresCIDRRequest encapsulates updating an IP restriction entry. Only set fields are sent. Pass an empty string for Description to clear it.
type UpdatePostgresReadOnlyReplicaRequest ¶ added in v0.329.0
type UpdatePostgresReadOnlyReplicaRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
Replica string `json:"-"`
Replicas *int `json:"replicas,omitempty"`
ClusterSize string `json:"cluster_size,omitempty"`
Parameters map[string]map[string]string `json:"parameters,omitempty"`
}
UpdatePostgresReadOnlyReplicaRequest encapsulates updating a read-only replica.
type UpdatePostgresRoleRequest ¶
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 UpdateReadOnlyRegionsRequest ¶ added in v0.313.0
type UpdateReadOnlyRegionsRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
Branch string `json:"-"`
Keyspace string `json:"-"`
ReadOnlyRegions []*ReadOnlyRegionKeyspaceConfig `json:"read_only_regions"`
}
type UpdateThrottlerConfiguration ¶ added in v0.317.0
type UpdateThrottlerConfiguration struct {
KeyspaceName string `json:"keyspace_name"`
Ratio int `json:"ratio"`
}
UpdateThrottlerConfiguration is a per-keyspace throttler ratio for updates.
type UpdateTrafficBudgetRequest ¶
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 ¶
type UpdateWebhookRequest struct {
Organization string `json:"-"`
Database string `json:"-"`
ID string `json:"-"`
URL *string `json:"url,omitempty"`
AuthorizationHeader *string `json:"authorization_header,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Events []string `json:"events,omitempty"`
}
UpdateWebhookRequest is the request for updating a webhook.
type UserShouldUpgradePlanError ¶
type UserShouldUpgradePlanError struct{}
func (UserShouldUpgradePlanError) Error ¶
func (e UserShouldUpgradePlanError) Error() string
type VDiffCreateRequest ¶
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 ¶
type VDiffListRequest ¶
type VDiffResumeRequest ¶
type VDiffService ¶
type VDiffService interface {
Create(context.Context, *VDiffCreateRequest) (json.RawMessage, error)
List(context.Context, *VDiffListRequest) (json.RawMessage, error)
Show(context.Context, *VDiffShowRequest) (json.RawMessage, error)
Stop(context.Context, *VDiffStopRequest) (json.RawMessage, error)
Resume(context.Context, *VDiffResumeRequest) (json.RawMessage, error)
Delete(context.Context, *VDiffDeleteRequest) (json.RawMessage, error)
}
VDiffService is an interface for interacting with the VDiff endpoints of the PlanetScale API.
type VDiffShowRequest ¶
type VDiffStopRequest ¶
type VReplicationFlags ¶
type VitessBranchInfrastructure ¶
type VitessBranchInfrastructure struct {
Ready bool `json:"ready"`
Pods []*BranchInfraPod `json:"pods"`
}
VitessBranchInfrastructure represents the infrastructure (pods) for a Vitess branch.
type VtctldApplyKeyspaceRoutingRulesRequest ¶ added in v0.316.0
type VtctldCheckThrottlerRequest ¶
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 VtctldGetKeyspaceRoutingRulesRequest ¶ added in v0.316.0
type VtctldGetRoutingRulesRequest ¶
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 ¶
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 ¶
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 VtctldKeyspaceRoutingRule ¶ added in v0.316.0
type VtctldKeyspaceRoutingRules ¶ added in v0.316.0
type VtctldKeyspaceRoutingRules struct {
Rules []VtctldKeyspaceRoutingRule `json:"rules"`
}
type VtctldOperation ¶
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 ¶
type VtctldOperationReference struct {
ID string `json:"id"`
}
VtctldOperationReference identifies an accepted vtctld operation that can be polled later.
type VtctldRefreshStateByShardRequest ¶
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 VtctldService ¶
type VtctldService interface {
ListWorkflows(context.Context, *VtctldListWorkflowsRequest) (json.RawMessage, error)
ListKeyspaces(context.Context, *VtctldListKeyspacesRequest) (json.RawMessage, error)
GetRoutingRules(context.Context, *VtctldGetRoutingRulesRequest) (json.RawMessage, error)
GetKeyspaceRoutingRules(context.Context, *VtctldGetKeyspaceRoutingRulesRequest) (json.RawMessage, error)
ApplyKeyspaceRoutingRules(context.Context, *VtctldApplyKeyspaceRoutingRulesRequest) (json.RawMessage, error)
GetShard(context.Context, *VtctldGetShardRequest) (json.RawMessage, error)
SetShardTabletControl(context.Context, *VtctldSetShardTabletControlRequest) (json.RawMessage, error)
RefreshStateByShard(context.Context, *VtctldRefreshStateByShardRequest) (json.RawMessage, error)
ListTablets(context.Context, *ListBranchTabletsRequest) ([]*TabletGroup, error)
StartWorkflow(context.Context, *VtctldStartWorkflowRequest) (json.RawMessage, error)
StopWorkflow(context.Context, *VtctldStopWorkflowRequest) (json.RawMessage, error)
GetThrottlerStatus(context.Context, *VtctldGetThrottlerStatusRequest) (json.RawMessage, error)
CheckThrottler(context.Context, *VtctldCheckThrottlerRequest) (json.RawMessage, error)
UpdateThrottlerConfig(context.Context, *VtctldUpdateThrottlerConfigRequest) (json.RawMessage, error)
GetOperation(context.Context, *GetVtctldOperationRequest) (*VtctldOperation, error)
}
VtctldService is an interface for interacting with the general vtctld endpoints of the PlanetScale API.
type VtctldSetShardTabletControlRequest ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.
// Omit to leave the enable state unchanged.
Enabled *bool `json:"enabled,omitempty"`
// Threshold is the threshold for the default throttler check (replication
// lag in seconds). It must be >= 0. Omit to leave the existing threshold
// unchanged.
Threshold *float64 `json:"threshold,omitempty"`
// Apps configures zero or more per-app throttling rules.
Apps []VtctldThrottledAppConfig `json:"apps,omitempty"`
// UnthrottleApps names apps whose throttled-app rules should be removed.
UnthrottleApps []string `json:"unthrottle_apps,omitempty"`
// AppCheckedMetrics assigns metrics to check per app name
// (e.g. {"rowstreamer": ["lag", "loadavg"]}).
AppCheckedMetrics map[string][]string `json:"app_checked_metrics,omitempty"`
}
VtctldUpdateThrottlerConfigRequest is a request for updating the tablet throttler configuration for a keyspace.
type Webhook ¶
type Webhook struct {
ID string `json:"id"`
URL string `json:"url"`
Secret string `json:"secret"`
AuthorizationHeaderConfigured bool `json:"authorization_header_configured"`
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 ¶
type WebhooksService interface {
List(context.Context, *ListWebhooksRequest, ...ListOption) ([]*Webhook, error)
Create(context.Context, *CreateWebhookRequest) (*Webhook, error)
Get(context.Context, *GetWebhookRequest) (*Webhook, error)
Update(context.Context, *UpdateWebhookRequest) (*Webhook, error)
Delete(context.Context, *DeleteWebhookRequest) error
Test(context.Context, *TestWebhookRequest) error
}
WebhooksService is an interface for communicating with the PlanetScale Webhooks API.
type Workflow ¶
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 ¶
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 ¶
type WorkflowTable ¶
type WorkflowVDiff ¶
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 ¶
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 ¶
type WorkflowsService interface {
List(context.Context, *ListWorkflowsRequest) ([]*Workflow, error)
Get(context.Context, *GetWorkflowRequest) (*Workflow, error)
Create(context.Context, *CreateWorkflowRequest) (*Workflow, error)
VerifyData(context.Context, *VerifyDataWorkflowRequest) (*Workflow, error)
SwitchReplicas(context.Context, *SwitchReplicasWorkflowRequest) (*Workflow, error)
SwitchPrimaries(context.Context, *SwitchPrimariesWorkflowRequest) (*Workflow, error)
ReverseTraffic(context.Context, *ReverseTrafficWorkflowRequest) (*Workflow, error)
Cutover(context.Context, *CutoverWorkflowRequest) (*Workflow, error)
ReverseCutover(context.Context, *ReverseCutoverWorkflowRequest) (*Workflow, error)
Complete(context.Context, *CompleteWorkflowRequest) (*Workflow, error)
Retry(context.Context, *RetryWorkflowRequest) (*Workflow, error)
Cancel(context.Context, *CancelWorkflowRequest) (*Workflow, error)
}
WorkflowsService is an interface for interacting with the workflow endpoints of the PlanetScale API
Source Files
¶
- audit_logs.go
- auth_attempt_exports.go
- backup_policies.go
- backups.go
- billing_payment_method_setups.go
- billing_payment_methods.go
- branch_infrastructure.go
- branch_maintenance.go
- branch_resizes.go
- branches.go
- client.go
- d1_import_notifications.go
- databases.go
- deploy_requests.go
- doc.go
- imports.go
- insights.go
- insights_tags.go
- invoices.go
- keyspaces.go
- maintenance_schedules.go
- metrics.go
- organization_members.go
- organization_sso.go
- organization_teams.go
- organizations.go
- passwords.go
- postgres_bouncer_resizes.go
- postgres_bouncers.go
- postgres_branches.go
- postgres_cidrs.go
- postgres_read_only_replicas.go
- postgres_roles.go
- postgres_switchovers.go
- processlist.go
- query_patterns.go
- read_only_regions.go
- regions.go
- schema_recommendations.go
- service_tokens.go
- signed_download.go
- traffic_budgets.go
- traffic_rules.go
- vtctld.go
- vtctld_general.go
- vtctld_lookup_vindex.go
- vtctld_materialize.go
- vtctld_move_tables.go
- vtctld_operations.go
- vtctld_planned_reparent.go
- vtctld_tablets.go
- vtctld_vdiff.go
- webhooks.go
- workflows.go