/
spec.go
44 lines (38 loc) · 1.82 KB
/
spec.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
36
37
38
39
40
41
42
43
44
package ebs
import (
"context"
"github.com/aws/aws-sdk-go/service/ec2"
infrastructurev1alpha3 "github.com/giantswarm/apiextensions/v6/pkg/apis/infrastructure/v1alpha3"
)
// Interface describes the methods provided by the helm client.
type Interface interface {
// DeleteVolume deletes an EBS volume with retry logic.
DeleteVolume(ctx context.Context, volumeID string) error
// DetachVolume detaches an EBS volume. If force is specified data loss may
// occur. If shutdown is specified the instance will be stopped first.
DetachVolume(ctx context.Context, volumeID string, attachment VolumeAttachment, force bool, shutdown bool, wait bool) error
// ListVolumes lists EBS volumes for a guest cluster. If etcdVolume is true
// the Etcd volume for the master instance will be returned. If
// persistentVolume is true then any Persistent Volumes associated with the
// cluster will be returned.
ListVolumes(ctx context.Context, customObject infrastructurev1alpha3.AWSCluster, filterFuncs ...func(t *ec2.Tag) bool) ([]Volume, error)
}
// EC2Client describes the methods required to be implemented by an EC2 AWS client.
type EC2Client interface {
DeleteVolume(*ec2.DeleteVolumeInput) (*ec2.DeleteVolumeOutput, error)
DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
DescribeVolumes(*ec2.DescribeVolumesInput) (*ec2.DescribeVolumesOutput, error)
DetachVolume(*ec2.DetachVolumeInput) (*ec2.VolumeAttachment, error)
StopInstances(*ec2.StopInstancesInput) (*ec2.StopInstancesOutput, error)
WaitUntilInstanceStopped(*ec2.DescribeInstancesInput) error
}
// Volume is an EBS volume and its attachments.
type Volume struct {
VolumeID string
Attachments []VolumeAttachment
}
// VolumeAttachment is an EBS volume attached to an EC2 instance.
type VolumeAttachment struct {
Device string
InstanceID string
}