Documentation ¶
Index ¶
- Variables
- func GetErrorRequestID(err error) string
- func GetErrorTraceID(err error) string
- func NewContext(ctx context.Context, c *Client) context.Context
- type Client
- func (f *Client) AcquireLease(ctx context.Context, machineID string, ttl *int) (*fly.MachineLease, error)
- func (f *Client) Cordon(ctx context.Context, machineID string, nonce string) (err error)
- func (f *Client) CreateApp(ctx context.Context, name string, org string) (err error)
- func (f *Client) CreateVolume(ctx context.Context, req fly.CreateVolumeRequest) (*fly.Volume, error)
- func (f *Client) CreateVolumeSnapshot(ctx context.Context, volumeId string) error
- func (f *Client) DeleteMetadata(ctx context.Context, machineID, key string) error
- func (f *Client) DeleteVolume(ctx context.Context, volumeId string) (*fly.Volume, error)
- func (f *Client) Destroy(ctx context.Context, input fly.RemoveMachineInput, nonce string) (err error)
- func (f *Client) Exec(ctx context.Context, machineID string, in *fly.MachineExecRequest) (*fly.MachineExecResponse, error)
- func (f *Client) ExtendVolume(ctx context.Context, volumeId string, size_gb int) (*fly.Volume, bool, error)
- func (f *Client) FindLease(ctx context.Context, machineID string) (*fly.MachineLease, error)
- func (f *Client) Get(ctx context.Context, machineID string) (*fly.Machine, error)
- func (f *Client) GetAllVolumes(ctx context.Context) ([]fly.Volume, error)
- func (f *Client) GetMany(ctx context.Context, machineIDs []string) ([]*fly.Machine, error)
- func (f *Client) GetMetadata(ctx context.Context, machineID string) (map[string]string, error)
- func (f *Client) GetProcesses(ctx context.Context, machineID string) (fly.MachinePsResponse, error)
- func (f *Client) GetVolume(ctx context.Context, volumeId string) (*fly.Volume, error)
- func (f *Client) GetVolumeSnapshots(ctx context.Context, volumeId string) ([]fly.VolumeSnapshot, error)
- func (f *Client) GetVolumes(ctx context.Context) ([]fly.Volume, error)
- func (f *Client) Kill(ctx context.Context, machineID string) (err error)
- func (f *Client) Launch(ctx context.Context, builder fly.LaunchMachineInput) (out *fly.Machine, err error)
- func (f *Client) List(ctx context.Context, state string) ([]*fly.Machine, error)
- func (f *Client) ListActive(ctx context.Context) ([]*fly.Machine, error)
- func (f *Client) ListFlyAppsMachines(ctx context.Context) ([]*fly.Machine, *fly.Machine, error)
- func (f *Client) NewRequest(ctx context.Context, method, path string, in interface{}, ...) (*http.Request, error)
- func (f *Client) RefreshLease(ctx context.Context, machineID string, ttl *int, nonce string) (*fly.MachineLease, error)
- func (f *Client) ReleaseLease(ctx context.Context, machineID, nonce string) error
- func (f *Client) Restart(ctx context.Context, in fly.RestartMachineInput, nonce string) (err error)
- func (f *Client) SetMetadata(ctx context.Context, machineID, key, value string) error
- func (f *Client) Start(ctx context.Context, machineID string, nonce string) (out *fly.MachineStartResponse, err error)
- func (f *Client) Stop(ctx context.Context, in fly.StopMachineInput, nonce string) (err error)
- func (f *Client) Uncordon(ctx context.Context, machineID string, nonce string) (err error)
- func (f *Client) Update(ctx context.Context, builder fly.LaunchMachineInput, nonce string) (out *fly.Machine, err error)
- func (f *Client) UpdateVolume(ctx context.Context, volumeId string, req fly.UpdateVolumeRequest) (*fly.Volume, error)
- func (f *Client) Wait(ctx context.Context, machine *fly.Machine, state string, timeout time.Duration) (err error)
- func (f *Client) WaitForApp(ctx context.Context, name string) error
- type ErrorRequestID
- type ErrorStatusCode
- type ErrorTraceID
- type ExtendVolumeRequest
- type ExtendVolumeResponse
- type FlapsError
- func (fe *FlapsError) ErrRequestID() string
- func (fe *FlapsError) ErrTraceID() string
- func (fe *FlapsError) Error() string
- func (fe *FlapsError) Is(target error) bool
- func (fe *FlapsError) ResponseBodyString() string
- func (fe *FlapsError) StatusCode() *StatusCode
- func (fe *FlapsError) Suggestion() string
- func (fe *FlapsError) Unwrap() error
- type NewClientOpts
- type StatusCode
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 ¶
func GetErrorTraceID ¶ added in v0.1.5
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func FromContext ¶
FromContext returns the Client ctx carries. It panics in case ctx carries no Client.
func NewWithOptions ¶
func NewWithOptions(ctx context.Context, opts NewClientOpts) (*Client, error)
func (*Client) AcquireLease ¶
func (*Client) CreateVolume ¶
func (*Client) CreateVolumeSnapshot ¶
func (*Client) DeleteMetadata ¶
func (*Client) DeleteVolume ¶
func (*Client) Exec ¶
func (f *Client) Exec(ctx context.Context, machineID string, in *fly.MachineExecRequest) (*fly.MachineExecResponse, error)
func (*Client) ExtendVolume ¶
func (*Client) GetAllVolumes ¶
func (*Client) GetMetadata ¶
func (*Client) GetProcesses ¶
func (*Client) GetVolumeSnapshots ¶
func (*Client) ListActive ¶
ListActive returns only non-destroyed that aren't in a reserved process group.
func (*Client) ListFlyAppsMachines ¶
ListFlyAppsMachines returns apps that are part of Fly Launch. Destroyed machines and console machines are excluded. Unlike other List functions, this function retries multiple times.
func (*Client) NewRequest ¶
func (*Client) RefreshLease ¶
func (*Client) ReleaseLease ¶
func (*Client) SetMetadata ¶
func (*Client) UpdateVolume ¶
type ErrorRequestID ¶
type ErrorRequestID interface {
ErrRequestID() string
}
TODO: we might not actually need an interface type here
type ErrorStatusCode ¶
type ErrorStatusCode interface { error StatusCode() *StatusCode }
type ErrorTraceID ¶ added in v0.1.5
type ErrorTraceID interface {
ErrTraceID() string
}
type ExtendVolumeRequest ¶
type ExtendVolumeRequest struct {
SizeGB int `json:"size_gb"`
}
type ExtendVolumeResponse ¶
type FlapsError ¶
type FlapsError struct { OriginalError error ResponseStatusCode int ResponseBody []byte FlyRequestId string TraceID string }
func (*FlapsError) ErrRequestID ¶
func (fe *FlapsError) ErrRequestID() string
func (*FlapsError) ErrTraceID ¶ added in v0.1.5
func (fe *FlapsError) ErrTraceID() string
func (*FlapsError) Error ¶
func (fe *FlapsError) Error() string
func (*FlapsError) Is ¶
func (fe *FlapsError) Is(target error) bool
func (*FlapsError) ResponseBodyString ¶
func (fe *FlapsError) ResponseBodyString() string
func (*FlapsError) StatusCode ¶
func (fe *FlapsError) StatusCode() *StatusCode
func (*FlapsError) Suggestion ¶
func (fe *FlapsError) Suggestion() string
func (*FlapsError) Unwrap ¶
func (fe *FlapsError) Unwrap() error
type NewClientOpts ¶
type NewClientOpts struct { // required: AppName string // optional, avoids API roundtrip when connecting to flaps by wireguard: AppCompact *fly.AppCompact // optional, sent with requests UserAgent string // optional, used to connect to machines API DialContext func(ctx context.Context, network, address string) (net.Conn, error) // URL used when connecting via usermode wireguard. BaseURL *url.URL Tokens *tokens.Tokens // optional: Logger fly.Logger // optional, used to construct the underlying HTTP client Transport http.RoundTripper }
type StatusCode ¶
type StatusCode string
func GetErrorStatusCode ¶
func GetErrorStatusCode(err error) *StatusCode
Click to show internal directories.
Click to hide internal directories.