mysql

package
v0.12.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AddonName      = "miren-mysql"
	BaseImage      = "oci.miren.cloud/mysql"
	DefaultVersion = "9"
)
View Source
const (
	ConfigStorage = "storage"
	ConfigShared  = "shared"
)

Variables

This section is empty.

Functions

func Definition

func Definition() addon.AddonDefinition

func IsSharedVariant

func IsSharedVariant(variantName string) bool

func RegisterDedicatedSaga

func RegisterDedicatedSaga(registry *saga.Registry, fw *addon.ProviderFramework, rc *resultCapture) error

func RegisterDeprovisionDedicatedSaga

func RegisterDeprovisionDedicatedSaga(registry *saga.Registry, fw *addon.ProviderFramework) error

func RegisterDeprovisionSharedSaga

func RegisterDeprovisionSharedSaga(registry *saga.Registry, fw *addon.ProviderFramework) error

func RegisterEnsureSharedServerSaga

func RegisterEnsureSharedServerSaga(registry *saga.Registry, fw *addon.ProviderFramework) error

func RegisterRotateDedicatedRootSaga added in v0.12.1

func RegisterRotateDedicatedRootSaga(registry *saga.Registry, fw *addon.ProviderFramework, rc *rotateCapture) error

func RegisterRotateDedicatedUserSaga added in v0.12.1

func RegisterRotateDedicatedUserSaga(registry *saga.Registry, fw *addon.ProviderFramework, rc *rotateCapture) error

func RegisterRotateSharedRootSaga added in v0.12.1

func RegisterRotateSharedRootSaga(registry *saga.Registry, fw *addon.ProviderFramework, rc *rotateCapture) error

func RegisterRotateSharedUserSaga added in v0.12.1

func RegisterRotateSharedUserSaga(registry *saga.Registry, fw *addon.ProviderFramework, rc *rotateCapture) error

func RegisterSharedSaga

func RegisterSharedSaga(registry *saga.Registry, fw *addon.ProviderFramework, rc *resultCapture) error

func UndoAlterDedicatedRootPassword added in v0.12.1

func UndoAlterDedicatedRootPassword(ctx context.Context, in AlterDedicatedRootPasswordIn, out AlterDedicatedRootPasswordOut) error

func UndoAlterDedicatedUserPassword added in v0.12.1

func UndoAlterDedicatedUserPassword(ctx context.Context, in AlterDedicatedUserPasswordIn, out AlterDedicatedUserPasswordOut) error

func UndoAlterSharedRootPassword added in v0.12.1

func UndoAlterSharedRootPassword(ctx context.Context, in AlterSharedRootPasswordIn, out AlterSharedRootPasswordOut) error

func UndoAlterSharedUserPassword added in v0.12.1

func UndoAlterSharedUserPassword(ctx context.Context, in AlterSharedUserPasswordIn, out AlterSharedUserPasswordOut) error

func UndoBackfillRootDiskName added in v0.12.1

func UndoBackfillRootDiskName(ctx context.Context, in BackfillRootDiskNameIn, out BackfillRootDiskNameOut) error

func UndoBuildDedicatedUserResult added in v0.12.1

func UndoBuildDedicatedUserResult(ctx context.Context, in BuildDedicatedUserResultIn, out BuildDedicatedUserResultOut) error

func UndoBuildSharedResult

func UndoBuildSharedResult(ctx context.Context, in BuildSharedResultIn, out BuildSharedResultOut) error

func UndoBuildUserRotationResult added in v0.12.1

func UndoBuildUserRotationResult(ctx context.Context, in BuildUserRotationResultIn, out BuildUserRotationResultOut) error

func UndoCaptureDedicatedConnInfo added in v0.12.1

func UndoCaptureDedicatedConnInfo(ctx context.Context, in CaptureDedicatedConnInfoIn, out CaptureDedicatedConnInfoOut) error

func UndoCaptureOldUserPassword added in v0.12.1

func UndoCaptureOldUserPassword(ctx context.Context, in CaptureOldUserPasswordIn, out CaptureOldUserPasswordOut) error

func UndoCaptureRootResult added in v0.12.1

func UndoCaptureRootResult(ctx context.Context, in CaptureRootResultIn, out CaptureRootResultOut) error

func UndoCreateMysqlServer

func UndoCreateMysqlServer(ctx context.Context, in CreateMysqlServerIn, out CreateMysqlServerOut) error

func UndoCreateSharedPool

func UndoCreateSharedPool(ctx context.Context, in CreateSharedPoolIn, out CreateSharedPoolOut) error

func UndoCreateSharedUser

func UndoCreateSharedUser(ctx context.Context, in CreateSharedUserIn, out CreateSharedUserOut) error

func UndoDecodeSharedAttrs

func UndoDecodeSharedAttrs(ctx context.Context, in DecodeSharedAttrsIn, out DecodeSharedAttrsOut) error

func UndoDropSharedUser

func UndoDropSharedUser(ctx context.Context, in DropSharedUserIn, out DropSharedUserOut) error

func UndoLoadDedicatedRotationState added in v0.12.1

func UndoLoadDedicatedRotationState(ctx context.Context, in LoadDedicatedRotationStateIn, out LoadDedicatedRotationStateOut) error

func UndoUpdateDedicatedRootEntity added in v0.12.1

func UndoUpdateDedicatedRootEntity(ctx context.Context, in UpdateDedicatedRootEntityIn, out UpdateDedicatedRootEntityOut) error

func UndoUpdateSharedRootEntity added in v0.12.1

func UndoUpdateSharedRootEntity(ctx context.Context, in UpdateSharedRootEntityIn, out UpdateSharedRootEntityOut) error

Types

type ActivateSharedServerIn

type ActivateSharedServerIn struct {
	ServerID     entity.Id
	PoolID       entity.Id
	ServiceID    entity.Id
	RootPassword string
	DiskName     string
	ServiceHost  string
}

type ActivateSharedServerOut

type ActivateSharedServerOut struct {
	Activated bool
}

type AlterDedicatedRootPasswordIn added in v0.12.1

type AlterDedicatedRootPasswordIn struct {
	DedicatedServiceHost  string `saga:"dedicatedservicehost"`
	DedicatedRootPassword string `saga:"dedicatedrootpassword"`
	RootNewPassword       string `saga:"rootnewpassword"`
}

type AlterDedicatedRootPasswordOut added in v0.12.1

type AlterDedicatedRootPasswordOut struct {
	// Edge producer: gate the entity update on the engine actually changing.
	RootAltered bool `saga:"root_altered"`
}

func AlterDedicatedRootPassword added in v0.12.1

type AlterDedicatedUserPasswordIn added in v0.12.1

type AlterDedicatedUserPasswordIn struct {
	DedicatedServiceHost  string `saga:"dedicatedservicehost"`
	DedicatedRootPassword string `saga:"dedicatedrootpassword"`
	DedicatedUser         string `saga:"dedicateduser"`
	DedicatedUserOldPass  string `saga:"dedicateduseroldpass"`
	DedicatedUserNewPass  string `saga:"dedicatedusernewpass"`
}

type AlterDedicatedUserPasswordOut added in v0.12.1

type AlterDedicatedUserPasswordOut struct {
	DedicatedUserAltered bool
}

func AlterDedicatedUserPassword added in v0.12.1

type AlterSharedRootPasswordIn added in v0.12.1

type AlterSharedRootPasswordIn struct {
	SharedServiceHost  string `saga:"sharedservicehost"`
	SharedRootPassword string `saga:"sharedrootpassword"`
	RootNewPassword    string `saga:"rootnewpassword"`

	DiskEnsured saga.Edge `saga:"root_disk_ensured"`
}

type AlterSharedRootPasswordOut added in v0.12.1

type AlterSharedRootPasswordOut struct {
	// Edge producer: gate the entity update on the engine actually changing.
	RootAltered bool `saga:"root_altered"`
}

func AlterSharedRootPassword added in v0.12.1

func AlterSharedRootPassword(ctx context.Context, in AlterSharedRootPasswordIn) (AlterSharedRootPasswordOut, error)

type AlterSharedUserPasswordIn added in v0.12.1

type AlterSharedUserPasswordIn struct {
	SharedServiceHost  string `saga:"sharedservicehost"`
	SharedRootPassword string `saga:"sharedrootpassword"`
	SharedUserName     string `saga:"sharedusername"`
	UserNewPassword    string `saga:"usernewpassword"`
	UserOldPassword    string `saga:"useroldpassword"`
}

type AlterSharedUserPasswordOut added in v0.12.1

type AlterSharedUserPasswordOut struct {
	UserAltered bool
}

func AlterSharedUserPassword added in v0.12.1

func AlterSharedUserPassword(ctx context.Context, in AlterSharedUserPasswordIn) (AlterSharedUserPasswordOut, error)

type BackfillRootDiskNameIn added in v0.12.1

type BackfillRootDiskNameIn struct {
	SharedServerRef entity.Id `saga:"sharedserverref"`
}

type BackfillRootDiskNameOut added in v0.12.1

type BackfillRootDiskNameOut struct {
	// Edge producer: the disk name must be recorded before the password changes,
	// or the legacy password-derived name would be lost.
	RootDiskEnsured bool `saga:"root_disk_ensured"`
}

func BackfillRootDiskName added in v0.12.1

func BackfillRootDiskName(ctx context.Context, in BackfillRootDiskNameIn) (BackfillRootDiskNameOut, error)

type BuildDedicatedResultIn

type BuildDedicatedResultIn struct {
	ServiceHost  string    `saga:"servicehost"`
	Username     string    `saga:"username"`
	Password     string    `saga:"password"`
	DatabaseName string    `saga:"databasename"`
	ServerID     entity.Id `saga:"serverid"`
}

type BuildDedicatedResultOut

type BuildDedicatedResultOut struct {
	Done bool
}

type BuildDedicatedUserResultIn added in v0.12.1

type BuildDedicatedUserResultIn struct {
	DedicatedServiceHost string `saga:"dedicatedservicehost"`
	DedicatedUser        string `saga:"dedicateduser"`
	DedicatedDatabase    string `saga:"dedicateddatabase"`
	DedicatedUserNewPass string `saga:"dedicatedusernewpass"`
}

type BuildDedicatedUserResultOut added in v0.12.1

type BuildDedicatedUserResultOut struct {
	Done bool
}

func BuildDedicatedUserResult added in v0.12.1

func BuildDedicatedUserResult(ctx context.Context, in BuildDedicatedUserResultIn) (BuildDedicatedUserResultOut, error)

type BuildSharedResultIn

type BuildSharedResultIn struct {
	ServerID           entity.Id
	ServiceHost        string
	SharedDatabaseName string
	SharedUsername     string
	SharedPassword     string
}

type BuildSharedResultOut

type BuildSharedResultOut struct {
	Done bool
}

type BuildUserRotationResultIn added in v0.12.1

type BuildUserRotationResultIn struct {
	SharedServiceHost string `saga:"sharedservicehost"`
	SharedUserName    string `saga:"sharedusername"`
	SharedDbName      string `saga:"shareddbname"`
	UserNewPassword   string `saga:"usernewpassword"`
}

type BuildUserRotationResultOut added in v0.12.1

type BuildUserRotationResultOut struct {
	Done bool
}

func BuildUserRotationResult added in v0.12.1

func BuildUserRotationResult(ctx context.Context, in BuildUserRotationResultIn) (BuildUserRotationResultOut, error)

type CaptureDedicatedConnInfoIn added in v0.12.1

type CaptureDedicatedConnInfoIn struct {
	AssocEntity *entity.Entity `saga:"assocentity"`
}

type CaptureDedicatedConnInfoOut added in v0.12.1

type CaptureDedicatedConnInfoOut struct {
	DedicatedUser        string `saga:"dedicateduser"`
	DedicatedDatabase    string `saga:"dedicateddatabase"`
	DedicatedUserOldPass string `saga:"dedicateduseroldpass"`
}

func CaptureDedicatedConnInfo added in v0.12.1

func CaptureDedicatedConnInfo(ctx context.Context, in CaptureDedicatedConnInfoIn) (CaptureDedicatedConnInfoOut, error)

CaptureDedicatedConnInfo resolves the role name and database to alter and rebuild env vars for. Provisioning records both on the association attrs, so they read straight off the entity; associations created before those attrs existed fall back to the app's active config. The old user password is a best-effort read used only for rollback.

type CaptureOldUserPasswordIn added in v0.12.1

type CaptureOldUserPasswordIn struct {
	AssocEntity *entity.Entity `saga:"assocentity"`
}

type CaptureOldUserPasswordOut added in v0.12.1

type CaptureOldUserPasswordOut struct {
	UserOldPassword string `saga:"useroldpassword"`
}

func CaptureOldUserPassword added in v0.12.1

func CaptureOldUserPassword(ctx context.Context, in CaptureOldUserPasswordIn) (CaptureOldUserPasswordOut, error)

type CaptureRootResultIn added in v0.12.1

type CaptureRootResultIn struct {
	Recorded saga.Edge `saga:"root_altered"`
}

type CaptureRootResultOut added in v0.12.1

type CaptureRootResultOut struct {
	Done bool
}

func CaptureRootResult added in v0.12.1

func CaptureRootResult(ctx context.Context, in CaptureRootResultIn) (CaptureRootResultOut, error)

CaptureRootResult records a non-nil, empty result: rotating root touches no consumer variables, so there is nothing to redeploy.

type CleanupSharedServerIn

type CleanupSharedServerIn struct {
	SharedServerRef  entity.Id
	SharedServiceRef entity.Id
	SharedPoolRef    entity.Id
	SharedDiskName   string
	RemainingCount   int64
}

type CleanupSharedServerOut

type CleanupSharedServerOut struct {
	CleanedUp bool
}

type CreateDedicatedPoolIn

type CreateDedicatedPoolIn struct {
	ServerName    string            `saga:"servername"`
	AppName       string            `saga:"appname"`
	DatabaseName  string            `saga:"databasename"`
	Username      string            `saga:"username"`
	Password      string            `saga:"password"`
	RootPassword  string            `saga:"rootpassword"`
	VariantConfig map[string]string `saga:"variantconfig"`
}

type CreateDedicatedPoolOut

type CreateDedicatedPoolOut struct {
	PoolID entity.Id `saga:"poolid"`
}

type CreateMysqlServerIn

type CreateMysqlServerIn struct {
	ServerName   string `saga:"servername"`
	VariantName  string `saga:"variantname"`
	RootPassword string `saga:"rootpassword"`
}

type CreateMysqlServerOut

type CreateMysqlServerOut struct {
	ServerID entity.Id `saga:"serverid"`
}

type CreateSharedDatabaseIn

type CreateSharedDatabaseIn struct {
	ServiceHost        string
	RootPassword       string
	SharedDatabaseName string
	SharedUsername     string
}

type CreateSharedDatabaseOut

type CreateSharedDatabaseOut struct {
	DatabaseCreated bool
}

type CreateSharedPoolIn

type CreateSharedPoolIn struct {
	RootPassword  string
	DiskName      string
	VariantConfig map[string]string
}

type CreateSharedPoolOut

type CreateSharedPoolOut struct {
	PoolID entity.Id
}

type CreateSharedServerEntityIn

type CreateSharedServerEntityIn struct {
	RootPassword  string
	DiskName      string
	VariantConfig map[string]string
}

type CreateSharedServerEntityOut

type CreateSharedServerEntityOut struct {
	ServerID entity.Id
}

type CreateSharedUserIn

type CreateSharedUserIn struct {
	ServiceHost             string
	RootPassword            string
	GeneratedSharedUsername string
	SharedPassword          string
}

type CreateSharedUserOut

type CreateSharedUserOut struct {
	SharedUsername string
}

type DecodeDedicatedAttrsIn

type DecodeDedicatedAttrsIn struct {
	AssocEntity *entity.Entity `saga:"assocentity"`
}

type DecodeDedicatedAttrsOut

type DecodeDedicatedAttrsOut struct {
	DedicatedServerID entity.Id `saga:"dedicatedserverid"`
}

type DecodeSharedAttrsIn

type DecodeSharedAttrsIn struct {
	AssocEntity *entity.Entity `saga:"assocentity"`
}

type DecodeSharedAttrsOut

type DecodeSharedAttrsOut struct {
	SharedServerRef entity.Id
	SharedDbName    string
	SharedUserName  string
}

type DeleteDedicatedServerEntityIn

type DeleteDedicatedServerEntityIn struct {
	DedicatedServerID   entity.Id `saga:"dedicatedserverid"`
	DedicatedServerName string    `saga:"dedicatedservername"`

	PoolCleanedUp saga.Edge `saga:"dedicated_pool_deleted"`
}

type DeleteDedicatedServerEntityOut

type DeleteDedicatedServerEntityOut struct {
	ServerDeleted bool
}

type DropSharedDatabaseIn

type DropSharedDatabaseIn struct {
	SharedServiceHost     string
	SharedRootPassword    string
	SharedDbName          string
	ConnectionsTerminated bool
}

type DropSharedDatabaseOut

type DropSharedDatabaseOut struct {
	DatabaseDropped bool
}

type DropSharedUserIn

type DropSharedUserIn struct {
	SharedServiceHost     string
	SharedRootPassword    string
	SharedUserName        string
	ConnectionsTerminated bool
}

type DropSharedUserOut

type DropSharedUserOut struct {
	UserDropped bool
}

type FindOrCreateSharedServerIn

type FindOrCreateSharedServerIn struct {
	AppName       string
	VariantConfig map[string]string
}

type FindOrCreateSharedServerOut

type FindOrCreateSharedServerOut struct {
	ServerID     entity.Id
	RootPassword string
	ServiceHost  string
}

type GenerateCredentialsIn

type GenerateCredentialsIn struct {
	AppName string
}

type GenerateCredentialsOut

type GenerateCredentialsOut struct {
	Password     string `saga:"password"`
	RootPassword string `saga:"rootpassword"`
	DatabaseName string `saga:"databasename"`
	Username     string `saga:"username"`
	ServiceName  string `saga:"servicename"`
	ServerName   string `saga:"servername"`
}

type GenerateSharedCredentialsIn

type GenerateSharedCredentialsIn struct {
	AppName string
}

type GenerateSharedCredentialsOut

type GenerateSharedCredentialsOut struct {
	SharedPassword          string
	SharedDatabaseName      string
	GeneratedSharedUsername string
}

type LoadDedicatedRotationStateIn added in v0.12.1

type LoadDedicatedRotationStateIn struct {
	DedicatedServerID entity.Id `saga:"dedicatedserverid"`
}

type LoadDedicatedRotationStateOut added in v0.12.1

type LoadDedicatedRotationStateOut struct {
	DedicatedServiceHost  string `saga:"dedicatedservicehost"`
	DedicatedRootPassword string `saga:"dedicatedrootpassword"`
}

func LoadDedicatedRotationState added in v0.12.1

type LookupDedicatedServerIn

type LookupDedicatedServerIn struct {
	DedicatedServerID entity.Id `saga:"dedicatedserverid"`
}

type LookupDedicatedServerOut

type LookupDedicatedServerOut struct {
	DedicatedServiceID  entity.Id `saga:"dedicatedserviceid"`
	DedicatedPoolID     entity.Id `saga:"dedicatedpoolid"`
	DedicatedServerName string    `saga:"dedicatedservername"`
}

type LookupSharedServerIn

type LookupSharedServerIn struct {
	SharedServerRef entity.Id
}

type LookupSharedServerOut

type LookupSharedServerOut struct {
	SharedRootPassword string
	SharedDiskName     string
	SharedServiceRef   entity.Id
	SharedPoolRef      entity.Id
	SharedAssocCount   int64
	SharedServiceHost  string
}

type Provider

type Provider struct {
	dbsaga.BaseProvider
}

func NewProvider

func NewProvider(fw *addon.ProviderFramework) *Provider

func (*Provider) Deprovision

func (p *Provider) Deprovision(ctx context.Context, assoc addon.AddonAssociation) error

func (*Provider) Provision

func (p *Provider) Provision(ctx context.Context, app addon.App, variant addon.Variant) (*addon.ProvisionResult, error)

func (*Provider) RotateCredential added in v0.12.1

func (p *Provider) RotateCredential(ctx context.Context, assoc addon.AddonAssociation, credential, newSecret string) (*addon.RotationResult, error)

RotateCredential implements addon.CredentialRotator for MySQL. Both variants expose two independently-rotatable credentials, and both connect through the stable root account to make the change (MySQL always keeps root as a separate admin, so unlike dedicated PostgreSQL we never need the app user's own password to authenticate the ALTER):

  • "" / "user" — the association's per-app database user, the credential the app connects with. Rotated with ALTER USER; the new password flows to the consuming app, which is redeployed. (Class A: no restart.)
  • "root" — the server's admin password. Rotated with ALTER USER and recorded on the server entity. Apps never receive it, so no consumer is redeployed. (Class C.) For the shared server this is safe now that the data disk name is decoupled from the root password.

type TerminateConnectionsIn

type TerminateConnectionsIn struct {
	SharedServiceHost  string
	SharedRootPassword string
	SharedDbName       string
}

type TerminateConnectionsOut

type TerminateConnectionsOut struct {
	ConnectionsTerminated bool
}

type UpdateDedicatedRootEntityIn added in v0.12.1

type UpdateDedicatedRootEntityIn struct {
	DedicatedServerID     entity.Id `saga:"dedicatedserverid"`
	RootNewPassword       string    `saga:"rootnewpassword"`
	DedicatedRootPassword string    `saga:"dedicatedrootpassword"`

	Altered saga.Edge `saga:"root_altered"`
}

type UpdateDedicatedRootEntityOut added in v0.12.1

type UpdateDedicatedRootEntityOut struct {
	RootRecorded bool
}

func UpdateDedicatedRootEntity added in v0.12.1

type UpdateDedicatedServerIn

type UpdateDedicatedServerIn struct {
	ServerID     entity.Id `saga:"serverid"`
	PoolID       entity.Id `saga:"poolid"`
	ServiceID    entity.Id `saga:"serviceid"`
	ServiceHost  string    `saga:"servicehost"`
	VariantName  string    `saga:"variantname"`
	RootPassword string    `saga:"rootpassword"`
}

type UpdateDedicatedServerOut

type UpdateDedicatedServerOut struct {
	Updated bool
}

type UpdateSharedRootEntityIn added in v0.12.1

type UpdateSharedRootEntityIn struct {
	SharedServerRef    entity.Id `saga:"sharedserverref"`
	RootNewPassword    string    `saga:"rootnewpassword"`
	SharedRootPassword string    `saga:"sharedrootpassword"`

	Altered saga.Edge `saga:"root_altered"`
}

type UpdateSharedRootEntityOut added in v0.12.1

type UpdateSharedRootEntityOut struct {
	RootRecorded bool
}

func UpdateSharedRootEntity added in v0.12.1

func UpdateSharedRootEntity(ctx context.Context, in UpdateSharedRootEntityIn) (UpdateSharedRootEntityOut, error)

Jump to

Keyboard shortcuts

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