Documentation ¶
Index ¶
- Constants
- func NewAuditLogsService(client *Client) *auditlogsService
- func NewBackupsService(client *Client) *backupsService
- func NewCertificatesService(client *Client) *certificatesService
- func NewDatabaseBranchesService(client *Client) *databaseBranchesService
- func NewDatabasesService(client *Client) *databasesService
- func NewDeployRequestsService(client *Client) *deployRequestsService
- func NewOrganizationsService(client *Client) *organizationsService
- func NewPasswordsService(client *Client) *passwordsService
- func NewRegionsSevice(client *Client) *regionsService
- type Actor
- type AddServiceTokenAccessRequest
- type ApplyDeployRequestRequest
- type AuditLog
- type AuditLogEvent
- type AuditLogsService
- type AutoApplyDeployRequestRequest
- type Backup
- type BackupsService
- type BillingPlan
- type BranchKeyspacesRequest
- type BranchRoutingRulesRequest
- type BranchSchemaRequest
- type BranchVSchemaRequest
- type CancelDataImportRequest
- type CancelDeployRequestRequest
- type CertificatesService
- 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 ClusterSize
- type CreateBackupRequest
- type CreateDatabaseBranchRequest
- type CreateDatabaseRequest
- type CreateDeployRequestRequest
- type CreateServiceTokenRequest
- type CursorPaginatedResponse
- type DataImport
- type DataImportSource
- type DataImportState
- type DataImportsService
- type DataSourceIncompatibilityError
- type Database
- type DatabaseBranch
- type DatabaseBranchCertificate
- type DatabaseBranchCertificateRequest
- type DatabaseBranchPassword
- type DatabaseBranchPasswordRequest
- type DatabaseBranchesService
- type DatabaseDeletionRequest
- type DatabaseState
- type DatabasesService
- type DeleteBackupRequest
- type DeleteDatabaseBranchPasswordRequest
- type DeleteDatabaseBranchRequest
- type DeleteDatabaseRequest
- type DeleteServiceTokenAccessRequest
- type DeleteServiceTokenRequest
- type DemoteRequest
- type DeployOperation
- type DeployRequest
- type DeployRequestReview
- type DeployRequestsService
- type Deployment
- type DeploymentLintError
- type DetachExternalDatabaseRequest
- type Diff
- type DiffBranchRequest
- type DiffRequest
- type DisableSafeMigrationsRequest
- type EnableSafeMigrationsRequest
- type Error
- type ErrorCode
- type ExternalDataSourceSSLVerificationMode
- type GetBackupRequest
- type GetDatabaseBranchCertificateRequest
- type GetDatabaseBranchPasswordRequest
- type GetDatabaseBranchRequest
- type GetDatabaseRequest
- type GetDeployRequestRequest
- type GetImportStatusRequest
- type GetOrganizationRequest
- type GetServiceTokenAccessRequest
- type Keyspace
- type LintSchemaRequest
- type ListAuditLogsRequest
- type ListBackupsRequest
- type ListDatabaseBranchCertificateRequest
- type ListDatabaseBranchPasswordRequest
- type ListDatabaseBranchesRequest
- type ListDatabasesRequest
- type ListDeployRequestsRequest
- type ListOption
- type ListOptions
- type ListOrganizationRegionsRequest
- type ListRegionsRequest
- type ListServiceTokenGrantsRequest
- type ListServiceTokensRequest
- type MakePlanetScalePrimaryRequest
- type MakePlanetScaleReplicaRequest
- type Organization
- type OrganizationsService
- type PasswordsService
- type PerformDeployRequest
- type Plan
- type PromoteRequest
- type QueuedDeployment
- type RefreshSchemaRequest
- type Region
- type RegionsService
- type RenewDatabaseBranchPasswordRequest
- type RevertDeployRequestRequest
- type ReviewAction
- type ReviewDeployRequestRequest
- type RoutingRules
- type SchemaLintError
- type ServiceToken
- type ServiceTokenAccess
- type ServiceTokenGrant
- type ServiceTokenGrantAccess
- type ServiceTokenResource
- type ServiceTokenService
- type SkipRevertDeployRequestRequest
- type StartDataImportRequest
- type TestDataImportSourceRequest
- type TestDataImportSourceResponse
- type UpdateBranchRoutingRulesRequest
- type UpdateBranchVschemaRequest
- type UserShouldUpgradePlanError
- type VSchema
Constants ¶
const (
DefaultBaseURL = "https://api.planetscale.com/"
)
Variables ¶
This section is empty.
Functions ¶
func NewAuditLogsService ¶ added in v0.35.0
func NewAuditLogsService(client *Client) *auditlogsService
func NewBackupsService ¶
func NewBackupsService(client *Client) *backupsService
func NewCertificatesService ¶ added in v0.51.0
func NewCertificatesService(client *Client) *certificatesService
func NewDatabaseBranchesService ¶
func NewDatabaseBranchesService(client *Client) *databaseBranchesService
func NewDatabasesService ¶
func NewDatabasesService(client *Client) *databasesService
func NewDeployRequestsService ¶
func NewDeployRequestsService(client *Client) *deployRequestsService
func NewOrganizationsService ¶
func NewOrganizationsService(client *Client) *organizationsService
func NewPasswordsService ¶ added in v0.40.0
func NewPasswordsService(client *Client) *passwordsService
func NewRegionsSevice ¶ added in v0.29.0
func NewRegionsSevice(client *Client) *regionsService
Types ¶
type Actor ¶ added in v0.83.0
type Actor struct { Type string `json:"type"` ID string `json:"id"` Name string `json:"display_name"` }
Actor represents a user or service token
type ApplyDeployRequestRequest ¶ added in v0.71.0
type AuditLog ¶ added in v0.35.0
type AuditLog struct { ID string `json:"id"` Type string `json:"type"` ActorID string `json:"actor_id"` ActorType string `json:"actor_type"` ActorDisplayName string `json:"actor_display_name"` AuditableID string `json:"auditable_id"` AuditableType string `json:"auditable_type"` AuditableDisplayName string `json:"auditable_display_name"` AuditAction string `json:"audit_action"` Action string `json:"action"` Location string `json:"location"` RemoteIP string `json:"remote_ip"` TargetID string `json:"target_id"` TargetType string `json:"target_type"` TargetDisplayName string `json:"target_display_name"` Metadata map[string]interface{} `json:"metadata"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
AuditLog represents a PlanetScale audit log.
type AuditLogEvent ¶ added in v0.35.0
type AuditLogEvent string
AuditLogEvent represents an audit log's event type
const ( AuditLogEventBranchCreated AuditLogEvent = "branch.created" AuditLogEventBranchDeleted AuditLogEvent = "branch.deleted" AuditLogEventDatabaseCreated AuditLogEvent = "database.created" AuditLogEventDatabaseDeleted AuditLogEvent = "database.deleted" AuditLogEventDeployRequestApproved AuditLogEvent = "deploy_request.approved" AuditLogEventDeployRequestClosed AuditLogEvent = "deploy_request.closed" AuditLogEventDeployRequestCreated AuditLogEvent = "deploy_request.created" AuditLogEventDeployRequestDeleted AuditLogEvent = "deploy_request.deleted" AuditLogEventDeployRequestQueued AuditLogEvent = "deploy_request.queued" AuditLogEventDeployRequestUnqueued AuditLogEvent = "deploy_request.unqueued" AuditLogEventIntegrationCreated AuditLogEvent = "integration.created" AuditLogEventIntegrationDeleted AuditLogEvent = "integration.deleted" AuditLogEventOrganizationInvitationCreated AuditLogEvent = "organization_invitation.created" AuditLogEventOrganizationInvitationDeleted AuditLogEvent = "organization_invitation.deleted" AuditLogEventOrganizationMembershipCreated AuditLogEvent = "organization_membership.created" AuditLogEventOrganizationJoined AuditLogEvent = "organization.joined" AuditLogEventOrganizationRemovedMember AuditLogEvent = "organization.removed_member" AuditLogEventOrganizationDisabledSSO AuditLogEvent = "organization.disabled_sso" AuditLogEventOrganizationEnabledSSO AuditLogEvent = "organization.enabled_sso" AuditLogEventOrganizationUpdatedRole AuditLogEvent = "organization.updated_role" AuditLogEventServiceTokenCreated AuditLogEvent = "service_token.created" AuditLogEventServiceTokenDeleted AuditLogEvent = "service_token.deleted" AuditLogEventServiceTokenGrantedAccess AuditLogEvent = "service_token.granted_access" )
type AuditLogsService ¶ added in v0.35.0
type AuditLogsService interface {
List(context.Context, *ListAuditLogsRequest, ...ListOption) (*CursorPaginatedResponse[*AuditLog], error)
}
AuditLogsService is an interface for communicating with the PlanetScale AuditLogs API endpoints.
type AutoApplyDeployRequestRequest ¶ added in v0.71.0
type Backup ¶
type Backup struct { PublicID string `json:"id"` Name string `json:"name"` State string `json:"state"` Size int64 `json:"size"` Actor *Actor `json:"actor"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` StartedAt time.Time `json:"started_at"` ExpiresAt time.Time `json:"expires_at"` CompletedAt time.Time `json:"completed_at"` }
type BackupsService ¶
type BackupsService interface { Create(context.Context, *CreateBackupRequest) (*Backup, error) List(context.Context, *ListBackupsRequest) ([]*Backup, error) Get(context.Context, *GetBackupRequest) (*Backup, error) Delete(context.Context, *DeleteBackupRequest) error }
BackupsService is an interface for communicating with the PlanetScale backup API endpoint.
type BillingPlan ¶ added in v0.62.0
type BillingPlan int
const ( HobbyPlan BillingPlan = iota ScalerProPlan )
func (BillingPlan) String ¶ added in v0.62.0
func (bp BillingPlan) String() string
type BranchKeyspacesRequest ¶ added in v0.68.0
type BranchRoutingRulesRequest ¶ added in v0.97.0
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 BranchVSchemaRequest ¶ added in v0.61.0
type BranchVSchemaRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` Keyspace string `json:"-"` }
BranchVSchemaRequest encapsulates a request for getting a branch's VSchema.
type CancelDataImportRequest ¶ added in v0.58.0
type CertificatesService ¶
type CertificatesService interface { Create(context.Context, *DatabaseBranchCertificateRequest) (*DatabaseBranchCertificate, error) List(context.Context, *ListDatabaseBranchCertificateRequest) ([]*DatabaseBranchCertificate, error) Get(context.Context, *GetDatabaseBranchCertificateRequest) (*DatabaseBranchCertificate, error) }
CertificatesService is an interface for communicating with the PlanetScale Database Branch Passwords API endpoint.
type Client ¶
type Client struct { // UserAgent is the version of the planetscale-go library that is being used UserAgent string AuditLogs AuditLogsService Backups BackupsService Databases DatabasesService DatabaseBranches DatabaseBranchesService DataImports DataImportsService Organizations OrganizationsService Passwords PasswordsService Certificates CertificatesService Regions RegionsService DeployRequests DeployRequestsService ServiceTokens ServiceTokenService // 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 ¶ added in v0.67.0
func WithRequestHeaders(headers map[string]string) ClientOption
WithRequestHeaders sets the request headers for every HTTP request.
func WithServiceToken ¶
func WithServiceToken(name, token string) ClientOption
WithServiceToken configures a client with the given PlanetScale Service Token
func WithUserAgent ¶ added in v0.67.0
func WithUserAgent(userAgent string) ClientOption
WithUserAgent overrides the User-Agent header.
type CloseRequest ¶
type CloseRequest struct {
State string `json:"state"`
}
type ClusterSize ¶ added in v0.88.0
type ClusterSize string
const ( PS10 ClusterSize = "PS_10" PS20 ClusterSize = "PS_20" PS40 ClusterSize = "PS_40" PS80 ClusterSize = "PS_80" PS160 ClusterSize = "PS_160" PS320 ClusterSize = "PS_320" PS400 ClusterSize = "PS_400" )
type CreateBackupRequest ¶
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"` }
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 ClusterSize `json:"cluster_size"` Plan Plan `json:"plan"` }
CreateDatabaseRequest encapsulates the request for creating a new database.
type CreateServiceTokenRequest ¶
type CreateServiceTokenRequest struct {
Organization string `json:"-"`
}
type CursorPaginatedResponse ¶ added in v0.66.0
type CursorPaginatedResponse[T any] struct { Data []T `json:"data"` HasNext bool `json:"has_next"` HasPrev bool `json:"has_prev"` // CursorStart is the ending cursor of the previous page. CursorStart *string `json:"cursor_start"` // CursorEnd is the starting cursor of the next page. CursorEnd *string `json:"cursor_end"` }
CursorPaginatedResponse provides a generic means of wrapping a paginated response.
type DataImport ¶ added in v0.58.0
type DataImport struct { ID string `json:"id"` ImportState DataImportState State string `json:"state"` Errors string `json:"import_check_errors"` StartedAt *time.Time `json:"started_at"` FinishedAt *time.Time `json:"finished_at"` DeletedAt *time.Time `json:"deleted_at"` ExternalDataSource DataImportSource `json:"data_source"` }
func (*DataImport) ParseState ¶ added in v0.58.0
func (di *DataImport) ParseState()
type DataImportSource ¶ added in v0.58.0
type DataImportSource struct { HostName string `json:"hostname"` Database string `json:"schema_name"` Port int `json:"port"` SSLMode string `json:"ssl_mode"` SSLVerificationMode ExternalDataSourceSSLVerificationMode UserName string `json:"username"` Password string `json:"password"` SSLCA string `json:"ssl_ca"` SSLCertificate string `json:"ssl_cert"` SSLKey string `json:"ssl_key"` SSLServerName string `json:"ssl_server_name"` }
type DataImportState ¶ added in v0.58.0
type DataImportState int
const ( DataImportPreparingDataCopy DataImportState = iota DataImportPreparingDataCopyFailed DataImportCopyingData DataImportCopyingDataFailed DataImportSwitchTrafficPending DataImportSwitchTrafficRunning DataImportSwitchTrafficCompleted DataImportSwitchTrafficError DataImportReverseTrafficRunning DataImportReverseTrafficCompleted DataImportReverseTrafficError DataImportDetachExternalDatabaseRunning DataImportDetachExternalDatabaseError DataImportReady )
func (DataImportState) String ¶ added in v0.58.0
func (d DataImportState) String() string
type DataImportsService ¶ added in v0.58.0
type DataImportsService interface { // TestDataImportSource checks if the external database that we're importing will be supported // by PlanetScale. It checks for ability to replicate binlogs, schema compatibility and other factors. TestDataImportSource(ctx context.Context, request *TestDataImportSourceRequest) (*TestDataImportSourceResponse, error) // StartDataImport spins up a downstream PlanetScale database in replica mode, with the // external database as a Primary and starts copying data from external to PlanetScale. StartDataImport(ctx context.Context, request *StartDataImportRequest) (*DataImport, error) // CancelDataImport halts all replication and data copy from external to PlanetScale // and deletes the PlanetScale database. CancelDataImport(ctx context.Context, request *CancelDataImportRequest) error // GetDataImportStatus gets the current status of a DataImport for a given database // Fails if the database is not importing any data. GetDataImportStatus(ctx context.Context, request *GetImportStatusRequest) (*DataImport, error) // MakePlanetScalePrimary makes the downstream PlanetScale database a Primary and the external database a Replica. MakePlanetScalePrimary(ctx context.Context, request *MakePlanetScalePrimaryRequest) (*DataImport, error) // MakePlanetScaleReplica makes the downstream PlanetScale database a Replica and the external database a Primary. MakePlanetScaleReplica(ctx context.Context, request *MakePlanetScaleReplicaRequest) (*DataImport, error) // DetachExternalDatabase detaches the external database from PlanetScale after a data import has finished // and PlanetScale is running as Primary. DetachExternalDatabase(ctx context.Context, request *DetachExternalDatabaseRequest) (*DataImport, error) }
DataImportsService is an interface for communicating with the PlanetScale Data Imports API endpoint.
type DataSourceIncompatibilityError ¶ added in v0.58.0
type DataSourceIncompatibilityError struct { LintError string `json:"lint_error"` Keyspace string `json:"keyspace_name"` Table string `json:"table_name"` SubjectType string `json:"subject_type"` ErrorDescription string `json:"error_description"` DocsUrl string `json:"docs_url"` }
DataSourceIncompatibilityError represents an error that occurs when the source schema in an external database server is incompatible with PlanetScale.
type Database ¶
type Database struct { Name string `json:"name"` Notes string `json:"notes"` Region Region `json:"region"` State DatabaseState `json:"state"` HtmlURL string `json:"html_url"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Database represents a PlanetScale database
type DatabaseBranch ¶
type DatabaseBranch struct { Name string `json:"name"` ParentBranch string `json:"parent_branch"` Actor Actor `json:"actor"` Region Region `json:"region"` Ready bool `json:"ready"` Production bool `json:"production"` HtmlURL string `json:"html_url"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` SafeMigrations bool `json:"safe_migrations"` }
DatabaseBranch represents a database branch.
type DatabaseBranchCertificate ¶ added in v0.51.0
type DatabaseBranchCertificate struct { PublicID string `json:"id"` Name string `json:"display_name"` Role string `json:"role"` Actor *Actor `json:"actor"` Branch DatabaseBranch `json:"database_branch"` Certificate string `json:"certificate"` CreatedAt time.Time `json:"created_at"` DeletedAt time.Time `json:"deleted_at"` }
func (*DatabaseBranchCertificate) X509KeyPair ¶ added in v0.51.0
func (c *DatabaseBranchCertificate) X509KeyPair(r *DatabaseBranchCertificateRequest) (tls.Certificate, error)
type DatabaseBranchCertificateRequest ¶ added in v0.51.0
type DatabaseBranchCertificateRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` DisplayName string `json:"display_name"` Role string `json:"role"` PrivateKey crypto.PrivateKey }
DatabaseBranchCertificateRequest encapsulates the request for creating/getting/deleting a database branch certificate.
type DatabaseBranchPassword ¶ added in v0.40.0
type DatabaseBranchPassword struct { PublicID string `json:"id"` Name string `json:"name"` Hostname string `json:"access_host_url"` Username string `json:"username"` Role string `json:"role"` Actor *Actor `json:"actor"` Branch DatabaseBranch `json:"database_branch"` CreatedAt time.Time `json:"created_at"` DeletedAt time.Time `json:"deleted_at"` ExpiresAt time.Time `json:"expires_at"` PlainText string `json:"plain_text"` TTL int `json:"ttl_seconds"` Renewable bool `json:"renewable"` Replica bool `json:"replica"` }
type DatabaseBranchPasswordRequest ¶ added in v0.40.0
type DatabaseBranchPasswordRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` Role string `json:"role,omitempty"` Name string `json:"name"` TTL int `json:"ttl,omitempty"` Replica bool `json:"replica,omitempty"` }
DatabaseBranchPasswordRequest encapsulates the request for creating/getting/deleting a database branch password.
type DatabaseBranchesService ¶
type DatabaseBranchesService interface { Create(context.Context, *CreateDatabaseBranchRequest) (*DatabaseBranch, error) List(context.Context, *ListDatabaseBranchesRequest) ([]*DatabaseBranch, error) Get(context.Context, *GetDatabaseBranchRequest) (*DatabaseBranch, error) Delete(context.Context, *DeleteDatabaseBranchRequest) error Diff(context.Context, *DiffBranchRequest) ([]*Diff, error) Schema(context.Context, *BranchSchemaRequest) ([]*Diff, error) VSchema(context.Context, *BranchVSchemaRequest) (*VSchema, error) UpdateVSchema(context.Context, *UpdateBranchVschemaRequest) (*VSchema, error) RoutingRules(context.Context, *BranchRoutingRulesRequest) (*RoutingRules, error) UpdateRoutingRules(context.Context, *UpdateBranchRoutingRulesRequest) (*RoutingRules, error) Keyspaces(context.Context, *BranchKeyspacesRequest) ([]*Keyspace, 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) }
DatabaseBranchesService is an interface for communicating with the PlanetScale Database Branch API endpoint.
type DatabaseDeletionRequest ¶ added in v0.65.0
DatabaseDeletionRequest encapsulates the request for deleting a database from an organization.
type DatabaseState ¶ added in v0.52.0
type DatabaseState string
DatabaseState represents the state of a database
const ( DatabasePending DatabaseState = "pending" DatabaseImporting DatabaseState = "importing" DatabaseAwakening DatabaseState = "awakening" DatabaseSleepInProgress DatabaseState = "sleep_in_progress" DatabaseSleeping DatabaseState = "sleeping" DatabaseReady DatabaseState = "ready" )
type DatabasesService ¶
type DatabasesService interface { Create(context.Context, *CreateDatabaseRequest) (*Database, error) Get(context.Context, *GetDatabaseRequest) (*Database, error) List(context.Context, *ListDatabasesRequest, ...ListOption) ([]*Database, error) Delete(context.Context, *DeleteDatabaseRequest) (*DatabaseDeletionRequest, error) }
DatabaseService is an interface for communicating with the PlanetScale Databases API endpoint.
type DeleteBackupRequest ¶
type DeleteDatabaseBranchPasswordRequest ¶ added in v0.40.0
type DeleteDatabaseBranchPasswordRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` Name string `json:"name"` PasswordId string }
DeleteDatabaseBranchPasswordRequest encapsulates the request for deleting a password for a given database branch.
type DeleteDatabaseBranchRequest ¶
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 DemoteRequest ¶ added in v0.83.0
type DemoteRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` }
DemoteRequest encapsulates the request for demoting a branch to development.
type DeployOperation ¶
type DeployOperation struct { ID string `json:"id"` State string `json:"state"` Table string `json:"table_name"` Keyspace string `json:"keyspace_name"` Operation string `json:"operation_name"` ETASeconds int64 `json:"eta_seconds"` ProgressPercentage uint64 `json:"progress_percentage"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
DeployOperation encapsulates a deploy operation within a deployment from the PlanetScale API.
type DeployRequest ¶
type DeployRequest struct { ID string `json:"id"` Branch string `json:"branch"` IntoBranch string `json:"into_branch"` Actor Actor `json:"actor"` ClosedBy *Actor `json:"closed_by"` BranchDeletedBy *Actor `json:"branch_deleted_by"` Number uint64 `json:"number"` State string `json:"state"` DeploymentState string `json:"deployment_state"` Approved bool `json:"approved"` Notes string `json:"notes"` Deployment *Deployment `json:"deployment"` HtmlURL string `json:"html_url"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` ClosedAt *time.Time `json:"closed_at"` DeployedAt *time.Time `json:"deployed_at"` }
DeployRequest encapsulates the request to deploy a database branch's schema to a production branch
type DeployRequestReview ¶
type DeployRequestReview struct { ID string `json:"id"` Body string `json:"body"` State string `json:"state"` Actor Actor `json:"actor"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
DeployRequestReview posts a review to a deploy request.
type DeployRequestsService ¶
type DeployRequestsService interface { ApplyDeploy(context.Context, *ApplyDeployRequestRequest) (*DeployRequest, error) AutoApplyDeploy(context.Context, *AutoApplyDeployRequestRequest) (*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) Get(context.Context, *GetDeployRequestRequest) (*DeployRequest, error) List(context.Context, *ListDeployRequestsRequest) ([]*DeployRequest, error) SkipRevertDeploy(context.Context, *SkipRevertDeployRequestRequest) (*DeployRequest, error) RevertDeploy(context.Context, *RevertDeployRequestRequest) (*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"` Actor *Actor `json:"actor"` CutoverActor *Actor `json:"cutover_actor"` CancelledActor *Actor `json:"cancelled_actor"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` StartedAt *time.Time `json:"started_at"` QueuedAt *time.Time `json:"queued_at"` FinishedAt *time.Time `json:"finished_at"` }
Deployment encapsulates a deployment for a deploy request.
type DeploymentLintError ¶ added in v0.50.0
type DeploymentLintError struct { LintError string `json:"lint_error"` Keyspace string `json:"keyspace_name"` Table string `json:"table_name"` SubjectType string `json:"subject_type"` ErrorDescription string `json:"error_description"` DocsUrl string `json:"docs_url"` }
DeploymentLintError represents an error that occurs during the deployment flow.
type DetachExternalDatabaseRequest ¶ added in v0.58.0
type 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 ¶ added in v0.84.0
type DisableSafeMigrationsRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` }
DisableSafeMigrationsRequest encapsulates the request for disabling safe migrations on a branch.
type EnableSafeMigrationsRequest ¶ added in v0.84.0
type EnableSafeMigrationsRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` }
EnableSafeMigrationsRequest encapsulates the request for enabling safe migrations on a branch.
type Error ¶
type Error struct { // Code specifies the error code. i.e; NotFound, RateLimited, etc... Code ErrorCode // Meta contains additional information depending on the error code. As an // example, if the Code is "ErrResponseMalformed", the map will be: ["body"] // = "body of the response" Meta map[string]string // contains filtered or unexported fields }
Error represents common errors originating from the Client.
type ErrorCode ¶
type ErrorCode string
ErrorCode defines the code of an error.
const ( ErrInternal ErrorCode = "internal" // Internal error. ErrInvalid ErrorCode = "invalid" // Invalid operation, e.g wrong params ErrPermission ErrorCode = "permission" // Permission denied. ErrNotFound ErrorCode = "not_found" // Resource not found. ErrRetry ErrorCode = "retry" // Operation should be retried. ErrResponseMalformed ErrorCode = "response_malformed" // Response body is malformed. )
type ExternalDataSourceSSLVerificationMode ¶ added in v0.58.0
type ExternalDataSourceSSLVerificationMode int
const ( SSLModeDisabled ExternalDataSourceSSLVerificationMode = iota SSLModePreferred SSLModeRequired SSLModeVerifyCA SSLModeVerifyIdentity )
func (ExternalDataSourceSSLVerificationMode) String ¶ added in v0.58.0
func (sm ExternalDataSourceSSLVerificationMode) String() string
type GetBackupRequest ¶
type GetDatabaseBranchCertificateRequest ¶ added in v0.51.0
type GetDatabaseBranchCertificateRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` DisplayName string `json:"display_name"` PasswordId string }
GetDatabaseBranchCertificateRequest encapsulates the request for listing all certificates for a given database branch.
type GetDatabaseBranchPasswordRequest ¶ added in v0.40.0
type GetDatabaseBranchPasswordRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` Name string `json:"name"` PasswordId string }
GetDatabaseBranchPasswordRequest encapsulates the request for listing all passwords for a given database branch.
type GetDatabaseBranchRequest ¶
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 GetDeployRequestRequest ¶
type GetDeployRequestRequest struct { Organization string `json:"-"` Database string `json:"-"` Number uint64 `json:"-"` }
GetDeployRequest encapsulates the request for getting a single deploy request.
type GetImportStatusRequest ¶ added in v0.58.0
type GetOrganizationRequest ¶
type GetOrganizationRequest struct {
Organization string
}
GetOrganizationRequest encapsulates the request for getting a single organization.
type LintSchemaRequest ¶ added in v0.85.0
type LintSchemaRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` }
LintSchemaRequest encapsulates the request for linting a branch's schema.
type ListAuditLogsRequest ¶ added in v0.35.0
type ListAuditLogsRequest struct { Organization string // Events can be used to filter out only the given audit log events. Events []AuditLogEvent }
ListAuditLogsRequest encapsulates the request for listing the audit logs of an organization.
type ListBackupsRequest ¶
type ListDatabaseBranchCertificateRequest ¶ added in v0.51.0
type ListDatabaseBranchCertificateRequest struct { Organization string Database string Branch string }
ListDatabaseBranchCertificateRequest encapsulates the request for listing all certificates for a given database branch.
type ListDatabaseBranchPasswordRequest ¶ added in v0.40.0
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 ListDatabasesRequest ¶
type ListDatabasesRequest struct {
Organization string
}
ListDatabasesRequest encapsulates the request for listing all databases in an organization.
type ListDeployRequestsRequest ¶
type ListDeployRequestsRequest struct { Organization string Database string State string Branch string IntoBranch string }
ListDeployRequestsRequest gets the deploy requests for a specific database branch.
type ListOption ¶ added in v0.66.0
type ListOption func(*ListOptions) error
func WithEventFilters ¶ added in v0.66.0
func WithEventFilters(events []AuditLogEvent) ListOption
WithEventFilters sets filters on a set of list filters from audit log events. For example, `audit_action:database.created`, `audit_action:database.deleted`, etc.
func WithLimit ¶ added in v0.66.0
func WithLimit(limit int) ListOption
WithLimit returns a ListOption that sets the "limit" URL parameter.
func WithPage ¶ added in v0.74.0
func WithPage(page int) ListOption
WithPage returns a ListOption that sets the "page" URL parameter.
func WithPerPage ¶ added in v0.74.0
func WithPerPage(perPage int) ListOption
WithPerPage returns a ListOption that sets the "per_page" URL paramter.
func WithStartingAfter ¶ added in v0.66.0
func WithStartingAfter(startingAfter string) ListOption
WithStartingAfter returns a ListOption that sets the "starting_after" URL parameter.
type ListOptions ¶ added in v0.66.0
ListOptions are options for listing responses.
type ListOrganizationRegionsRequest ¶ added in v0.40.0
type ListOrganizationRegionsRequest struct {
Organization string
}
ListRegionsRequest encapsulates the request for getting a list of regions for an organization.
type ListRegionsRequest ¶ added in v0.29.0
type ListRegionsRequest struct{}
type ListServiceTokenGrantsRequest ¶ added in v0.76.0
type ListServiceTokensRequest ¶
type ListServiceTokensRequest struct {
Organization string `json:"-"`
}
type MakePlanetScalePrimaryRequest ¶ added in v0.58.0
type MakePlanetScaleReplicaRequest ¶ added in v0.58.0
type Organization ¶
type Organization struct { Name string `json:"name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` RemainingFreeDatabases int `json:"free_databases_remaining"` }
Organization represents a PlanetScale organization.
type OrganizationsService ¶
type OrganizationsService interface { Get(context.Context, *GetOrganizationRequest) (*Organization, error) List(context.Context) ([]*Organization, error) ListRegions(context.Context, *ListOrganizationRegionsRequest) ([]*Region, error) }
OrganizationsService is an interface for communicating with the PlanetScale Organizations API endpoints.
type PasswordsService ¶ added in v0.40.0
type PasswordsService interface { Create(context.Context, *DatabaseBranchPasswordRequest) (*DatabaseBranchPassword, error) List(context.Context, *ListDatabaseBranchPasswordRequest) ([]*DatabaseBranchPassword, error) Get(context.Context, *GetDatabaseBranchPasswordRequest) (*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"` }
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 PromoteRequest ¶ added in v0.46.0
type PromoteRequest struct { Organization string `json:"-"` Database string `json:"-"` Branch string `json:"-"` }
PromoteRequest encapsulates the request for promoting a request to production.
type 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 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 RegionsService ¶ added in v0.29.0
type RegionsService interface {
List(ctx context.Context, req *ListRegionsRequest) ([]*Region, error)
}
type RenewDatabaseBranchPasswordRequest ¶ added in v0.95.0
type RenewDatabaseBranchPasswordRequest struct { Organization string Database string Branch string PasswordId string }
RenewDatabaseBranchPasswordRequest encapsulates the request for renewing a password for a given database branch.
type RevertDeployRequestRequest ¶ added in v0.63.0
type ReviewAction ¶
type ReviewAction int
ReviewAction defines the action for an individual review.
const ( // Comment is used to comment a Review with a custom text. ReviewComment ReviewAction = iota // Approve is used to approve a Review. ReviewApprove )
func (ReviewAction) String ¶
func (r ReviewAction) String() string
type ReviewDeployRequestRequest ¶
type ReviewDeployRequestRequest struct { Organization string `json:"-"` Database string `json:"-"` Number uint64 `json:"-"` // CommentText represents the comment body to be posted CommentText string `json:"-"` // ReviewAction defines the action for an individual review. ReviewAction ReviewAction `json:"-"` }
type RoutingRules ¶ added in v0.97.0
type SchemaLintError ¶ added in v0.85.0
type SchemaLintError struct { LintError string `json:"lint_error"` Keyspace string `json:"keyspace_name"` Table string `json:"table_name"` SubjectType string `json:"subject_type"` ErrorDescription string `json:"error_description"` DocsURL string `json:"docs_url"` }
SchemaLintError represents an error with the branch's schema
type ServiceToken ¶
type ServiceTokenAccess ¶
type ServiceTokenAccess struct { ID string `json:"id"` Access string `json:"access"` Type string `json:"type"` Resource ServiceTokenResource `json:"resource"` }
type ServiceTokenGrant ¶ added in v0.76.0
type ServiceTokenGrant struct { ID string `json:"id"` ResourceName string `json:"resource_name"` ResourceType string `json:"resource_type"` ResourceID string `json:"resource_id"` Accesses []*ServiceTokenGrantAccess `json:"accesses"` }
type ServiceTokenGrantAccess ¶ added in v0.81.0
type ServiceTokenResource ¶ added in v0.94.0
type ServiceTokenService ¶
type ServiceTokenService interface { Create(context.Context, *CreateServiceTokenRequest) (*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 SkipRevertDeployRequestRequest ¶ added in v0.63.0
type StartDataImportRequest ¶ added in v0.58.0
type TestDataImportSourceRequest ¶ added in v0.58.0
type TestDataImportSourceRequest struct { Organization string `json:"organization"` Database string `json:"database_name"` Connection DataImportSource `json:"connection"` }
type TestDataImportSourceResponse ¶ added in v0.58.0
type TestDataImportSourceResponse struct { CanConnect bool `json:"can_connect"` ShouldUpgradePlan bool `json:"should_upgrade"` SuggestedPlan string `json:"suggested_plan"` SuggestedBillingPlan BillingPlan ConnectError string `json:"error"` Errors []*DataSourceIncompatibilityError `json:"lint_errors"` MaxPoolSize int `json:"max_pool_size"` }
type UpdateBranchRoutingRulesRequest ¶ added in v0.97.0
type UpdateBranchVschemaRequest ¶ added in v0.97.0
type UserShouldUpgradePlanError ¶ added in v0.60.0
type UserShouldUpgradePlanError struct{}
func (UserShouldUpgradePlanError) Error ¶ added in v0.60.0
func (e UserShouldUpgradePlanError) Error() string