Documentation
¶
Overview ¶
Package compute provides a portable compute API with cross-cutting concerns.
Index ¶
- Constants
- func VMTransitions() []statemachine.Transition
- type Compute
- func (c *Compute) CancelSpotRequests(ctx context.Context, requestIDs []string) error
- func (c *Compute) CreateAutoScalingGroup(ctx context.Context, config driver.AutoScalingGroupConfig) (*driver.AutoScalingGroup, error)
- func (c *Compute) CreateLaunchTemplate(ctx context.Context, config driver.LaunchTemplateConfig) (*driver.LaunchTemplate, error)
- func (c *Compute) DeleteAutoScalingGroup(ctx context.Context, name string, forceDelete bool) error
- func (c *Compute) DeleteLaunchTemplate(ctx context.Context, name string) error
- func (c *Compute) DeleteScalingPolicy(ctx context.Context, asgName, policyName string) error
- func (c *Compute) DescribeInstances(ctx context.Context, instanceIDs []string, filters []driver.DescribeFilter) ([]driver.Instance, error)
- func (c *Compute) DescribeSpotRequests(ctx context.Context, requestIDs []string) ([]driver.SpotInstanceRequest, error)
- func (c *Compute) ExecuteScalingPolicy(ctx context.Context, asgName, policyName string) error
- func (c *Compute) GetAutoScalingGroup(ctx context.Context, name string) (*driver.AutoScalingGroup, error)
- func (c *Compute) GetLaunchTemplate(ctx context.Context, name string) (*driver.LaunchTemplate, error)
- func (c *Compute) ListAutoScalingGroups(ctx context.Context) ([]driver.AutoScalingGroup, error)
- func (c *Compute) ListLaunchTemplates(ctx context.Context) ([]driver.LaunchTemplate, error)
- func (c *Compute) ModifyInstance(ctx context.Context, instanceID string, input driver.ModifyInstanceInput) error
- func (c *Compute) PutScalingPolicy(ctx context.Context, policy driver.ScalingPolicy) error
- func (c *Compute) RebootInstances(ctx context.Context, instanceIDs []string) error
- func (c *Compute) RequestSpotInstances(ctx context.Context, config driver.SpotRequestConfig) ([]driver.SpotInstanceRequest, error)
- func (c *Compute) RunInstances(ctx context.Context, config driver.InstanceConfig, count int) ([]driver.Instance, error)
- func (c *Compute) SetDesiredCapacity(ctx context.Context, name string, desired int) error
- func (c *Compute) StartInstances(ctx context.Context, instanceIDs []string) error
- func (c *Compute) StopInstances(ctx context.Context, instanceIDs []string) error
- func (c *Compute) TerminateInstances(ctx context.Context, instanceIDs []string) error
- func (c *Compute) UpdateAutoScalingGroup(ctx context.Context, name string, desired, minSize, maxSize int) error
- type Option
Constants ¶
const ( StatePending = "pending" StateRunning = "running" StateStopping = "stopping" StateStopped = "stopped" StateShuttingDown = "shutting-down" StateTerminated = "terminated" StateRestarting = "restarting" )
VM states.
Variables ¶
This section is empty.
Functions ¶
func VMTransitions ¶
func VMTransitions() []statemachine.Transition
VMTransitions returns the legal VM state transitions.
Types ¶
type Compute ¶
type Compute struct {
// contains filtered or unexported fields
}
Compute is the portable compute type wrapping a driver with cross-cutting concerns.
func NewCompute ¶
NewCompute creates a new portable Compute wrapping the given driver.
func (*Compute) CancelSpotRequests ¶ added in v1.2.0
CancelSpotRequests cancels spot/preemptible instance requests.
func (*Compute) CreateAutoScalingGroup ¶ added in v1.2.0
func (c *Compute) CreateAutoScalingGroup( ctx context.Context, config driver.AutoScalingGroupConfig, ) (*driver.AutoScalingGroup, error)
CreateAutoScalingGroup creates an auto-scaling group.
func (*Compute) CreateLaunchTemplate ¶ added in v1.2.0
func (c *Compute) CreateLaunchTemplate( ctx context.Context, config driver.LaunchTemplateConfig, ) (*driver.LaunchTemplate, error)
CreateLaunchTemplate creates a launch template.
func (*Compute) DeleteAutoScalingGroup ¶ added in v1.2.0
DeleteAutoScalingGroup deletes an auto-scaling group.
func (*Compute) DeleteLaunchTemplate ¶ added in v1.2.0
DeleteLaunchTemplate deletes a launch template.
func (*Compute) DeleteScalingPolicy ¶ added in v1.2.0
DeleteScalingPolicy removes a scaling policy.
func (*Compute) DescribeInstances ¶
func (c *Compute) DescribeInstances(ctx context.Context, instanceIDs []string, filters []driver.DescribeFilter) ([]driver.Instance, error)
DescribeInstances describes instances.
func (*Compute) DescribeSpotRequests ¶ added in v1.2.0
func (c *Compute) DescribeSpotRequests( ctx context.Context, requestIDs []string, ) ([]driver.SpotInstanceRequest, error)
DescribeSpotRequests describes spot/preemptible instance requests.
func (*Compute) ExecuteScalingPolicy ¶ added in v1.2.0
ExecuteScalingPolicy executes a scaling policy.
func (*Compute) GetAutoScalingGroup ¶ added in v1.2.0
func (c *Compute) GetAutoScalingGroup(ctx context.Context, name string) (*driver.AutoScalingGroup, error)
GetAutoScalingGroup returns an auto-scaling group.
func (*Compute) GetLaunchTemplate ¶ added in v1.2.0
func (c *Compute) GetLaunchTemplate(ctx context.Context, name string) (*driver.LaunchTemplate, error)
GetLaunchTemplate returns a launch template.
func (*Compute) ListAutoScalingGroups ¶ added in v1.2.0
ListAutoScalingGroups lists all auto-scaling groups.
func (*Compute) ListLaunchTemplates ¶ added in v1.2.0
ListLaunchTemplates lists all launch templates.
func (*Compute) ModifyInstance ¶
func (c *Compute) ModifyInstance(ctx context.Context, instanceID string, input driver.ModifyInstanceInput) error
ModifyInstance modifies an instance.
func (*Compute) PutScalingPolicy ¶ added in v1.2.0
PutScalingPolicy attaches a scaling policy to an auto-scaling group.
func (*Compute) RebootInstances ¶
RebootInstances reboots running instances.
func (*Compute) RequestSpotInstances ¶ added in v1.2.0
func (c *Compute) RequestSpotInstances( ctx context.Context, config driver.SpotRequestConfig, ) ([]driver.SpotInstanceRequest, error)
RequestSpotInstances creates spot/preemptible instance requests.
func (*Compute) RunInstances ¶
func (c *Compute) RunInstances(ctx context.Context, config driver.InstanceConfig, count int) ([]driver.Instance, error)
RunInstances creates new VM instances.
func (*Compute) SetDesiredCapacity ¶ added in v1.2.0
SetDesiredCapacity sets the desired capacity of an auto-scaling group.
func (*Compute) StartInstances ¶
StartInstances starts stopped instances.
func (*Compute) StopInstances ¶
StopInstances stops running instances.
func (*Compute) TerminateInstances ¶
TerminateInstances terminates instances.
type Option ¶
type Option func(*Compute)
Option configures a portable Compute.
func WithErrorInjection ¶
WithErrorInjection sets the error injector.
func WithMetrics ¶
WithMetrics sets the metrics collector.
func WithRateLimiter ¶
WithRateLimiter sets the rate limiter.