Help us shape the future of Go! Take the 2026 Go Developer Survey

dlm

package
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 24 Imported by: 0

README

Data Lifecycle Manager

Parity grade: A · SDK aws-sdk-go-v2/service/dlm@v1.39.4 · last audited 2026-10-10 (ed6ef1a53)

Coverage

Metric Value
PARITY entries audited 8 (8 ok)
Feature families 1 (1 ok)
Known gaps none
Deferred items 0
Resource leaks clean

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPolicyNotFound is returned when a lifecycle policy does not exist.
	ErrPolicyNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrInvalidRequest is returned on invalid input.
	ErrInvalidRequest = awserr.New(errInvalidRequest, awserr.ErrInvalidParameter)
	// ErrLimitExceeded is returned by CreateLifecyclePolicy once the account
	// already holds maxPoliciesPerRegion policies in this Region -- AWS's
	// documented default "Policies per Region" quota (adjustable; quota code
	// L-5407D8DA, docs.aws.amazon.com/general/latest/gr/dlm.html).
	ErrLimitExceeded = awserr.New(errLimitExceeded, awserr.ErrInvalidParameter)
)
View Source
var ErrNilAppContext = errors.New("dlm: nil app context")

ErrNilAppContext is returned when Init is called with a nil AppContext.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Backend StorageBackend
	// contains filtered or unexported fields
}

Handler handles DLM HTTP requests.

func NewHandler

func NewHandler(b StorageBackend) *Handler

NewHandler constructs a new Handler.

func (*Handler) BackendFor

func (h *Handler) BackendFor(region string) StorageBackend

BackendFor returns the backend serving region: the home backend, or the sibling built on first use.

func (*Handler) EnableRegions

func (h *Handler) EnableRegions()

EnableRegions makes h serve every other region through lazily built per-region siblings.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation extracts the operation name from the request.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts the resource identifier from the request.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) RegionBackends

func (h *Handler) RegionBackends() []StorageBackend

RegionBackends returns the home backend followed by every sibling built so far.

func (*Handler) RegionHandler

func (h *Handler) RegionHandler(region string) *Handler

RegionHandler returns the handler serving region: h itself for the home region, else its sibling.

func (*Handler) Reset

func (h *Handler) Reset()

Reset resets the backend.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a matcher that accepts DLM REST paths.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable; other regions ride in an additive "regions" key.

type InMemoryBackend

type InMemoryBackend struct {
	// contains filtered or unexported fields
}

InMemoryBackend implements StorageBackend using in-memory maps.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend constructs a new InMemoryBackend.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the account ID.

func (*InMemoryBackend) CreateLifecyclePolicy

func (b *InMemoryBackend) CreateLifecyclePolicy(
	description, executionRoleARN, state string,
	tags map[string]string,
	policyDetails map[string]any,
) (*Policy, error)

CreateLifecyclePolicy creates a new lifecycle policy and returns it.

func (*InMemoryBackend) DeleteLifecyclePolicy

func (b *InMemoryBackend) DeleteLifecyclePolicy(policyID string) error

DeleteLifecyclePolicy removes a lifecycle policy.

func (*InMemoryBackend) GetLifecyclePolicies

func (b *InMemoryBackend) GetLifecyclePolicies(filter PolicyFilter) ([]*PolicySummary, error)

GetLifecyclePolicies returns summary info for lifecycle policies, optionally narrowed by filter (see PolicyFilter for the matching semantics).

func (*InMemoryBackend) GetLifecyclePolicy

func (b *InMemoryBackend) GetLifecyclePolicy(policyID string) (*Policy, error)

GetLifecyclePolicy returns full details for a lifecycle policy.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)

ListTagsForResource returns tags for a DLM resource ARN.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the region.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all state.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore deserializes backend state from a snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serializes the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error

TagResource applies tags to a DLM resource ARN.

func (*InMemoryBackend) TaggedResources added in v1.3.1

func (b *InMemoryBackend) TaggedResources() []TaggedEntry

TaggedResources returns every DLM policy ARN that currently has at least one tag applied via TagResource.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error

UntagResource removes tags from a DLM resource ARN.

func (*InMemoryBackend) UpdateLifecyclePolicy

func (b *InMemoryBackend) UpdateLifecyclePolicy(
	policyID string, description, executionRoleARN *string, state string,
	policyDetails map[string]any, defaultPolicyOverrides map[string]any,
) error

UpdateLifecyclePolicy updates mutable fields of an existing policy.

description and executionRoleARN follow presence semantics, not truthiness: nil means the field was omitted from the request (leave unchanged), a non-nil pointer to "" means the caller explicitly cleared it. See the StorageBackend.UpdateLifecyclePolicy doc comment for why.

type Policy

type Policy struct {
	DateCreated      time.Time
	DateModified     time.Time
	Tags             map[string]string
	PolicyDetails    map[string]any
	Description      string
	ExecutionRoleARN string
	PolicyArn        string
	PolicyID         string
	State            string
	StatusMessage    string
	DefaultPolicy    bool
}

Policy holds full lifecycle policy details. time.Time fields are first so their non-pointer prefix reduces GC pointer bytes.

type PolicyFilter

type PolicyFilter struct {
	State string
	// DefaultPolicyType narrows results to default policies only: "VOLUME"
	// (EBS snapshot default policy), "INSTANCE" (EBS-backed AMI default
	// policy), or "ALL" (any default policy). Empty imposes no restriction
	// (both custom and default policies match).
	DefaultPolicyType string
	PolicyIDs         []string
	// ResourceTypes matches against PolicyDetails.ResourceTypes.
	ResourceTypes []string
	// TargetTags holds "key=value" pairs matched against
	// PolicyDetails.TargetTags.
	TargetTags []string
	// TagsToAdd holds "key=value" pairs matched against the TagsToAdd of any
	// of PolicyDetails.Schedules.
	TagsToAdd []string
}

PolicyFilter narrows the results of GetLifecyclePolicies. A zero-value field (nil slice or empty string) imposes no restriction along that dimension. Matching AWS's documented semantics for the GetLifecyclePolicies query parameters, PolicyIDs/ResourceTypes/TargetTags/ TagsToAdd each apply an ANY-of match within the list, and the dimensions are ANDed together.

type PolicySummary

type PolicySummary struct {
	Tags          map[string]string
	PolicyID      string
	Description   string
	State         string
	PolicyType    string
	DefaultPolicy bool
}

PolicySummary holds summary lifecycle policy info.

type Provider

type Provider struct{}

Provider implements service.Provider for Amazon DLM.

func (*Provider) Init

Init initializes the DLM service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type StorageBackend

type StorageBackend interface {
	CreateLifecyclePolicy(
		description, executionRoleARN, state string, tags map[string]string, policyDetails map[string]any,
	) (*Policy, error)
	DeleteLifecyclePolicy(policyID string) error
	GetLifecyclePolicies(filter PolicyFilter) ([]*PolicySummary, error)
	GetLifecyclePolicy(policyID string) (*Policy, error)
	// description and executionRoleARN are *string, not string, because the
	// real UpdateLifecyclePolicyInput carries them as pointers: a nil pointer
	// means the field was omitted from the request body (no change), while a
	// non-nil pointer to "" means the caller explicitly sent an empty string
	// (clear the field). A plain string parameter cannot distinguish those
	// two wire states. State stays a plain string because
	// SettablePolicyStateValues is a non-pointer value type on the wire (the
	// real SDK's serializer only ever emits it `if len(State) > 0`, so an
	// explicit empty State is not constructible even by the real SDK).
	//
	// defaultPolicyOverrides carries the top-level [Default policies only]
	// request fields (see defaultPolicyFields), PolicyDetails-keyed. It must
	// be applied under the same lock as the rest of the update: when
	// policyDetails is nil the overrides target the policy's EXISTING stored
	// PolicyDetails, so merging in the handler instead would race a
	// concurrent update.
	UpdateLifecyclePolicy(
		policyID string, description, executionRoleARN *string, state string,
		policyDetails map[string]any, defaultPolicyOverrides map[string]any,
	) error

	TagResource(resourceARN string, tags map[string]string) error
	UntagResource(resourceARN string, tagKeys []string) error
	ListTagsForResource(resourceARN string) (map[string]string, error)

	AccountID() string
	Region() string
	Reset()
	Snapshot(ctx context.Context) []byte
	Restore(ctx context.Context, data []byte) error
}

StorageBackend is the interface for DLM storage operations.

type TaggedEntry added in v1.3.1

type TaggedEntry struct {
	Tags map[string]string
	ARN  string
}

TaggedEntry pairs a resource ARN with its tags.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL