azure

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 11 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 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
	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
}

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 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