cloudsql

package
v0.28.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ResourceTypeInstance lists the Cloud SQL instances in the project.
	ResourceTypeInstance = "cloudsqlInstance"
	// ResourceTypeDatabase lists the databases in a selected instance.
	ResourceTypeDatabase = "cloudsqlDatabase"
)
View Source
const (
	ResourceTypeRegion = "cloudsqlRegion"
	ResourceTypeTier   = "cloudsqlTier"
)

ResourceTypeRegion lists the regions where Cloud SQL is available, and ResourceTypeTier lists the predefined machine tiers (optionally for a region). Both are derived from the tiers.list endpoint.

Variables

This section is empty.

Functions

func ListDatabaseResources

func ListDatabaseResources(ctx context.Context, client Client, instance string) ([]core.IntegrationResource, error)

ListDatabaseResources lists the databases in the selected instance for the database dropdown.

func ListInstanceResources

func ListInstanceResources(ctx context.Context, client Client) ([]core.IntegrationResource, error)

ListInstanceResources lists Cloud SQL instances for the instance dropdown.

func ListRegionResources

func ListRegionResources(ctx context.Context, client Client) ([]core.IntegrationResource, error)

ListRegionResources lists the regions Cloud SQL offers, derived from the union of the regions each available tier is offered in.

func ListTierResources

func ListTierResources(ctx context.Context, client Client, region string) ([]core.IntegrationResource, error)

ListTierResources lists the predefined machine tiers available in the selected region. It returns an empty list until a region is chosen, mirroring the region-dependent pickers in the Compute integration.

func SetClientFactory

func SetClientFactory(fn func(httpCtx core.HTTPContext, integration core.IntegrationContext) (Client, error))

Types

type Client

type Client interface {
	GetURL(ctx context.Context, fullURL string) ([]byte, error)
	PostURL(ctx context.Context, fullURL string, body any) ([]byte, error)
	DeleteURL(ctx context.Context, fullURL string) ([]byte, error)
	ProjectID() string
}

Client is the interface used by the Cloud SQL components.

type CreateDatabase

type CreateDatabase struct{}

func (*CreateDatabase) Cancel

func (c *CreateDatabase) Cancel(ctx core.ExecutionContext) error

func (*CreateDatabase) Cleanup

func (c *CreateDatabase) Cleanup(ctx core.SetupContext) error

func (*CreateDatabase) Color

func (c *CreateDatabase) Color() string

func (*CreateDatabase) Configuration

func (c *CreateDatabase) Configuration() []configuration.Field

func (*CreateDatabase) Description

func (c *CreateDatabase) Description() string

func (*CreateDatabase) Documentation

func (c *CreateDatabase) Documentation() string

func (*CreateDatabase) ExampleOutput

func (c *CreateDatabase) ExampleOutput() map[string]any

func (*CreateDatabase) Execute

func (c *CreateDatabase) Execute(ctx core.ExecutionContext) error

func (*CreateDatabase) HandleHook

func (c *CreateDatabase) HandleHook(ctx core.ActionHookContext) error

func (*CreateDatabase) HandleWebhook

func (*CreateDatabase) Hooks

func (c *CreateDatabase) Hooks() []core.Hook

func (*CreateDatabase) Icon

func (c *CreateDatabase) Icon() string

func (*CreateDatabase) Label

func (c *CreateDatabase) Label() string

func (*CreateDatabase) Name

func (c *CreateDatabase) Name() string

func (*CreateDatabase) OutputChannels

func (c *CreateDatabase) OutputChannels(configuration any) []core.OutputChannel

func (*CreateDatabase) ProcessQueueItem

func (c *CreateDatabase) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*CreateDatabase) Setup

func (c *CreateDatabase) Setup(ctx core.SetupContext) error

type CreateDatabaseSpec

type CreateDatabaseSpec struct {
	Instance string `json:"instance" mapstructure:"instance"`
	Name     string `json:"name" mapstructure:"name"`
}

type CreateInstance

type CreateInstance struct{}

func (*CreateInstance) Cancel

func (c *CreateInstance) Cancel(ctx core.ExecutionContext) error

func (*CreateInstance) Cleanup

func (c *CreateInstance) Cleanup(ctx core.SetupContext) error

func (*CreateInstance) Color

func (c *CreateInstance) Color() string

func (*CreateInstance) Configuration

func (c *CreateInstance) Configuration() []configuration.Field

func (*CreateInstance) Description

func (c *CreateInstance) Description() string

func (*CreateInstance) Documentation

func (c *CreateInstance) Documentation() string

func (*CreateInstance) ExampleOutput

func (c *CreateInstance) ExampleOutput() map[string]any

func (*CreateInstance) Execute

func (c *CreateInstance) Execute(ctx core.ExecutionContext) error

func (*CreateInstance) HandleHook

func (c *CreateInstance) HandleHook(ctx core.ActionHookContext) error

func (*CreateInstance) HandleWebhook

func (*CreateInstance) Hooks

func (c *CreateInstance) Hooks() []core.Hook

func (*CreateInstance) Icon

func (c *CreateInstance) Icon() string

func (*CreateInstance) Label

func (c *CreateInstance) Label() string

func (*CreateInstance) Name

func (c *CreateInstance) Name() string

func (*CreateInstance) OutputChannels

func (c *CreateInstance) OutputChannels(configuration any) []core.OutputChannel

func (*CreateInstance) ProcessQueueItem

func (c *CreateInstance) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*CreateInstance) Setup

func (c *CreateInstance) Setup(ctx core.SetupContext) error

type CreateInstanceSpec

type CreateInstanceSpec struct {
	Name               string       `json:"name" mapstructure:"name"`
	DatabaseVersion    string       `json:"databaseVersion" mapstructure:"databaseVersion"`
	Region             string       `json:"region" mapstructure:"region"`
	Tier               string       `json:"tier" mapstructure:"tier"`
	DiskSizeGb         int          `json:"diskSizeGb" mapstructure:"diskSizeGb"`
	DataDiskType       string       `json:"dataDiskType" mapstructure:"dataDiskType"`
	Edition            string       `json:"edition" mapstructure:"edition"`
	RootPassword       string       `json:"rootPassword" mapstructure:"rootPassword"`
	AvailabilityType   string       `json:"availabilityType" mapstructure:"availabilityType"`
	AutomatedBackups   *bool        `json:"automatedBackups" mapstructure:"automatedBackups"`
	PublicIP           *bool        `json:"publicIp" mapstructure:"publicIp"`
	SSLMode            string       `json:"sslMode" mapstructure:"sslMode"`
	AuthorizedNetworks []string     `json:"authorizedNetworks" mapstructure:"authorizedNetworks"`
	DeletionProtection *bool        `json:"deletionProtection" mapstructure:"deletionProtection"`
	Labels             []labelEntry `json:"labels" mapstructure:"labels"`
}

type Database

type Database struct {
	Kind      string `json:"kind"`
	Name      string `json:"name"`
	Instance  string `json:"instance"`
	Project   string `json:"project"`
	SelfLink  string `json:"selfLink"`
	Charset   string `json:"charset"`
	Collation string `json:"collation"`
	Etag      string `json:"etag"`
}

Database models a Cloud SQL database resource.

func ListDatabases

func ListDatabases(ctx context.Context, client Client, project, instance string) ([]Database, error)

ListDatabases lists the databases in an instance.

type DatabaseNodeMetadata

type DatabaseNodeMetadata struct {
	Instance string `json:"instance,omitempty" mapstructure:"instance"`
	Database string `json:"database,omitempty" mapstructure:"database"`
}

DatabaseNodeMetadata is the node metadata shared by the create/get/delete database components so the collapsed node can show what it targets.

type DeleteDatabase

type DeleteDatabase struct{}

func (*DeleteDatabase) Cancel

func (d *DeleteDatabase) Cancel(ctx core.ExecutionContext) error

func (*DeleteDatabase) Cleanup

func (d *DeleteDatabase) Cleanup(ctx core.SetupContext) error

func (*DeleteDatabase) Color

func (d *DeleteDatabase) Color() string

func (*DeleteDatabase) Configuration

func (d *DeleteDatabase) Configuration() []configuration.Field

func (*DeleteDatabase) Description

func (d *DeleteDatabase) Description() string

func (*DeleteDatabase) Documentation

func (d *DeleteDatabase) Documentation() string

func (*DeleteDatabase) ExampleOutput

func (d *DeleteDatabase) ExampleOutput() map[string]any

func (*DeleteDatabase) Execute

func (d *DeleteDatabase) Execute(ctx core.ExecutionContext) error

func (*DeleteDatabase) HandleHook

func (d *DeleteDatabase) HandleHook(ctx core.ActionHookContext) error

func (*DeleteDatabase) HandleWebhook

func (*DeleteDatabase) Hooks

func (d *DeleteDatabase) Hooks() []core.Hook

func (*DeleteDatabase) Icon

func (d *DeleteDatabase) Icon() string

func (*DeleteDatabase) Label

func (d *DeleteDatabase) Label() string

func (*DeleteDatabase) Name

func (d *DeleteDatabase) Name() string

func (*DeleteDatabase) OutputChannels

func (d *DeleteDatabase) OutputChannels(configuration any) []core.OutputChannel

func (*DeleteDatabase) ProcessQueueItem

func (d *DeleteDatabase) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*DeleteDatabase) Setup

func (d *DeleteDatabase) Setup(ctx core.SetupContext) error

type DeleteDatabaseSpec

type DeleteDatabaseSpec struct {
	Instance string `json:"instance" mapstructure:"instance"`
	Database string `json:"database" mapstructure:"database"`
}

type DeleteInstance

type DeleteInstance struct{}

func (*DeleteInstance) Cancel

func (d *DeleteInstance) Cancel(ctx core.ExecutionContext) error

func (*DeleteInstance) Cleanup

func (d *DeleteInstance) Cleanup(ctx core.SetupContext) error

func (*DeleteInstance) Color

func (d *DeleteInstance) Color() string

func (*DeleteInstance) Configuration

func (d *DeleteInstance) Configuration() []configuration.Field

func (*DeleteInstance) Description

func (d *DeleteInstance) Description() string

func (*DeleteInstance) Documentation

func (d *DeleteInstance) Documentation() string

func (*DeleteInstance) ExampleOutput

func (d *DeleteInstance) ExampleOutput() map[string]any

func (*DeleteInstance) Execute

func (d *DeleteInstance) Execute(ctx core.ExecutionContext) error

func (*DeleteInstance) HandleHook

func (d *DeleteInstance) HandleHook(ctx core.ActionHookContext) error

func (*DeleteInstance) HandleWebhook

func (*DeleteInstance) Hooks

func (d *DeleteInstance) Hooks() []core.Hook

func (*DeleteInstance) Icon

func (d *DeleteInstance) Icon() string

func (*DeleteInstance) Label

func (d *DeleteInstance) Label() string

func (*DeleteInstance) Name

func (d *DeleteInstance) Name() string

func (*DeleteInstance) OutputChannels

func (d *DeleteInstance) OutputChannels(configuration any) []core.OutputChannel

func (*DeleteInstance) ProcessQueueItem

func (d *DeleteInstance) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*DeleteInstance) Setup

func (d *DeleteInstance) Setup(ctx core.SetupContext) error

type DeleteInstanceSpec

type DeleteInstanceSpec struct {
	Instance string `json:"instance" mapstructure:"instance"`
}

type GetDatabase

type GetDatabase struct{}

func (*GetDatabase) Cancel

func (g *GetDatabase) Cancel(ctx core.ExecutionContext) error

func (*GetDatabase) Cleanup

func (g *GetDatabase) Cleanup(ctx core.SetupContext) error

func (*GetDatabase) Color

func (g *GetDatabase) Color() string

func (*GetDatabase) Configuration

func (g *GetDatabase) Configuration() []configuration.Field

func (*GetDatabase) Description

func (g *GetDatabase) Description() string

func (*GetDatabase) Documentation

func (g *GetDatabase) Documentation() string

func (*GetDatabase) ExampleOutput

func (g *GetDatabase) ExampleOutput() map[string]any

func (*GetDatabase) Execute

func (g *GetDatabase) Execute(ctx core.ExecutionContext) error

func (*GetDatabase) HandleHook

func (g *GetDatabase) HandleHook(ctx core.ActionHookContext) error

func (*GetDatabase) HandleWebhook

func (*GetDatabase) Hooks

func (g *GetDatabase) Hooks() []core.Hook

func (*GetDatabase) Icon

func (g *GetDatabase) Icon() string

func (*GetDatabase) Label

func (g *GetDatabase) Label() string

func (*GetDatabase) Name

func (g *GetDatabase) Name() string

func (*GetDatabase) OutputChannels

func (g *GetDatabase) OutputChannels(configuration any) []core.OutputChannel

func (*GetDatabase) ProcessQueueItem

func (g *GetDatabase) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*GetDatabase) Setup

func (g *GetDatabase) Setup(ctx core.SetupContext) error

type GetDatabaseSpec

type GetDatabaseSpec struct {
	Instance string `json:"instance" mapstructure:"instance"`
	Database string `json:"database" mapstructure:"database"`
}

type GetInstance

type GetInstance struct{}

func (*GetInstance) Cancel

func (g *GetInstance) Cancel(ctx core.ExecutionContext) error

func (*GetInstance) Cleanup

func (g *GetInstance) Cleanup(ctx core.SetupContext) error

func (*GetInstance) Color

func (g *GetInstance) Color() string

func (*GetInstance) Configuration

func (g *GetInstance) Configuration() []configuration.Field

func (*GetInstance) Description

func (g *GetInstance) Description() string

func (*GetInstance) Documentation

func (g *GetInstance) Documentation() string

func (*GetInstance) ExampleOutput

func (g *GetInstance) ExampleOutput() map[string]any

func (*GetInstance) Execute

func (g *GetInstance) Execute(ctx core.ExecutionContext) error

func (*GetInstance) HandleHook

func (g *GetInstance) HandleHook(ctx core.ActionHookContext) error

func (*GetInstance) HandleWebhook

func (*GetInstance) Hooks

func (g *GetInstance) Hooks() []core.Hook

func (*GetInstance) Icon

func (g *GetInstance) Icon() string

func (*GetInstance) Label

func (g *GetInstance) Label() string

func (*GetInstance) Name

func (g *GetInstance) Name() string

func (*GetInstance) OutputChannels

func (g *GetInstance) OutputChannels(configuration any) []core.OutputChannel

func (*GetInstance) ProcessQueueItem

func (g *GetInstance) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*GetInstance) Setup

func (g *GetInstance) Setup(ctx core.SetupContext) error

type GetInstanceSpec

type GetInstanceSpec struct {
	Instance string `json:"instance" mapstructure:"instance"`
}

type Instance

type Instance struct {
	Name            string            `json:"name"`
	State           string            `json:"state"`
	DatabaseVersion string            `json:"databaseVersion"`
	Region          string            `json:"region"`
	ConnectionName  string            `json:"connectionName"`
	SelfLink        string            `json:"selfLink"`
	Settings        *InstanceSettings `json:"settings"`
	IPAddresses     []ipMapping       `json:"ipAddresses"`
}

Instance models the subset of a Cloud SQL instance resource the components use.

func ListInstances

func ListInstances(ctx context.Context, client Client, project string) ([]Instance, error)

ListInstances lists the Cloud SQL instances in the project, following pagination so projects with more instances than one page are fully listed.

type InstanceNodeMetadata

type InstanceNodeMetadata struct {
	Instance string `json:"instance,omitempty" mapstructure:"instance"`
}

InstanceNodeMetadata is the node metadata shared by the instance components so the collapsed node can show what it targets.

type InstanceSettings

type InstanceSettings struct {
	Tier           string `json:"tier"`
	DataDiskSizeGb string `json:"dataDiskSizeGb"`
	Edition        string `json:"edition"`
}

type Tier

type Tier struct {
	Tier      string   `json:"tier"`
	RAM       int64    `json:"RAM,string"`
	DiskQuota int64    `json:"DiskQuota,string"`
	Region    []string `json:"region"`
}

Tier models a Cloud SQL machine tier from the tiers.list endpoint. RAM and DiskQuota are returned as int64-formatted strings; Region lists the regions where the tier is offered. Note the API does not enumerate custom machine types (db-custom-*) here.

func ListTiers

func ListTiers(ctx context.Context, client Client, project string) ([]Tier, error)

ListTiers lists the predefined machine tiers available to the project. The tiers.list endpoint is not paginated and does not include custom machine types (db-custom-*).

Jump to

Keyboard shortcuts

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