Documentation
¶
Overview ¶
Package gcloud provides use cases for Google Cloud Secret Manager operations.
The use cases are written against the provider-neutral Reader/Writer/Store interfaces, exactly like the AWS secret use cases, but expose Google Cloud-shaped outputs: integer versions, no ARN, no staging labels. The per-version state (enabled/disabled/destroyed) is surfaced where the provider supplies it via the neutral Version.State.
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 ShowInput
- type ShowOutput
- type ShowTag
- type ShowUseCase
- type UpdateInput
- type UpdateOutput
- type UpdateUseCase
Constants ¶
This section is empty.
Variables ¶
var ErrSecretNotFound = errors.New("secret not found")
ErrSecretNotFound is returned by the update use case when the target secret does not exist.
Functions ¶
This section is empty.
Types ¶
type CreateInput ¶
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
}
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. Google Cloud deletion is permanent (no recovery window).
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 *gcloudversion.Spec
Spec2 *gcloudversion.Spec
}
DiffInput holds input for the diff use case.
type DiffOutput ¶
type DiffOutput struct {
OldName string
OldVersion string
OldValue string
NewName string
NewVersion 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)
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
}
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 name prefix filter and the client-side regex filter are applied here.
type LogEntry ¶
type LogEntry struct {
Version string
State string // enabled/disabled/destroyed, may be ""
Value string
CreatedDate *time.Time
Error error // Error from fetching value, if any (e.g. disabled/destroyed versions)
}
LogEntry represents a single version entry.
type LogInput ¶
type LogInput struct {
Name string
MaxResults int32
Since *time.Time
Until *time.Time
Reverse bool
}
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: fetch the version history (newest first), cap to MaxResults, optionally reverse, apply date filters, then retrieve each surviving version's value. A per-version fetch failure (common for disabled or destroyed versions, whose values are inaccessible) is recorded on the entry's Error field rather than aborting the whole listing.
type ShowInput ¶
type ShowInput struct {
Spec *gcloudversion.Spec
}
ShowInput holds input for the show use case.
type ShowOutput ¶
type ShowOutput struct {
Name string
Value string
Version string // integer version number, or "" for an unknown/latest version
State string // enabled/disabled/destroyed (best-effort), may be ""
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. Integer-version and ~shift resolution are provided by the adapter behind provider.Reader.
type UpdateInput ¶
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 adds a new version to an existing secret; if the secret doesn't exist it returns ErrSecretNotFound. A read failure other than not-found is propagated unchanged.
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.