source

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Keys for the map returned by Read()
	AwsAccessKeyID     string = "accessKeyId"
	AwsSecretAccessKey string = "secretAccessKey"
)
View Source
const (
	// Default values
	DefaultMaxAge time.Duration = 100 * time.Minute
)
View Source
const (
	Secret string = "secret"
)

Keys for the map returned by Read()

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsIamSource

type AwsIamSource struct {
	UserName   string         `yaml:"username"`
	RoleArn    string         `yaml:"role_arn"`
	ExternalID string         `yaml:"external_id"`
	Client     *cziAws.Client `yaml:"client"`
	MaxAge     time.Duration  `yaml:"max_age"`
}

func NewAwsIamSource

func NewAwsIamSource() *AwsIamSource

func (*AwsIamSource) Kind

func (src *AwsIamSource) Kind() Kind

func (*AwsIamSource) Read

func (src *AwsIamSource) Read() (map[string]string, error)

func (*AwsIamSource) RotateKeys

func (src *AwsIamSource) RotateKeys(ctx context.Context) (*iam.AccessKey, error)

RotateKeys rotates the AWS IAM keys for the user specified in src. It returns any new key created and any error encountered. If the user has less than two keys, RotateKeys creates a new key. If the user has two keys, RotateKeys checks if the older key is older than the MaxAge specified in src. If so, RotateKeys deletes that key and returns a new key, else it does nothing and returns a nil key.

func (*AwsIamSource) WithAwsClient

func (src *AwsIamSource) WithAwsClient(client *cziAws.Client) *AwsIamSource

func (*AwsIamSource) WithMaxAge

func (src *AwsIamSource) WithMaxAge(maxAge time.Duration) *AwsIamSource

func (*AwsIamSource) WithRoleArn

func (src *AwsIamSource) WithRoleArn(roleArn string) *AwsIamSource

func (*AwsIamSource) WithUserName

func (src *AwsIamSource) WithUserName(userName string) *AwsIamSource

type DummySource

type DummySource struct{}

A DummySource represents a source that generates random data.

func (*DummySource) Kind

func (src *DummySource) Kind() Kind

func (*DummySource) Read

func (src *DummySource) Read() (map[string]string, error)

Read returns a random number of length 16.

type Env added in v0.1.0

type Env struct {
	Name string `yaml:"name"`
}

Env is a source that reads an environment variable

func NewEnvSource added in v0.1.0

func NewEnvSource() *Env

NewEnvSource returns a new env soruce

func (*Env) Kind added in v0.1.0

func (e *Env) Kind() Kind

Kind returns the kind of this source

func (*Env) Read added in v0.1.0

func (e *Env) Read() (map[string]string, error)

func (*Env) WithName added in v0.1.0

func (e *Env) WithName(name string) *Env

WithName sets Env's target environment variable

type Error

type Error string
const (
	ErrUnknownKind Error = "unknown source"
)

func (Error) Error

func (e Error) Error() string

type Kind

type Kind string
const (
	KindDummy Kind = "dummy"
	KindAws   Kind = "aws"
	KindEnv   Kind = "env"
)

type Source

type Source interface {
	Read() (map[string]string, error)
	Kind() Kind
}

Source is the interface for all credential sources.

Read reads the secret from the underlying source. It returns the secret and any error encountered that caused the read to stop early.

Kind returns the kind of sink.

Jump to

Keyboard shortcuts

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