flypg

package
v0.0.451-pre-2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func CommandWithContext added in v0.0.367

func CommandWithContext(ctx context.Context, cmd *Command) context.Context

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) ApplySettings

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

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) DeleteDatabase

func (c *Client) DeleteDatabase(ctx context.Context, name string) 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) NodeRole

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

func (*Client) RestartNodePG

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

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, flex bool) (*PGSettings, error)

type Command added in v0.0.367

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

func CommandFromContext added in v0.0.367

func CommandFromContext(ctx context.Context) *Command

func NewCommand added in v0.0.367

func NewCommand(ctx context.Context, app *api.AppCompact) (*Command, 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       *api.Organization
	Password           string
	Region             string
	VolumeSize         *int
	VMSize             *api.VMSize
	SnapshotID         *string
	Manager            string
}

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 *api.Client) *Launcher

func (*Launcher) LaunchMachinesPostgres added in v0.0.367

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

Launches a postgres cluster using the machines runtime

func (*Launcher) LaunchNomadPostgres added in v0.0.367

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

Launches a postgres cluster using the nomad 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 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 UserListResponse

type UserListResponse struct {
	Result []PostgresUser
}

Jump to

Keyboard shortcuts

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