Documentation
¶
Overview ¶
Package ec2snap manages EBS snapshots over the signed EC2 Query API (version 2016-11-15). Deletes only touch snapshots that carry the managed tag.
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) CreateSnapshots(ctx context.Context, in CreateInput) ([]Snapshot, error)
- func (c *Client) DeleteSnapshot(ctx context.Context, region, snapshotID string) error
- func (c *Client) DescribeSnapshots(ctx context.Context, region, volumeID string) ([]Snapshot, error)
- func (c *Client) DescribeVolumes(ctx context.Context, region, volumeID string) ([]Volume, error)
- func (c *Client) PlanRetentionFor(ctx context.Context, region string, r Retention) ([]Deletion, error)
- type CreateInput
- type Deletion
- type Guard
- type Meta
- type Retention
- type Snapshot
- type Volume
Constants ¶
const ReasonExpired = "snapshot_expired"
ReasonExpired is the cleanup plan item kind for a snapshot past retention.
const ServiceName = "ebs"
ServiceName is the key used in the guard ServicesEnabled map.
Variables ¶
var ( ErrNotManaged = errors.New("ec2snap: snapshot is not managed by this control plane") ErrNoSource = errors.New("ec2snap: an instance or a volume id is required") )
Errors the API layer maps to HTTP statuses.
var ExpiresTag = tagPrefix + "expires"
ExpiresTag is the teardown timer written by the guard.
var ManagedTag = tagPrefix + "managed"
ManagedTag marks snapshots this control plane created.
var Service = awsx.Service{Name: "ec2", Prefix: "ec2", SigningName: "ec2"}
Service is the EC2 Query API.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the lazy EBS module; it makes no call until a method runs.
func (*Client) CreateSnapshots ¶
CreateSnapshots takes crash consistent snapshots of all volumes of an instance (CreateSnapshots) or of one volume (CreateSnapshot). Every snapshot gets the managed tags and the expires tag from the guard.
func (*Client) DeleteSnapshot ¶
DeleteSnapshot removes a snapshot only when it carries the managed tag.
func (*Client) DescribeSnapshots ¶
func (c *Client) DescribeSnapshots(ctx context.Context, region, volumeID string) ([]Snapshot, error)
DescribeSnapshots lists snapshots owned by the account (all pages), optionally for one volume.
func (*Client) DescribeVolumes ¶
DescribeVolumes lists volumes (all pages), optionally the one named.
type CreateInput ¶
type CreateInput struct {
Region, InstanceID, VolumeID, Description string
ExcludeBoot bool
Meta Meta
}
CreateInput names what to snapshot: every volume of an instance, or one volume.
type Deletion ¶
Deletion is one snapshot the sweeper would remove.
func PlanRetention ¶
PlanRetention is a dry run: per volume it keeps the newest managed snapshot of each of the Daily most recent days and the Weekly most recent weeks, and lists the rest. Untagged and unmanaged snapshots are never listed.
type Guard ¶
type Guard interface {
Tags(m cloudguard.TagMeta) map[string]string
}
Guard is the tag source.
type Retention ¶
type Retention struct{ Daily, Weekly int }
Retention is how many daily and weekly snapshots to keep per volume.