forked from superfly/fly-autoscaler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fas.go
35 lines (27 loc) · 1.06 KB
/
fas.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package fas
import (
"context"
"errors"
fly "github.com/superfly/fly-go"
"github.com/superfly/fly-go/flaps"
)
// Expression errors.
var (
ErrExprRequired = errors.New("expression required")
ErrExprNaN = errors.New("expression returned NaN")
ErrExprInf = errors.New("expression returned Inf")
)
var _ FlyClient = (*fly.Client)(nil)
type FlyClient interface {
GetOrganizationBySlug(ctx context.Context, slug string) (*fly.Organization, error)
GetAppsForOrganization(ctx context.Context, orgID string) ([]fly.App, error)
}
var _ FlapsClient = (*flaps.Client)(nil)
type FlapsClient interface {
List(ctx context.Context, state string) ([]*fly.Machine, error)
Launch(ctx context.Context, input fly.LaunchMachineInput) (*fly.Machine, error)
Destroy(ctx context.Context, input fly.RemoveMachineInput, nonce string) error
Start(ctx context.Context, id, nonce string) (*fly.MachineStartResponse, error)
Stop(ctx context.Context, in fly.StopMachineInput, nonce string) error
}
type NewFlapsClientFunc func(ctx context.Context, appName string) (FlapsClient, error)