azure

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package azure provides use cases for the two Azure adapters (Key Vault secrets and App Configuration params).

The use cases are written against the provider-neutral Reader/Writer/Store interfaces. Unlike the Google Cloud use cases they take a pre-reconstructed version suffix string (e.g. "#abc123", "~2", or "") rather than a typed spec: the two Azure services use different version grammars (Key Vault has opaque version ids; App Configuration has none), so decoupling the use cases from the spec type lets a single package serve both CLI groups. The CLI presenters own the typed spec and hand the suffix here.

Index

Constants

This section is empty.

Variables

View Source
var ErrEntryNotFound = errors.New("entry not found")

ErrEntryNotFound is returned by the update use case when the target entry does not exist.

Functions

This section is empty.

Types

type CreateInput

type CreateInput struct {
	Name      string
	Value     string
	ValueType domain.ValueType // secret (Key Vault) or plaintext (App Configuration)
}

CreateInput holds input for the create use case.

type CreateOutput

type CreateOutput struct {
	Name    string
	Version string // opaque version id (Key Vault), or "" (App Configuration)
}

CreateOutput holds the result of the create use case.

type CreateUseCase

type CreateUseCase struct {
	Writer provider.Writer
}

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 entry via the provider; if the entry 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

type DeleteUseCase struct {
	Store provider.Store
}

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

func (u *DeleteUseCase) GetCurrentValue(ctx context.Context, name string) (string, error)

GetCurrentValue fetches the current value for preview. A non-existent entry yields an empty value with no error; any other read failure is propagated.

type DiffInput

type DiffInput struct {
	Name1   string
	Suffix1 string
	Name2   string
	Suffix2 string
}

DiffInput holds input for the diff use case. Each side carries its own name so that unversioned stores (App Configuration) can compare two distinct keys.

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

type DiffUseCase struct {
	Reader provider.Reader
}

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
	Error error
}

ListEntry represents a single entry in list output.

type ListInput

type ListInput struct {
	Prefix    string // Name prefix filter (case-sensitive)
	Filter    string // Regex filter pattern (client-side)
	WithValue bool   // Include values
}

ListInput holds input for the list use case.

type ListNamespacesEntry added in v1.5.2

type ListNamespacesEntry struct {
	Namespace string
	Name      string
	Value     *string
}

ListNamespacesEntry is one (key, namespace) row. Value is nil when not requested. App Configuration's list response always carries the value, so no per-entry error path exists (unlike the value-fetching neutral list).

type ListNamespacesInput added in v1.5.2

type ListNamespacesInput struct {
	Prefix    string // Name prefix filter (case-sensitive)
	Filter    string // Regex filter pattern (client-side)
	WithValue bool   // Include values (App Config's list response already carries them)
}

ListNamespacesInput holds input for the namespace-aware list use case. The namespace filter itself lives on the store (resolved from --namespace); here only the client-side key filters apply.

type ListNamespacesOutput added in v1.5.2

type ListNamespacesOutput struct {
	Entries []ListNamespacesEntry
}

ListNamespacesOutput holds the result of the namespace-aware list use case.

type ListNamespacesUseCase added in v1.5.2

type ListNamespacesUseCase struct {
	Lister NamespaceLister
}

ListNamespacesUseCase lists App Configuration settings with their namespaces.

func (*ListNamespacesUseCase) Execute added in v1.5.2

Execute runs the namespace-aware list use case. The store applies the namespace (label) filter; the name prefix and client-side regex filter are applied here, on the key.

type ListOutput

type ListOutput struct {
	Entries []ListEntry
}

ListOutput holds the result of the list use case.

type ListUseCase

type ListUseCase struct {
	Reader provider.Reader
}

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 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, may be ""
	Value       string
	CreatedDate *time.Time
	// Tags attached to THIS version. Key Vault scopes tags per version, so each
	// version carries its own set.
	Tags  []domain.Tag
	Error error // Error from fetching value, if any (e.g. disabled 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

type LogUseCase struct {
	Reader provider.Reader
}

LogUseCase executes log operations.

func (*LogUseCase) Execute

func (u *LogUseCase) Execute(ctx context.Context, input LogInput) (*LogOutput, error)

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.

Providers without version history (Azure App Configuration) return an error from History; that error is propagated here so the generic log command surfaces it cleanly instead of crashing.

type NamespaceLister added in v1.5.2

type NamespaceLister interface {
	ListWithNamespacesScoped(ctx context.Context) ([]appconfig.KeyNamespace, error)
}

NamespaceLister is the App-Config-specific extension that lists per-(key, namespace) rows honoring the store's configured --namespace filter. Only the Azure App Configuration store implements it (via ListWithNamespacesScoped); callers type-assert the resolved store to reach it. The neutral provider.Reader.List contract is untouched.

type RestoreInput added in v1.5.2

type RestoreInput struct {
	Name string
}

RestoreInput holds input for the restore use case.

type RestoreOutput added in v1.5.2

type RestoreOutput struct {
	Name string
}

RestoreOutput holds the result of the restore use case.

type RestoreUseCase added in v1.5.2

type RestoreUseCase struct {
	Restorer provider.Restorer
}

RestoreUseCase recovers a soft-deleted entry via a provider.Restorer (Azure Key Vault's RecoverDeletedSecret).

func (*RestoreUseCase) Execute added in v1.5.2

func (u *RestoreUseCase) Execute(ctx context.Context, input RestoreInput) (*RestoreOutput, error)

Execute runs the restore use case.

type ShowInput

type ShowInput struct {
	Name   string
	Suffix string // reconstructed version suffix ("#id", "~2", or "")
}

ShowInput holds input for the show use case.

type ShowOutput

type ShowOutput struct {
	Name        string
	Value       string
	Version     string // opaque version id (Key Vault), or "" (App Configuration / latest)
	State       string // enabled/disabled (Key Vault, best-effort), may be ""
	CreatedDate *time.Time
	Tags        []ShowTag
}

ShowOutput holds the result of the show use case.

type ShowTag

type ShowTag struct {
	Key   string
	Value string
}

ShowTag represents a tag key-value pair.

type ShowUseCase

type ShowUseCase struct {
	Reader provider.Reader
}

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 resolution (opaque ids and ~shift for Key Vault; latest-only for App Configuration) is provided by the adapter behind provider.Reader.

type UpdateInput

type UpdateInput struct {
	Name      string
	Value     string
	ValueType domain.ValueType // secret (Key Vault) or plaintext (App Configuration)
}

UpdateInput holds input for the update use case.

type UpdateOutput

type UpdateOutput struct {
	Name    string
	Version string // opaque version id (Key Vault), or "" (App Configuration)
}

UpdateOutput holds the result of the update use case.

type UpdateUseCase

type UpdateUseCase struct {
	Store provider.Store
}

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 entry; if the entry doesn't exist it returns ErrEntryNotFound. A read failure other than not-found is propagated unchanged.

func (*UpdateUseCase) GetCurrentValue

func (u *UpdateUseCase) GetCurrentValue(ctx context.Context, name string) (string, error)

GetCurrentValue fetches the current value for preview. A non-existent entry yields an empty value with no error; any other read failure is propagated.

Jump to

Keyboard shortcuts

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