Documentation
¶
Overview ¶
Package credentialgen is the module-internal seam between the managed resource controller and the SDK's credential capability. It lets the credential package attach sources to native client generations without exporting a hook that a plugin author could implement, install, uninstall or call. Code outside this module cannot import the package, name its types or reach its unexported methods, so the seam stays out of the author-facing API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindSources ¶
func BindSources(c, provider any)
BindSources hands c, which may wrap an embedded consumer, to its binder with the controller provider, or with nil to detach it. A value that does not embed a Consumer is ignored.
Types ¶
type Binder ¶
Binder is a controller package's static binder: a zero-size type whose method reaches that package's unexported bind function for host, the controller the slot was installed with. It installs provider and returns the Publisher that shares the controller's registry lock. A nil provider uninstalls. It returns nil when the controller manages no clients and so installs no hook.
type Consumer ¶
type Consumer[B SourceBinder] struct{}
Consumer is embedded through a private alias in the credential plugin to mark it as a consumer of sources. The type argument selects the binder at compile time, so a zero-value marker in a struct literal is already complete and the package holds no state. Its method is unexported.
type Provider ¶
type Provider interface {
// Snapshot the binding at generation creation. Decorate the acquisition
// context later, with the initiating caller's deadline (zero if absent).
SnapshotCredentialSources(ctx context.Context, id string) func(context.Context, time.Time) context.Context
// Retire sources when their configured profile changes or disappears.
RetireCredentialSources(id string)
// Map credential failures leaving native hooks to reviewed resource classes.
CredentialStartError(err error) error
}
Provider supplies per-generation credential sources. Snapshot and retirement run under the registry lock: they must only access local state, never call the host, run a native callback or reenter the controller.
type Publisher ¶
Publisher runs publish under the controller's registry lock when id is still a configured, unchanged connection of an open controller. It reports whether publish ran. publish must only update local state.
type Slot ¶
type Slot[B Binder] struct { // contains filtered or unexported fields }
Slot is embedded through a private alias in a controller. The type argument selects the binder at compile time, so installing it allocates nothing and the package holds no state. Its methods are unexported, so embedding exposes nothing outside this package.
type SourceBinder ¶
type SourceBinder interface {
BindSources(consumer, provider any)
}
SourceBinder is the consumer package's static binder: a zero-size type whose method reaches that package's unexported registration wiring.