sdk

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerList = []string{
	"https://api.planetscale.com/v1",
}

ServerList contains the list of servers available to the SDK

Functions

func Bool

func Bool(b bool) *bool

Bool provides a helper function to return a pointer to a bool

func Float32

func Float32(f float32) *float32

Float32 provides a helper function to return a pointer to a float32

func Float64

func Float64(f float64) *float64

Float64 provides a helper function to return a pointer to a float64

func Int

func Int(i int) *int

Int provides a helper function to return a pointer to an int

func Int64

func Int64(i int64) *int64

Int64 provides a helper function to return a pointer to an int64

func Pointer

func Pointer[T any](v T) *T

Pointer provides a helper function to return a pointer to a type

func String

func String(s string) *string

String provides a helper function to return a pointer to a string

Types

type BranchChanges

type BranchChanges struct {
	// contains filtered or unexported fields
}

BranchChanges - Resources for managing cluster changes.

func (*BranchChanges) GetBranchChangeRequest

GetBranchChangeRequest - Get a branch change request ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_branch`, `delete_branch`, `create_branch`, `connect_production_branch`, `connect_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `read_branches` | | Database | `read_branches` | | Branch | `read_branch` |

func (*BranchChanges) GetBranchChangeRequestWaitForChangeRequestComplete

func (s *BranchChanges) GetBranchChangeRequestWaitForChangeRequestComplete() polling.ConfigFunc

Use with GetBranchChangeRequest by adding the operations.WithPolling option. Responses are returned when enabling polling, however additional errors may be returned:

  • polling.FailureCriteriaError: If the polling option has explicit failure criteria defined, polling will immediately stop and return this error.
  • polling.LimitCountError: When polling has reached the maximum number of attempts. Use the polling.WithLimitCountOverride polling option to override the predefined limit.

func (*BranchChanges) UpdateBranchChangeRequest

UpdateBranchChangeRequest - Upsert a change request ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`write_database`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `write_databases` | | Database | `write_database` |

type DatabaseBranchPasswords

type DatabaseBranchPasswords struct {
	// contains filtered or unexported fields
}

DatabaseBranchPasswords - Resources for managing database branch passwords.

func (*DatabaseBranchPasswords) CreatePassword

CreatePassword - Create a password ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`connect_production_branch`, `connect_production_read_only_branch`, `connect_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Branch | `manage_passwords`, `manage_read_only_passwords` |

func (*DatabaseBranchPasswords) DeletePassword

DeletePassword - Delete a password ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`delete_production_branch_password`, `delete_production_read_only_branch_password`, `delete_branch_password`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Branch | `manage_passwords`, `manage_read_only_passwords` |

func (*DatabaseBranchPasswords) GetPassword

GetPassword - Get a password ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_branch`, `delete_branch`, `create_branch`, `connect_production_branch`, `connect_production_read_only_branch`, `connect_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Branch | `manage_passwords`, `manage_read_only_passwords` |

func (*DatabaseBranchPasswords) ListPasswords

ListPasswords - List passwords ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_branch`, `delete_branch`, `create_branch`, `connect_production_branch`, `connect_production_read_only_branch`, `connect_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Branch | `manage_passwords`, `manage_read_only_passwords` |

func (*DatabaseBranchPasswords) UpdatePassword

UpdatePassword - Update a password ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`connect_production_branch`, `connect_production_read_only_branch`, `connect_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Branch | `manage_passwords`, `manage_read_only_passwords` |

type DatabaseBranches

type DatabaseBranches struct {
	// contains filtered or unexported fields
}

func (*DatabaseBranches) CreatePostgresBranch

CreatePostgresBranch - Create a PostgreSQL branch ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`create_branch`, `restore_production_branch_backup`, `restore_backup`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `write_branches`, `restore_production_branch_backups`, `restore_backups` | | Database | `write_branches`, `restore_production_branch_backups`, `restore_backups` | | Branch | `restore_backups` |

func (*DatabaseBranches) CreateVitessBranch

CreateVitessBranch - Create a Vitess branch ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`create_branch`, `restore_production_branch_backup`, `restore_backup`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `write_branches`, `restore_production_branch_backups`, `restore_backups` | | Database | `write_branches`, `restore_production_branch_backups`, `restore_backups` | | Branch | `restore_backups` |

func (*DatabaseBranches) DeletePostgresBranch

DeletePostgresBranch - Delete a PostgreSQL branch ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`delete_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `delete_branches`, `delete_production_branches` | | Database | `delete_branches`, `delete_production_branches` | | Branch | `delete_branch` |

func (*DatabaseBranches) DeleteVitessBranch

DeleteVitessBranch - Delete a Vitess branch ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`delete_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `delete_branches`, `delete_production_branches` | | Database | `delete_branches`, `delete_production_branches` | | Branch | `delete_branch` |

func (*DatabaseBranches) GetPostgresBranch

GetPostgresBranch - Get a PostgreSQL branch ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_branch`, `delete_branch`, `create_branch`, `connect_production_branch`, `connect_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `read_branches` | | Database | `read_branches` | | Branch | `read_branch` |

func (*DatabaseBranches) GetPostgresBranchWaitForReady

func (s *DatabaseBranches) GetPostgresBranchWaitForReady() polling.ConfigFunc

Use with GetPostgresBranch by adding the operations.WithPolling option. Responses are returned when enabling polling, however additional errors may be returned:

  • polling.FailureCriteriaError: If the polling option has explicit failure criteria defined, polling will immediately stop and return this error.
  • polling.LimitCountError: When polling has reached the maximum number of attempts. Use the polling.WithLimitCountOverride polling option to override the predefined limit.

func (*DatabaseBranches) GetVitessBranch

GetVitessBranch - Get a Vitess branch ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_branch`, `delete_branch`, `create_branch`, `connect_production_branch`, `connect_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `read_branches` | | Database | `read_branches` | | Branch | `read_branch` |

func (*DatabaseBranches) GetVitessBranchWaitForReady

func (s *DatabaseBranches) GetVitessBranchWaitForReady() polling.ConfigFunc

Use with GetVitessBranch by adding the operations.WithPolling option. Responses are returned when enabling polling, however additional errors may be returned:

  • polling.FailureCriteriaError: If the polling option has explicit failure criteria defined, polling will immediately stop and return this error.
  • polling.LimitCountError: When polling has reached the maximum number of attempts. Use the polling.WithLimitCountOverride polling option to override the predefined limit.

func (*DatabaseBranches) UpdatePostgresBranch

UpdatePostgresBranch - Update a PostgreSQL branch ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`write_database`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `write_branches` | | Database | `write_branches` | | Branch | `write_branch` |

func (*DatabaseBranches) UpdateVitessBranch

UpdateVitessBranch - Update a Vitess branch ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`write_database`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `write_branches` | | Database | `write_branches` | | Branch | `write_branch` |

type Databases

type Databases struct {
	// contains filtered or unexported fields
}

Databases - Resources for managing databases within an organization.

func (*Databases) GetPostgresDatabase

GetPostgresDatabase - Get a PostgreSQL database ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_database`, `delete_database`, `write_database`, `read_branch`, `delete_branch`, `create_branch`, `delete_production_branch`, `connect_branch`, `connect_production_branch`, `connect_production_read_only_branch`, `delete_branch_password`, `delete_production_branch_password`, `delete_production_read_only_branch_password`, `read_deploy_request`, `create_deploy_request`, `approve_deploy_request`, `read_comment`, `create_comment`, `restore_backup`, `restore_production_branch_backup`, `read_backups`, `write_backups`, `delete_backups`, `delete_production_branch_backups`, `write_branch_vschema`, `write_production_branch_vschema`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `read_databases` | | Database | `read_database` |

func (*Databases) GetPostgresDatabaseWaitForReady

func (s *Databases) GetPostgresDatabaseWaitForReady() polling.ConfigFunc

Use with GetPostgresDatabase by adding the operations.WithPolling option. Responses are returned when enabling polling, however additional errors may be returned:

  • polling.FailureCriteriaError: If the polling option has explicit failure criteria defined, polling will immediately stop and return this error.
  • polling.LimitCountError: When polling has reached the maximum number of attempts. Use the polling.WithLimitCountOverride polling option to override the predefined limit.

func (*Databases) GetVitessDatabase

GetVitessDatabase - Get a Vitess database ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_database`, `delete_database`, `write_database`, `read_branch`, `delete_branch`, `create_branch`, `delete_production_branch`, `connect_branch`, `connect_production_branch`, `connect_production_read_only_branch`, `delete_branch_password`, `delete_production_branch_password`, `delete_production_read_only_branch_password`, `read_deploy_request`, `create_deploy_request`, `approve_deploy_request`, `read_comment`, `create_comment`, `restore_backup`, `restore_production_branch_backup`, `read_backups`, `write_backups`, `delete_backups`, `delete_production_branch_backups`, `write_branch_vschema`, `write_production_branch_vschema`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `read_databases` | | Database | `read_database` |

func (*Databases) GetVitessDatabaseWaitForReady

func (s *Databases) GetVitessDatabaseWaitForReady() polling.ConfigFunc

Use with GetVitessDatabase by adding the operations.WithPolling option. Responses are returned when enabling polling, however additional errors may be returned:

  • polling.FailureCriteriaError: If the polling option has explicit failure criteria defined, polling will immediately stop and return this error.
  • polling.LimitCountError: When polling has reached the maximum number of attempts. Use the polling.WithLimitCountOverride polling option to override the predefined limit.

func (*Databases) ListDatabases

ListDatabases - List databases ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_database`, `delete_database`, `write_database`, `read_branch`, `delete_branch`, `create_branch`, `delete_production_branch`, `connect_branch`, `connect_production_branch`, `connect_production_read_only_branch`, `delete_branch_password`, `delete_production_branch_password`, `delete_production_read_only_branch_password`, `read_deploy_request`, `create_deploy_request`, `approve_deploy_request`, `read_comment`, `create_comment`, `restore_backup`, `restore_production_branch_backup`, `read_backups`, `write_backups`, `delete_backups`, `delete_production_branch_backups`, `write_branch_vschema`, `write_production_branch_vschema`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `read_databases` |

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient provides an interface for supplying the SDK with a custom HTTP client

type Organizations

type Organizations struct {
	// contains filtered or unexported fields
}

Organizations - Resources for managing organizations.

func (*Organizations) GetOrganization

GetOrganization - Get an organization ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_organization`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | User | `read_organizations` | | Organization | `read_organization` |

func (*Organizations) ListOrganizations

ListOrganizations - List organizations When using a service token, returns the list of organizations the service token has access to. When using an OAuth token, returns the list of organizations the user has access to. ### Authorization A OAuth token must have at least one of the following scopes in order to use this API endpoint:

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | User | `read_organizations` |

type PlanetScale

type PlanetScale struct {
	SDKVersion string
	//             Resources for managing organizations.
	//
	Organizations *Organizations
	//             Resources for managing databases within an organization.
	//
	Databases *Databases
	//           Resources for managing cluster changes.
	//
	BranchChanges *BranchChanges
	//           Resources for managing database branch passwords.
	//
	DatabaseBranchPasswords *DatabaseBranchPasswords
	//           Resources for managing role credentials.
	//
	Roles            *Roles
	DatabaseBranches *DatabaseBranches
	// contains filtered or unexported fields
}

PlanetScale - Terraform Provider for PlanetScale: Manage your PlanetScale resources with Terraform

func New

func New(opts ...SDKOption) *PlanetScale

New creates a new instance of the SDK with the provided options

type Roles

type Roles struct {
	// contains filtered or unexported fields
}

Roles - Resources for managing role credentials.

func (*Roles) CreateRole

CreateRole - Create role credentials ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`create_production_branch_password`, `create_production_read_only_branch_password`, `create_branch_password`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Branch | `manage_passwords`, `manage_read_only_passwords` |

func (*Roles) DeleteRole

DeleteRole - Delete role credentials ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`delete_production_branch_password`, `delete_production_read_only_branch_password`, `delete_branch_password`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Branch | `manage_passwords`, `manage_read_only_passwords` |

func (*Roles) GetRole

GetRole - Get a role ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_branch`, `delete_branch`, `create_branch`, `connect_production_branch`, `connect_production_read_only_branch`, `connect_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Branch | `manage_passwords`, `manage_read_only_passwords` |

func (*Roles) ListRoles

ListRoles - List roles ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`read_branch`, `delete_branch`, `create_branch`, `connect_production_branch`, `connect_production_read_only_branch`, `connect_branch`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Branch | `manage_passwords`, `manage_read_only_passwords` |

func (*Roles) UpdateRole

UpdateRole - Update role name ### Authorization A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**

`create_production_branch_password`, `create_production_read_only_branch_password`, `create_branch_password`

**OAuth Scopes**

| Resource | Scopes |

| :------- | :---------- | | Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` | | Branch | `manage_passwords`, `manage_read_only_passwords` |

type SDKOption

type SDKOption func(*PlanetScale)

func WithClient

func WithClient(client HTTPClient) SDKOption

WithClient allows the overriding of the default HTTP client used by the SDK

func WithRetryConfig

func WithRetryConfig(retryConfig retry.Config) SDKOption

func WithSecurity

func WithSecurity(security shared.Security) SDKOption

WithSecurity configures the SDK to use the provided security details

func WithSecuritySource

func WithSecuritySource(security func(context.Context) (shared.Security, error)) SDKOption

WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication

func WithServerIndex

func WithServerIndex(serverIndex int) SDKOption

WithServerIndex allows the overriding of the default server by index

func WithServerURL

func WithServerURL(serverURL string) SDKOption

WithServerURL allows the overriding of the default server URL

func WithTemplatedServerURL

func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption

WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters

func WithTimeout

func WithTimeout(timeout time.Duration) SDKOption

WithTimeout Optional request timeout applied to each operation

Directories

Path Synopsis
internal
models

Jump to

Keyboard shortcuts

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