Documentation
¶
Overview ¶
Package compute provides a portable compute API with cross-cutting concerns.
Index ¶
- Constants
- func VMTransitions() []statemachine.Transition
- type Compute
- func (c *Compute) AttachVolume(ctx context.Context, volumeID, instanceID, device string) error
- 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) CreateImage(ctx context.Context, cfg driver.ImageConfig) (*driver.ImageInfo, error)
- func (c *Compute) CreateLaunchTemplate(ctx context.Context, config driver.LaunchTemplateConfig) (*driver.LaunchTemplate, error)
- func (c *Compute) CreateSnapshot(ctx context.Context, cfg driver.SnapshotConfig) (*driver.SnapshotInfo, error)
- func (c *Compute) CreateVolume(ctx context.Context, cfg driver.VolumeConfig) (*driver.VolumeInfo, 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) DeleteSnapshot(ctx context.Context, id string) error
- func (c *Compute) DeleteVolume(ctx context.Context, id string) error
- func (c *Compute) DeregisterImage(ctx context.Context, id string) error
- func (c *Compute) DescribeImages(ctx context.Context, ids []string) ([]driver.ImageInfo, error)
- func (c *Compute) DescribeInstances(ctx context.Context, instanceIDs []string, filters []driver.DescribeFilter) ([]driver.Instance, error)
- func (c *Compute) DescribeSnapshots(ctx context.Context, ids []string) ([]driver.SnapshotInfo, error)
- func (c *Compute) DescribeSpotRequests(ctx context.Context, requestIDs []string) ([]driver.SpotInstanceRequest, error)
- func (c *Compute) DescribeVolumes(ctx context.Context, ids []string) ([]driver.VolumeInfo, error)
- func (c *Compute) DetachVolume(ctx context.Context, volumeID string) 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) AttachVolume ¶ added in v1.3.2
AttachVolume attaches a volume to an instance.
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) CreateImage ¶ added in v1.3.2
func (c *Compute) CreateImage(ctx context.Context, cfg driver.ImageConfig) (*driver.ImageInfo, error)
CreateImage creates a machine image from an instance.
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) CreateSnapshot ¶ added in v1.3.2
func (c *Compute) CreateSnapshot(ctx context.Context, cfg driver.SnapshotConfig) (*driver.SnapshotInfo, error)
CreateSnapshot creates a volume snapshot.
func (*Compute) CreateVolume ¶ added in v1.3.2
func (c *Compute) CreateVolume(ctx context.Context, cfg driver.VolumeConfig) (*driver.VolumeInfo, error)
CreateVolume creates a new block storage volume.
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) DeleteSnapshot ¶ added in v1.3.2
DeleteSnapshot deletes a snapshot.
func (*Compute) DeleteVolume ¶ added in v1.3.2
DeleteVolume deletes a volume.
func (*Compute) DeregisterImage ¶ added in v1.3.2
DeregisterImage deregisters a machine image.
func (*Compute) DescribeImages ¶ added in v1.3.2
DescribeImages returns images matching the given IDs.
func (*Compute) DescribeInstances ¶
func (c *Compute) DescribeInstances(ctx context.Context, instanceIDs []string, filters []driver.DescribeFilter) ([]driver.Instance, error)
DescribeInstances describes instances.
func (*Compute) DescribeSnapshots ¶ added in v1.3.2
func (c *Compute) DescribeSnapshots(ctx context.Context, ids []string) ([]driver.SnapshotInfo, error)
DescribeSnapshots returns snapshots matching the given IDs.
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) DescribeVolumes ¶ added in v1.3.2
DescribeVolumes returns volumes matching the given IDs.
func (*Compute) DetachVolume ¶ added in v1.3.2
DetachVolume detaches a volume.
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.