Documentation
¶
Index ¶
- Variables
- type Handler
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) AccountID() string
- func (b *InMemoryBackend) CreateLifecyclePolicy(description, executionRoleARN, state string, tags map[string]string, ...) (*Policy, error)
- func (b *InMemoryBackend) DeleteLifecyclePolicy(policyID string) error
- func (b *InMemoryBackend) GetLifecyclePolicies(filter PolicyFilter) ([]*PolicySummary, error)
- func (b *InMemoryBackend) GetLifecyclePolicy(policyID string) (*Policy, error)
- func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error
- func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
- func (b *InMemoryBackend) UpdateLifecyclePolicy(policyID string, description, executionRoleARN *string, state string, ...) error
- type Policy
- type PolicyFilter
- type PolicySummary
- type Provider
- type StorageBackend
Constants ¶
This section is empty.
Variables ¶
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) )
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 (*Handler) ExtractOperation ¶
ExtractOperation extracts the operation name from the request.
func (*Handler) ExtractResource ¶
ExtractResource extracts the resource identifier from the request.
func (*Handler) GetSupportedOperations ¶
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 ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a matcher that accepts DLM REST paths.
func (*Handler) Snapshot ¶
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) 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 string, description, executionRoleARN *string, state string, policyDetails 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
}
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 ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the DLM service backend and handler.
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).
UpdateLifecyclePolicy(
policyID string, description, executionRoleARN *string, 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.