flaps

package
v0.1.135-pre-2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FlapsErrorNotFound = &FlapsError{ResponseStatusCode: http.StatusNotFound}
)
View Source
var NonceHeader = "fly-machine-lease-nonce"

Functions

func GetErrorRequestID added in v0.1.104

func GetErrorRequestID(err error) string

func NewContext added in v0.0.349

func NewContext(ctx context.Context, c *Client) context.Context

NewContext derives a Context that carries c from ctx.

func WaitForApp added in v0.1.137

func WaitForApp(ctx context.Context, name string) error

Types

type Client

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

func FromContext added in v0.0.349

func FromContext(ctx context.Context) *Client

FromContext returns the Client ctx carries. It panics in case ctx carries no Client.

func New

func New(ctx context.Context, app *api.AppCompact) (*Client, error)

func NewFromAppName added in v0.0.489

func NewFromAppName(ctx context.Context, appName string) (*Client, error)

func NewWithOptions added in v0.0.545

func NewWithOptions(ctx context.Context, opts NewClientOpts) (*Client, error)

func (*Client) AcquireLease added in v0.0.434

func (f *Client) AcquireLease(ctx context.Context, machineID string, ttl *int) (*api.MachineLease, error)

func (*Client) Cordon added in v0.1.40

func (f *Client) Cordon(ctx context.Context, machineID string) (err error)

func (*Client) CreateApp

func (f *Client) CreateApp(ctx context.Context, name string, org string) (err error)

func (*Client) CreateVolume added in v0.1.72

func (f *Client) CreateVolume(ctx context.Context, req api.CreateVolumeRequest) (*api.Volume, error)

func (*Client) DeleteVolume added in v0.1.72

func (f *Client) DeleteVolume(ctx context.Context, volumeId string) (*api.Volume, error)

func (*Client) Destroy

func (f *Client) Destroy(ctx context.Context, input api.RemoveMachineInput, nonce string) (err error)

func (*Client) Exec added in v0.0.451

func (f *Client) Exec(ctx context.Context, machineID string, in *api.MachineExecRequest) (*api.MachineExecResponse, error)

func (*Client) ExtendVolume added in v0.1.72

func (f *Client) ExtendVolume(ctx context.Context, volumeId string, size_gb int) (*api.Volume, bool, error)

func (*Client) FindLease added in v0.0.434

func (f *Client) FindLease(ctx context.Context, machineID string) (*api.MachineLease, error)

func (*Client) Get

func (f *Client) Get(ctx context.Context, machineID string) (*api.Machine, error)

func (*Client) GetAllVolumes added in v0.1.78

func (f *Client) GetAllVolumes(ctx context.Context) ([]api.Volume, error)

func (*Client) GetMany added in v0.0.416

func (f *Client) GetMany(ctx context.Context, machineIDs []string) ([]*api.Machine, error)

func (*Client) GetProcesses added in v0.1.1

func (f *Client) GetProcesses(ctx context.Context, machineID string) (api.MachinePsResponse, error)

func (*Client) GetVolume added in v0.1.72

func (f *Client) GetVolume(ctx context.Context, volumeId string) (*api.Volume, error)

func (*Client) GetVolumeSnapshots added in v0.1.72

func (f *Client) GetVolumeSnapshots(ctx context.Context, volumeId string) ([]api.VolumeSnapshot, error)

func (*Client) GetVolumes added in v0.1.72

func (f *Client) GetVolumes(ctx context.Context) ([]api.Volume, error)

func (*Client) Kill

func (f *Client) Kill(ctx context.Context, machineID string) (err error)

func (*Client) Launch

func (f *Client) Launch(ctx context.Context, builder api.LaunchMachineInput) (out *api.Machine, err error)

func (*Client) List

func (f *Client) List(ctx context.Context, state string) ([]*api.Machine, error)

func (*Client) ListActive added in v0.0.376

func (f *Client) ListActive(ctx context.Context) ([]*api.Machine, error)

ListActive returns only non-destroyed that aren't in a reserved process group.

func (*Client) ListFlyAppsMachines added in v0.0.452

func (f *Client) ListFlyAppsMachines(ctx context.Context) ([]*api.Machine, *api.Machine, error)

ListFlyAppsMachines returns apps that are part of the Fly apps platform. Destroyed machines and console machines are excluded. Unlike other List functions, this function retries multiple times.

func (*Client) NewRequest

func (f *Client) NewRequest(ctx context.Context, method, path string, in interface{}, headers map[string][]string) (*http.Request, error)

func (*Client) RefreshLease added in v0.0.466

func (f *Client) RefreshLease(ctx context.Context, machineID string, ttl *int, nonce string) (*api.MachineLease, error)

func (*Client) ReleaseLease

func (f *Client) ReleaseLease(ctx context.Context, machineID, nonce string) error

func (*Client) Restart added in v0.0.404

func (f *Client) Restart(ctx context.Context, in api.RestartMachineInput, nonce string) (err error)

func (*Client) Start

func (f *Client) Start(ctx context.Context, machineID string, nonce string) (out *api.MachineStartResponse, err error)

func (*Client) Stop

func (f *Client) Stop(ctx context.Context, in api.StopMachineInput, nonce string) (err error)

func (*Client) Uncordon added in v0.1.89

func (f *Client) Uncordon(ctx context.Context, machineID string) (err error)

func (*Client) Update

func (f *Client) Update(ctx context.Context, builder api.LaunchMachineInput, nonce string) (out *api.Machine, err error)

func (*Client) UpdateVolume added in v0.1.113

func (f *Client) UpdateVolume(ctx context.Context, volumeId string, req api.UpdateVolumeRequest) (*api.Volume, error)

func (*Client) Wait

func (f *Client) Wait(ctx context.Context, machine *api.Machine, state string, timeout time.Duration) (err error)

type ErrorRequestID added in v0.1.104

type ErrorRequestID interface {
	ErrRequestID() string
}

TODO: we might not actually need an interface type here

type ErrorStatusCode added in v0.1.104

type ErrorStatusCode interface {
	error
	StatusCode() *StatusCode
}

type ExtendVolumeRequest added in v0.1.72

type ExtendVolumeRequest struct {
	SizeGB int `json:"size_gb"`
}

type ExtendVolumeResponse added in v0.1.72

type ExtendVolumeResponse struct {
	Volume       *api.Volume `json:"volume"`
	NeedsRestart bool        `json:"needs_restart"`
}

type FlapsError added in v0.0.459

type FlapsError struct {
	OriginalError      error
	ResponseStatusCode int
	ResponseBody       []byte
	FlyRequestId       string
}

func (*FlapsError) ErrRequestID added in v0.1.104

func (fe *FlapsError) ErrRequestID() string

func (*FlapsError) Error added in v0.0.459

func (fe *FlapsError) Error() string

func (*FlapsError) Is added in v0.1.24

func (fe *FlapsError) Is(target error) bool

func (*FlapsError) ResponseBodyString added in v0.0.459

func (fe *FlapsError) ResponseBodyString() string

func (*FlapsError) StatusCode added in v0.1.104

func (fe *FlapsError) StatusCode() *StatusCode

func (*FlapsError) Suggestion added in v0.1.104

func (fe *FlapsError) Suggestion() string

func (*FlapsError) Unwrap added in v0.0.459

func (fe *FlapsError) Unwrap() error

type NewClientOpts added in v0.0.545

type NewClientOpts struct {
	// required:
	AppName string

	// optional, avoids API roundtrip when connecting to flaps by wireguard:
	AppCompact *api.AppCompact

	// optional:
	Logger api.Logger
}

type StatusCode added in v0.1.104

type StatusCode string

func GetErrorStatusCode added in v0.1.104

func GetErrorStatusCode(err error) *StatusCode

Jump to

Keyboard shortcuts

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