lookupchain

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceEnv     = "env"
	SourceKeyring = "keyring"
	SourceStatic  = "static"
	SourceGoogle  = "google"
)

Variables

This section is empty.

Functions

func IsNotFoundErr

func IsNotFoundErr(err error) bool

Types

type Config

type Config []ConfigEntry

func Default

func Default(in []Source) Config

Default constructs a partially marshalled Config from a slice of specific config entries.

type ConfigEntry

type ConfigEntry struct {
	// Source is the name of the source used to look up the secret.
	Source string `json:"source"`
	json.RawMessage
}

ConfigEntry is a single entry in the lookup chain. This form is used when unmarshalling the config.

func (*ConfigEntry) UnmarshalJSON added in v0.0.7

func (c *ConfigEntry) UnmarshalJSON(data []byte) error

type Env

type Env struct {
	// Source is the name of the source used to look up the secret.
	// It must be "env".
	Source string `json:"source"`
	// Name is the name of the environment variable to look up.
	Name string `json:"name"`
	// Binding binds the value of the environment variable to a well-known name in the helper.
	// If not specified, the value is bound to the default secret of the helper.
	Binding string `json:"binding,omitempty"`
}

func (*Env) Canonicalize

func (e *Env) Canonicalize()

func (*Env) Lookup

func (e *Env) Lookup(binding string) (string, error)

func (*Env) SetupInstructions

func (e *Env) SetupInstructions(binding string) (string, bool)

type Google added in v0.0.7

type Google struct {
	// Source must be "google".
	Source string `json:"source"`

	// TokenType selects which kind of token to mint: "access" (default) or "id" / "jwt".
	TokenType string `json:"token_type,omitempty"`

	// Scopes are defined in
	// https://developers.google.com/identity/protocols/oauth2/scopes
	Scopes []string `json:"scopes,omitempty"`

	// Audience is the OIDC target audience.
	// It is used when minting an ID token.
	Audience string `json:"audience,omitempty"`

	// Binding binds the value to a well-known name in the helper.
	// If not specified, the value is bound to the default secret of the helper.
	Binding string `json:"binding,omitempty"`
}

func (*Google) Canonicalize added in v0.0.7

func (g *Google) Canonicalize()

func (*Google) Lookup added in v0.0.7

func (g *Google) Lookup(binding string) (string, error)

func (*Google) SetupInstructions added in v0.0.7

func (g *Google) SetupInstructions(binding string) (string, bool)

type GoogleTokenResponse added in v0.0.8

type GoogleTokenResponse struct {
	IdentityToken string `json:"id_token,omitempty"`
	oauth2.Token
}

type Keyring

type Keyring struct {
	// Source is the name of the source used to look up the secret.
	// It must be "keyring".
	Source string `json:"source"`
	// Service is the name of the key to look up in the keyring.
	Service string `json:"service"`
	// Binding binds the value of the keyring secret to a well-known name in the helper.
	// If not specified, the value is bound to the default secret of the helper.
	Binding string `json:"binding,omitempty"`
}

func (*Keyring) Canonicalize

func (k *Keyring) Canonicalize()

func (*Keyring) Lookup

func (k *Keyring) Lookup(binding string) (string, error)

func (*Keyring) SetupInstructions

func (e *Keyring) SetupInstructions(binding string) (string, bool)

type LookupChain

type LookupChain struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) *LookupChain

func (*LookupChain) Lookup

func (c *LookupChain) Lookup(binding string) (string, error)

Lookup looks up a binding in the chain. It returns the first value found, or an error.

func (*LookupChain) SetupInstructions

func (c *LookupChain) SetupInstructions(binding, meaning string) string

type NotFoundErr

type NotFoundErr struct {
	// contains filtered or unexported fields
}

func (*NotFoundErr) Error

func (e *NotFoundErr) Error() string

type Source

type Source interface {
	Lookup(binding string) (string, error)
	Canonicalize()
	SetupInstructions(binding string) (string, bool)
}

type Static

type Static struct {
	// Source is the name of the source used to look up the secret.
	// It must be "static".
	Source string `json:"source"`
	// Value is the static value to return.
	Value string `json:"name"`
	// Binding binds the value of the environment variable to a well-known name in the helper.
	// If not specified, the value is bound to the default secret of the helper.
	Binding string `json:"binding,omitempty"`
}

func (*Static) Canonicalize

func (s *Static) Canonicalize()

func (*Static) Lookup

func (s *Static) Lookup(binding string) (string, error)

func (*Static) SetupInstructions

func (s *Static) SetupInstructions(binding string) (string, bool)

Jump to

Keyboard shortcuts

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