dlm

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 21 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Data Lifecycle Manager

Parity grade: A · SDK aws-sdk-go-v2/service/dlm@v1.37.2 · last audited 2026-07-13 (cafbb3e2)

Coverage

Metric Value
Operations audited 8 (8 ok)
Feature families 1 (1 ok)
Known gaps 4
Deferred items 0
Resource leaks clean
Known gaps
  • StatusMessage field (present on the real LifecyclePolicy shape) is not modeled -- always absent, since this backend never simulates a policy entering an error/degraded state. Adding an always-empty field would be a no-op with no observable behavior difference, so it was left out rather than added for its own sake.
  • DefaultPolicy / SIMPLIFIED-policy-language top-level Create/Update fields (CopyTags, CreateInterval, CrossRegionCopyTargets, Exclusions, ExtendDeletion, RetainInterval, DefaultPolicy, DefaultPolicyType) are not implemented; only the PolicyDetails-based STANDARD policy path is supported. GetLifecyclePolicy falls back to a minimal synthesized {"PolicyType": "EBS_SNAPSHOT_MANAGEMENT"} PolicyDetails when none was stored, which is a reasonable approximation for this out-of-scope area, not a data-corrupting stub.
  • LimitExceededException (the ~100-policies-per-account default AWS quota) is not enforced -- consistent with this codebase's general choice not to simulate account-level service quotas elsewhere.
  • UpdateLifecyclePolicy's Description/ExecutionRoleArn/State request fields are plain string, not *string, so a request that explicitly sets Description to "" is indistinguishable from omitting it (both no-op). Real AWS would technically accept the former as clearing the field. Low practical value (no SDK caller sends an explicit empty Description) and would require a larger request-shape rework; left as a known limitation rather than fixed.

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)
)
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
}

Handler handles DLM HTTP requests.

func NewHandler

func NewHandler(b StorageBackend) *Handler

NewHandler constructs a new Handler.

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) 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 by delegating to the backend.

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 by delegating to the backend.

DEAD-WIRING FIX: prior to this change, Handler exposed no Snapshot/Restore methods even though InMemoryBackend fully implemented both. cli.go's setupPersistence type-asserts each registered service.Registerable (the *Handler returned by Provider.Init) against a Snapshot/Restore interface before registering it with the persistence.Manager -- with no such methods on Handler, dlm was silently never registered for snapshot-based state save/restore, matching the delegation pattern already used by services/dax and services/sesv2.

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) 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, description, executionRoleARN, state string,
	policyDetails map[string]any,
) error

UpdateLifecyclePolicy updates mutable fields of an existing policy.

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
}

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 {
	PolicyIDs []string
	State     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
}

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)
	UpdateLifecyclePolicy(policyID, description, executionRoleARN, state string, policyDetails 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.

Jump to

Keyboard shortcuts

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