credentialgen

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

func Install

func Install[B Binder](s *Slot[B], host any)

Install records host, the controller that embeds s. Call it once, during construction.

Types

type Binder

type Binder interface {
	BindCredentials(host any, provider Provider) Publisher
}

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

type Publisher = func(id string, publish func()) bool

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.

func Bind

func Bind(h any, provider Provider) Publisher

Bind installs provider on h, or uninstalls the current one when provider is nil. It returns nil when h is not a controller or installs no hook.

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.

Jump to

Keyboard shortcuts

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