credentials

package
v0.19.1303 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 10 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureContext

func EnsureContext(ctx context.Context, cfg *Config) (context.Context, error)

EnsureContext adds credentials into the context if they do not exist

func Fetch

func Fetch(ctx context.Context, cfg *Config) (aws.Config, error)

Fetch is used to get credentials, regardless of whether they are in the context, or not. Compared to FromContext, this will _always_ attempt to return credentials, where as if creds are not in a context, they will not be fetched in FromContext

func FetchEnv

func FetchEnv(ctx context.Context, cfg *Config) (map[string]string, error)

func FromContext

func FromContext(ctx context.Context, cfg *Config) (aws.Config, error)

FromContext fetches credentials from the context

Types

type AssumeRoleConfig

type AssumeRoleConfig struct {
	RoleARN                string `cty:"arn" hcl:"role_arn" validate:"required" mapstructure:"role_arn,omitempty" json:"role_arn" temporaljson:"role_arn"`
	SessionName            string `` /* 143-byte string literal not displayed */
	SessionDurationSeconds int    `` /* 183-byte string literal not displayed */
	ExternalID             string `` /* 127-byte string literal not displayed */

	// configuration for two stepping before assuming this role
	TwoStepConfig *assumerole.TwoStepConfig `` /* 138-byte string literal not displayed */
	UseGithubOIDC bool                      `json:"use_github_oidc"`
	UseGCPOIDC    bool                      `json:"use_gcp_oidc"`

	// SessionPolicy limits the credentials from this assume. It stays out of
	// plan JSON; the runner receives the token these credentials mint, not the role.
	SessionPolicy string `cty:"-" hcl:"-" mapstructure:"-" json:"-" temporaljson:"session_policy"`
}

AssumeRoleConfig is used for assuming an IAM role

type Config

type Config struct {
	Static     *StaticCredentials `cty:"static,block" hcl:"static,block" mapstructure:"static,omitempty" json:"static" temporaljson:"static"`
	AssumeRole *AssumeRoleConfig  `` /* 130-byte string literal not displayed */
	// If profile is provided, we'll use that profile over the default credentials
	Profile    string `` /* 136-byte string literal not displayed */
	UseDefault bool   `` /* 136-byte string literal not displayed */

	// when cache ID is set, these credentials will be reused, up to the duration of the sessionTimeout (or default)
	CacheID string `` /* 141-byte string literal not displayed */
	Region  string `cty:"region,optional" hcl:"region,optional" mapstructure:"region,omitempty" json:"region" temporaljson:"region"`
}

func (Config) String

func (c Config) String() string

func (*Config) Validate

func (c *Config) Validate(v *validator.Validate) error

type ContextKey

type ContextKey struct {
	ID string
}

ContextKey is used to manage the credentials in the context

type ErrUnableToAssumeRole

type ErrUnableToAssumeRole struct {
	RoleARN string
	Err     error
}

func (ErrUnableToAssumeRole) Error

func (e ErrUnableToAssumeRole) Error() string

func (ErrUnableToAssumeRole) Unwrap

func (e ErrUnableToAssumeRole) Unwrap() error

type ErrUnableToFetchStatic

type ErrUnableToFetchStatic struct {
	Err error
}

func (ErrUnableToFetchStatic) Error

func (e ErrUnableToFetchStatic) Error() string

func (ErrUnableToFetchStatic) Unwrap

func (e ErrUnableToFetchStatic) Unwrap() error

type StaticCredentials

type StaticCredentials struct {
	AccessKeyID     string `` /* 145-byte string literal not displayed */
	SecretAccessKey string `` /* 161-byte string literal not displayed */
	SessionToken    string `` /* 140-byte string literal not displayed */
}

StaticCredentials are used to create credentials ahead of time, and pass them around for use. Specifically, we do this for creating credentials with an IAM role in our infra, so a plugin can push data back.

Jump to

Keyboard shortcuts

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