flypg

package
v0.3.41 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReplicationManager = "repmgr"
	StolonManager      = "stolon"
)

Variables

View Source
var (
	Duration10s, _   = time.ParseDuration("10s")
	Duration15s, _   = time.ParseDuration("15s")
	CheckPathPg      = "/flycheck/pg"
	CheckPathRole    = "/flycheck/role"
	CheckPathVm      = "/flycheck/vm"
	BarmanSecretName = "S3_ARCHIVE_CONFIG"
)

Functions

func CreateTigrisBucket added in v0.2.89

func CreateTigrisBucket(ctx context.Context, config *CreateClusterInput) error

func ErrorStatus

func ErrorStatus(err error) int

Types

type Client

type Client struct {
	BaseURL string
	// contains filtered or unexported fields
}

func NewFromInstance

func NewFromInstance(address string, dialer agent.Dialer) *Client

NewFromInstance creates a new Client that targets a specific instance(address)

func (*Client) CreateDatabase

func (c *Client) CreateDatabase(ctx context.Context, name string) error

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, name, password string, superuser bool) error

func (*Client) DatabaseExists

func (c *Client) DatabaseExists(ctx context.Context, name string) (bool, error)

func (Client) DeleteUser

func (c Client) DeleteUser(ctx context.Context, name string) error

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, in, out interface{}) error

func (*Client) Failover

func (c *Client) Failover(ctx context.Context) error

func (*Client) ListDatabases

func (c *Client) ListDatabases(ctx context.Context) ([]PostgresDatabase, error)

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context) ([]PostgresUser, error)

func (*Client) NewRequest

func (c *Client) NewRequest(path string, method string, in interface{}) (*http.Request, error)

func (*Client) SyncSettings added in v0.0.451

func (c *Client) SyncSettings(ctx context.Context) error

SyncSettings is specific to the repmgr/flex implementation.

func (*Client) UpdateSettings added in v0.0.438

func (c *Client) UpdateSettings(ctx context.Context, settings map[string]string) error

func (*Client) UserExists

func (c *Client) UserExists(ctx context.Context, name string) (bool, error)

func (*Client) ViewSettings added in v0.0.438

func (c *Client) ViewSettings(ctx context.Context, settings []string, manager string) (*PGSettings, error)

type Command added in v0.0.367

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

func NewCommand added in v0.0.367

func NewCommand(ctx context.Context, app *fly.AppCompact) (*Command, error)

func (*Command) ListEvents added in v0.1.1

func (pc *Command) ListEvents(ctx context.Context, leaderIP string, flagsName []string) error

func (*Command) UnregisterMember added in v0.0.451

func (pc *Command) UnregisterMember(ctx context.Context, leaderIP string, standbyNodeName string) error

func (*Command) UpdateSettings added in v0.0.367

func (pc *Command) UpdateSettings(ctx context.Context, leaderIp string, config map[string]string) error

type CommandResponse

type CommandResponse struct {
	Result bool   `json:"result"`
	Error  string `json:"error"`
}

type CreateClusterInput added in v0.0.367

type CreateClusterInput struct {
	AppName            string
	ConsulURL          string
	ImageRef           string
	InitialClusterSize int
	Organization       *fly.Organization
	Password           string
	Region             string
	VolumeSize         *int
	// VMSize is deprecated, specify Guest instead.
	VMSize                    *fly.VMSize
	Guest                     *fly.MachineGuest
	SnapshotID                *string
	Manager                   string
	Autostart                 bool
	ScaleToZero               bool
	ForkFrom                  string
	BackupsEnabled            bool
	BarmanSecret              string
	BarmanRemoteRestoreConfig string
	RestoreTargetName         string
	RestoreTargetTime         string
	RestoreTargetInclusive    bool
}

type CreateDatabaseRequest

type CreateDatabaseRequest struct {
	Name string `json:"name"`
}

type CreateUserRequest

type CreateUserRequest struct {
	Username  string `json:"username"`
	Password  string `json:"password"`
	Superuser bool   `json:"superuser"`
}

type DatabaseListResponse

type DatabaseListResponse struct {
	Result []PostgresDatabase
}

type DeleteDatabaseRequest

type DeleteDatabaseRequest struct {
	Name string `json:"name"`
}

type DeleteUserRequest

type DeleteUserRequest struct {
	Username string `json:"username"`
}

type Error

type Error struct {
	StatusCode int
	Err        string `json:"error"`
}

func (*Error) Error

func (e *Error) Error() string

type FindDatabaseResponse

type FindDatabaseResponse struct {
	Result PostgresDatabase
}

type FindUserResponse

type FindUserResponse struct {
	Result PostgresUser
}

type GrantAccessRequest

type GrantAccessRequest struct {
	Database string `json:"database"`
	Username string `json:"username"`
}

type Launcher added in v0.0.367

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

func NewLauncher added in v0.0.367

func NewLauncher(client flyutil.Client) *Launcher

func (*Launcher) LaunchMachinesPostgres added in v0.0.367

func (l *Launcher) LaunchMachinesPostgres(ctx context.Context, config *CreateClusterInput, detach bool) error

LaunchMachinesPostgres launches a postgres cluster using the machines runtime

type NodeRoleResponse

type NodeRoleResponse struct {
	Result string
}

type PGSetting

type PGSetting struct {
	Name           string   `json:"name,omitempty"`
	Setting        string   `json:"setting,omitempty"`
	VarType        string   `json:"vartype,omitempty"`
	MinVal         string   `json:"min_val,omitempty"`
	MaxVal         string   `json:"max_val,omitempty"`
	EnumVals       []string `json:"enumvals,omitempty"`
	Context        string   `json:"context,omitempty"`
	Unit           string   `json:"unit,omitempty"`
	Desc           string   `json:"short_desc,omitempty"`
	PendingChange  string   `json:"pending_change,omitempty"`
	PendingRestart bool     `json:"pending_restart,omitempty"`
}

type PGSettings

type PGSettings struct {
	Settings []PGSetting `json:"settings,omitempty"`
}

type PostgresDatabase

type PostgresDatabase struct {
	Name  string
	Users []string
}

type PostgresUser

type PostgresUser struct {
	Username  string
	Superuser bool
	Databases []string
}

type ReadonlyResponse added in v0.0.510

type ReadonlyResponse struct {
	Result bool
}

type ReplicationStat added in v0.0.510

type ReplicationStat struct {
	Name string `json:"name"`
	Diff int    `json:"diff"`
}

type ReplicationStatsResponse added in v0.0.510

type ReplicationStatsResponse struct {
	Result []ReplicationStat
}

type RestartResponse

type RestartResponse struct {
	Result string
}

type RevokeAccessRequest

type RevokeAccessRequest struct {
	Database string `json:"database"`
	Username string `json:"username"`
}

type SettingsViewResponse

type SettingsViewResponse struct {
	Result PGSettings
}

type StolonDBUidResponse added in v0.0.510

type StolonDBUidResponse struct {
	Result string
}

type UserListResponse

type UserListResponse struct {
	Result []PostgresUser
}

Jump to

Keyboard shortcuts

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