Documentation
¶
Overview ¶
Package binding is the single per-(provider, service kind) lookup that the CLI, GUI and TUI share. For each provider and kind it owns:
- the version grammar that splits "name#VERSION~SHIFT" into the name and the suffix the use cases take (SplitSpec),
- the store-less parser (status, reset, export/import parsing),
- the staging strategy built over a resolved provider.Store,
- the scope that keys on-disk staging state, derived from the selected scope (Azure keys its two services in separate buckets; AWS keys by the caller identity, which needs a network lookup),
- the namespace override for a service with a namespace axis inside one store (Azure App Configuration).
An unknown provider is an error (ErrUnknownProvider). A known provider that does not offer a kind is provider.ErrUnsupportedKind. There is no default provider.
The package imports no cloud SDK directly. The AWS identity lookup goes through aws.LoadIdentity (internal/provider/aws), which loads the AWS config and calls STS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownProvider = errors.New("unknown provider")
ErrUnknownProvider is returned for a provider that has no staging binding (an unknown or unselected provider).
Functions ¶
func ResolveTarget ¶
func ResolveTarget(ctx context.Context, sc provider.Scope, lookup IdentityLookup) (provider.Target, error)
ResolveTarget describes what the selected scope sc points at, running the provider's identity lookup when sc cannot describe itself (AWS: the STS caller identity fills the profile, account and region). lookup replaces the default lookup, as in StagingScope, so a caller can share one memoized lookup between staging and display.
func StagingScope ¶
func StagingScope(ctx context.Context, sc provider.Scope, kind provider.Kind, lookup IdentityLookup) (staging.ResolvedScope, error)
StagingScope resolves the scope that keys kind's staging state for the selected scope sc, plus the confirmation target. It fails only for an unknown provider: a known provider keys a kind it does not offer under the selected scope, and the parser or strategy lookup rejects that kind instead.
lookup replaces the provider's default identity lookup (for memoizing or stubbing it); nil uses the default. It runs only when sc cannot key staging by itself.
Types ¶
type Binding ¶
type Binding struct {
// SplitSpec splits a version spec into its name and the version suffix the
// use cases take, with the product's grammar (a version grammar's Split).
// An unversioned service (Azure App Configuration) keeps the whole argument
// as the name, so a key that contains '#' or '~' is not split. It is a
// field rather than a method because only the build-tagged GUI calls it,
// and the default-build dead-code gate cannot see that caller.
SplitSpec func(input string) (name, suffix string, err error)
// contains filtered or unexported fields
}
Binding is the staging binding for one (provider, kind) pair. Get one from Lookup.
func (Binding) NamespaceScope ¶
NamespaceScope returns sc with its namespace set to ns when the service has a namespace axis. For every other service it returns sc unchanged.
func (Binding) Namespaced ¶
Namespaced reports whether the service has a namespace axis for the selected scope, so staged entries must apply under their own namespace.
func (Binding) ParserFactory ¶
func (b Binding) ParserFactory() staging.ParserFactory
ParserFactory returns the parser constructor, for configs that take a staging.ParserFactory.
type IdentityLookup ¶
type IdentityLookup func(ctx context.Context) (staging.ResolvedScope, error)
IdentityLookup resolves the account-level staging scope for a provider whose selected scope does not carry it (AWS: the STS caller identity). Callers may pass their own to memoize or stub the lookup.
func DefaultIdentity ¶
func DefaultIdentity(p provider.Provider) IdentityLookup
DefaultIdentity returns the provider's default identity lookup, for a caller that wraps it (for example to memoize it). It returns a lookup that fails for an unknown provider or one that never needs a lookup.