cache

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: MPL-2.0, MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	MfaSerial string

	// Role can hold any type of identifier as long as the caller can rely on its uniqueness.
	// For example, it can hold an ARN but also a comma-separated role chain composed of
	// reliable identifiers.
	Role string
}

Key contents are used to build the filename where the value is read from or written to.

All characters are allowed in the string values. The final key will be a filename-safe hash.

func (Key) String

func (k Key) String() string

type Store

type Store struct {
	Dir string
}

func NewStore

func NewStore(dir string) Store

func (Store) Read

func (s Store) Read(k Key) (v Value, err error)

Read returns the credentials triple if found by the given key.

Callers will receive three empty strings and a nil error on a cache miss. An error is returned only if the read operation failed. If the cache dir does not exist, it will be created.

func (Store) Write

func (s Store) Write(k Key, out Value) error

Write saves the credentials triple if found by the given key.

If the cache dir does not exist, it will be created.

type Value

type Value struct {
	AccessKeyID     string
	SecretAccessKey string
	SessionToken    string
	Expires         int64
}

Jump to

Keyboard shortcuts

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