Documentation
¶
Overview ¶
Package param provides use cases for SSM Parameter Store operations.
Index ¶
- Variables
- func MatchPrefix(name, prefix string, recursive bool) bool
- type CreateInput
- type CreateOutput
- type CreateUseCase
- type DeleteInput
- type DeleteOutput
- type DeleteUseCase
- type DiffInput
- type DiffOutput
- type DiffUseCase
- type ListEntry
- type ListInput
- type ListOutput
- type ListUseCase
- type LogEntry
- type LogInput
- type LogOutput
- type LogUseCase
- type ShowInput
- type ShowOutput
- type ShowTag
- type ShowUseCase
- type TagInput
- type TagUseCase
- type UpdateInput
- type UpdateOutput
- type UpdateUseCase
Constants ¶
This section is empty.
Variables ¶
var ( // ErrParameterNotFound is returned when a parameter is not found. ErrParameterNotFound = errors.New("parameter not found") )
Functions ¶
func MatchPrefix ¶ added in v1.5.0
MatchPrefix reports whether name is in scope for the given prefix, using AWS Parameter Store PATH-HIERARCHY semantics (the old server-side Path filter):
- An empty prefix matches everything (the old code applied no Path filter, returning all parameters at any depth).
- Otherwise a name matches the prefix iff name == prefix OR it is a descendant, i.e. HasPrefix(name, prefix+"/"). This is hierarchical, so prefix "/app" does NOT match "/application".
- Recursive (--recursive) matches any depth under the prefix.
- OneLevel (default) matches only immediate children: the segment after "prefix/" must contain no further "/".
A trailing slash on the prefix is normalized so "/app/" behaves like "/app".
Types ¶
type CreateInput ¶ added in v0.5.0
type CreateInput struct {
Name string
Value string
Type domain.ValueType
Description string
// Options carries provider-specific write options (e.g. AWS param Tier,
// DataType). They are passed through to the provider unchanged.
Options []provider.WriteOption
}
CreateInput holds input for the create use case.
type CreateOutput ¶ added in v0.5.0
CreateOutput holds the result of the create use case.
type CreateUseCase ¶ added in v0.5.0
CreateUseCase executes create operations.
func (*CreateUseCase) Execute ¶ added in v0.5.0
func (u *CreateUseCase) Execute(ctx context.Context, input CreateInput) (*CreateOutput, error)
Execute runs the create use case. It creates a new parameter via the provider; if the parameter already exists the provider returns a wrapped provider.ErrAlreadyExists and no overwrite occurs.
type DeleteInput ¶
type DeleteInput struct {
Name string
}
DeleteInput holds input for the delete use case.
type DeleteOutput ¶
type DeleteOutput struct {
Name string
}
DeleteOutput holds the result of the delete use case.
type DeleteUseCase ¶
DeleteUseCase executes delete operations.
func (*DeleteUseCase) Execute ¶
func (u *DeleteUseCase) Execute(ctx context.Context, input DeleteInput) (*DeleteOutput, error)
Execute runs the delete use case.
func (*DeleteUseCase) GetCurrentValue ¶
GetCurrentValue fetches the current value for preview. A non-existent parameter yields an empty value with no error; any other read failure is propagated.
type DiffInput ¶
type DiffInput struct {
Spec1 *awsparamversion.Spec
Spec2 *awsparamversion.Spec
}
DiffInput holds input for the diff use case.
type DiffOutput ¶
type DiffOutput struct {
OldName string
OldVersion int64
OldValue string
NewName string
NewVersion int64
NewValue string
// Secret reports whether either version is a SecureString (secret) value, so
// a consumer masks both sides before rendering the diff. A SecureString param
// is a secret on the value-type axis even though it lives on the param service
// axis, so masking must key off this flag, not the service (#677/#702).
Secret bool
}
DiffOutput holds the result of the diff use case.
type DiffUseCase ¶
DiffUseCase executes diff operations.
func (*DiffUseCase) Execute ¶
func (u *DiffUseCase) Execute(ctx context.Context, input DiffInput) (*DiffOutput, error)
Execute runs the diff use case.
type ListEntry ¶
type ListEntry struct {
Name string
Value *string // nil when error or not requested
// Type is the provider-neutral value type. It is only known when values are
// fetched (WithValue); for name-only listings it stays the zero value.
Type domain.ValueType
Error error
}
ListEntry represents a single parameter in list output.
type ListInput ¶
type ListInput struct {
Prefix string
Recursive bool
Filter string // Regex filter pattern
WithValue bool // Include parameter values
}
ListInput holds input for the list use case.
type ListOutput ¶
type ListOutput struct {
Entries []ListEntry
}
ListOutput holds the result of the list use case.
type ListUseCase ¶
ListUseCase executes list operations.
func (*ListUseCase) Execute ¶
func (u *ListUseCase) Execute(ctx context.Context, input ListInput) (*ListOutput, error)
Execute runs the list use case.
type LogEntry ¶
type LogEntry struct {
Version int64
Type domain.ValueType
Value string
LastModified *time.Time
IsCurrent bool
Error error // Error from fetching value, if any
}
LogEntry represents a single version entry.
type LogInput ¶
type LogInput struct {
Name string
MaxResults int32
Since *time.Time
Until *time.Time
Reverse bool // Reverse chronological order
}
LogInput holds input for the log use case.
type LogOutput ¶
type LogOutput struct {
Name string
Entries []LogEntry
// InitialIncluded reports whether the oldest entry in Entries is the very
// first version that ever existed. It is false when the window was cut by
// --number or a date filter, so the oldest shown version is not a creation.
InitialIncluded bool
}
LogOutput holds the result of the log use case.
type LogUseCase ¶
LogUseCase executes log operations.
func (*LogUseCase) Execute ¶
Execute runs the log use case.
It fetches the version history (newest first) via the provider, applies the date filters, then retrieves each surviving version's value and type. The provider's History exposes only version metadata (id/created), so values are fetched per version via Resolve+Get. A per-version fetch failure is recorded on the entry's Error field rather than aborting the whole listing.
type ShowInput ¶
type ShowInput struct {
Spec *awsparamversion.Spec
}
ShowInput holds input for the show use case.
type ShowOutput ¶
type ShowOutput struct {
Name string
Value string
Version int64
Type domain.ValueType
Description string
LastModified *time.Time
Tags []ShowTag
}
ShowOutput holds the result of the show use case.
type ShowUseCase ¶
ShowUseCase executes show operations.
func (*ShowUseCase) Execute ¶
func (u *ShowUseCase) Execute(ctx context.Context, input ShowInput) (*ShowOutput, error)
Execute runs the show use case.
type TagInput ¶ added in v0.2.0
type TagInput struct {
Name string
Add map[string]string // Tags to add or update
Remove []string // Tag keys to remove
}
TagInput holds input for the tag use case.
type TagUseCase ¶ added in v0.2.0
TagUseCase executes tag operations.
type UpdateInput ¶ added in v0.5.0
type UpdateInput struct {
Name string
Value string
Type domain.ValueType
Description string
// PreserveType, when true, keeps the existing parameter's type instead of
// applying Type. `aws param update` sets it when neither --type nor --secure
// is given, so a value-only update never downgrades an existing SecureString
// (dropping KMS encryption) or StringList to String. Callers that pass an
// explicit type (GUI, TUI) leave it false and Type is applied as-is.
PreserveType bool
// Options carries provider-specific write options (e.g. AWS param Tier,
// DataType). They are passed through to the provider unchanged.
Options []provider.WriteOption
}
UpdateInput holds input for the update use case.
type UpdateOutput ¶ added in v0.5.0
UpdateOutput holds the result of the update use case.
type UpdateUseCase ¶ added in v0.5.0
UpdateUseCase executes update operations.
func (*UpdateUseCase) Execute ¶ added in v0.5.0
func (u *UpdateUseCase) Execute(ctx context.Context, input UpdateInput) (*UpdateOutput, error)
Execute runs the update use case. It updates an existing parameter; if the parameter doesn't exist it returns ErrParameterNotFound. A read failure other than not-found is propagated unchanged (never treated as "does not exist").
func (*UpdateUseCase) GetCurrentValue ¶ added in v0.8.0
GetCurrentValue fetches the current parameter value for preview. A non-existent parameter yields an empty value with no error; any other read failure is propagated.