Documentation
¶
Overview ¶
Package secret provides use cases for Secrets Manager operations.
Index ¶
- Variables
- 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 RestoreInput
- type RestoreOutput
- type RestoreUseCase
- 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 ( // ErrSecretNotFound is returned when a secret is not found. ErrSecretNotFound = errors.New("secret not found") )
Functions ¶
This section is empty.
Types ¶
type CreateInput ¶
type CreateInput struct {
Name string
Value string
Description string
// Options carries provider-specific write options (e.g. AWS Secrets Manager
// KMS key, rotation). They are passed through to the provider unchanged.
Options []provider.WriteOption
}
CreateInput holds input for the create use case.
type CreateOutput ¶
CreateOutput holds the result of the create use case.
type CreateUseCase ¶
CreateUseCase executes create operations.
func (*CreateUseCase) Execute ¶
func (u *CreateUseCase) Execute(ctx context.Context, input CreateInput) (*CreateOutput, error)
Execute runs the create use case. It creates a new secret via the provider; if the secret already exists the provider returns a wrapped provider.ErrAlreadyExists and no overwrite occurs.
type DeleteInput ¶
type DeleteInput struct {
Name string
// Options carries provider-specific delete options (e.g. AWS Secrets Manager
// ForceDelete / RecoveryWindow). They are passed through to the provider
// unchanged.
Options []provider.DeleteOption
}
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. Deletion behavior (force / recovery window) is carried by the provider.DeleteOptions in the input.
func (*DeleteUseCase) GetCurrentValue ¶
GetCurrentValue fetches the current secret value for preview. A non-existent secret yields an empty value with no error; any other read failure is propagated.
type DiffInput ¶
type DiffInput struct {
Spec1 *secretversion.Spec
Spec2 *secretversion.Spec
}
DiffInput holds input for the diff use case.
type DiffOutput ¶
type DiffOutput struct {
OldName string
OldVersionID string
OldValue string
NewName string
NewVersionID string
NewValue string
}
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 ListInput ¶
type ListInput struct {
Prefix string // Name prefix filter (case-sensitive), replicating the AWS name filter
Filter string // Regex filter pattern (client-side)
WithValue bool // Include secret values
}
ListInput holds input for the list use case.
type ListOutput ¶
type ListOutput struct {
Entries []ListEntry
NextToken string // Retained for API compatibility; always empty (provider lists all names)
}
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.
The provider returns every secret name; the AWS-style name prefix filter and the client-side regex filter are applied here, matching the pre-migration behavior (the old AWS name filter is a case-sensitive prefix match).
type LogEntry ¶
type LogEntry struct {
VersionID string
VersionStage []string
Value string
CreatedDate *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 LogUseCase ¶
LogUseCase executes log operations.
func (*LogUseCase) Execute ¶
Execute runs the log use case.
It fetches the version history (newest first) via the provider, caps it to MaxResults, optionally reverses it, applies the date filters, then retrieves each surviving version's value. A per-version fetch failure is recorded on the entry's Error field rather than aborting the whole listing.
type RestoreInput ¶
type RestoreInput struct {
Name string
}
RestoreInput holds input for the restore use case.
type RestoreOutput ¶
type RestoreOutput struct {
Name string
}
RestoreOutput holds the result of the restore use case.
type RestoreUseCase ¶
RestoreUseCase executes restore operations.
func (*RestoreUseCase) Execute ¶
func (u *RestoreUseCase) Execute(ctx context.Context, input RestoreInput) (*RestoreOutput, error)
Execute runs the restore use case.
type ShowInput ¶
type ShowInput struct {
Spec *secretversion.Spec
}
ShowInput holds input for the show use case.
type ShowOutput ¶
type ShowOutput struct {
Name string
ARN string
Value string
VersionID string
VersionStage []string
Description string
CreatedDate *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. Version/label/shift resolution and the ARN (surfaced via the entry's Extra metadata) are provided by the adapter behind provider.Reader.
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 ¶
type UpdateInput struct {
Name string
Value string
Description string
// Options carries provider-specific write options (e.g. AWS Secrets Manager
// KMS key, rotation). They are passed through to the provider unchanged.
Options []provider.WriteOption
}
UpdateInput holds input for the update use case.
type UpdateOutput ¶
UpdateOutput holds the result of the update use case.
type UpdateUseCase ¶
UpdateUseCase executes update operations.
func (*UpdateUseCase) Execute ¶
func (u *UpdateUseCase) Execute(ctx context.Context, input UpdateInput) (*UpdateOutput, error)
Execute runs the update use case. It updates an existing secret (new version plus, when provided, description); if the secret doesn't exist it returns ErrSecretNotFound. A read failure other than not-found is propagated unchanged (never treated as "does not exist").
func (*UpdateUseCase) GetCurrentValue ¶
GetCurrentValue fetches the current secret value for preview. A non-existent secret yields an empty value with no error; any other read failure is propagated.