common

package module
v0.0.0-...-8321af7 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 27 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version    string = "???"
	CommitHash string = "???"
)
View Source
var SourceTypes = []string{"KMS", "SSM", "SECRETS_MANAGER", "FILE"}

Functions

func AssumeRoleConfig

func AssumeRoleConfig(sessionFlags *SessionFlags, sess *session.Session) *aws.Config

func DecryptWithKMS

func DecryptWithKMS(kmsClient *kms.KMS, ciphertext string) ([]byte, error)

func EncryptWithKMSAndSecretBox

func EncryptWithKMSAndSecretBox(kmsClient *kms.KMS, plaintext []byte, keyId string) (string, error)

func FatalOnError

func FatalOnError(err error)

func FatalOnErrorW

func FatalOnErrorW(err error, msg string)

func Fatalln

func Fatalln(message string)

func FlattenEnvVarMap

func FlattenEnvVarMap(input map[string]interface{}) (map[string]string, error)

func FlattenMap

func FlattenMap(input map[string]interface{}, transformKey func(string) string, separator string) (map[string]string, error)

func HandleInfoFlags

func HandleInfoFlags(flags *InfoFlags)

func HandleLogFlags

func HandleLogFlags(flags *LogFlags)

func LoadJSON

func LoadJSON(filename string, res interface{}) error

func NewConfig

func NewConfig(region string) *aws.Config

func NewSession

func NewSession(region string) (*session.Session, error)

func OpenSession

func OpenSession(sessionFlags *SessionFlags) (*session.Session, *aws.Config)

func RefreshMap

func RefreshMap(src map[string]interface{}, state *RefreshState) (map[string]interface{}, error)

func ReplaceAccountID

func ReplaceAccountID(arn, accountID string) (string, error)

func ReplaceAccountIDPtr

func ReplaceAccountIDPtr(arn *string, accountID string) (*string, error)

func STSFetchIdentityURL

func STSFetchIdentityURL(identityURL string, maxAge time.Duration) (*sts.GetCallerIdentityOutput, error)

func STSGetIdentityURL

func STSGetIdentityURL(stsClient *sts.STS) (string, error)

func TransformKeyEnvVar

func TransformKeyEnvVar(key string) string

func VersionString

func VersionString() string

Types

type ARN

type ARN struct {
	Partition    string
	Service      string
	Region       string
	AccountID    string
	ResourceType string
	Resource     string
	Qualifier    string
}

func ParseARN

func ParseARN(arn string) (*ARN, error)

func (*ARN) String

func (a *ARN) String() string

type ConfigValues

type ConfigValues struct {
	Sources       map[string][]Source
	Static        map[string]interface{}
	MaxRetries    int
	KeyPrefixes   map[string]string
	ValuePrefixes map[string]string
	Settings      map[string]string
}

func NewConfigValues

func NewConfigValues() *ConfigValues

func (*ConfigValues) Clear

func (c *ConfigValues) Clear()

func (*ConfigValues) GenerateFromMap

func (c *ConfigValues) GenerateFromMap(src map[string]interface{}) (map[string]interface{}, error)

func (*ConfigValues) IsRefreshable

func (c *ConfigValues) IsRefreshable() bool

func (*ConfigValues) Refresh

func (c *ConfigValues) Refresh(session *session.Session, conf *aws.Config, output interface{}) error

func (*ConfigValues) RefreshWithRetries

func (c *ConfigValues) RefreshWithRetries(session *session.Session, conf *aws.Config, output interface{}) error

func (*ConfigValues) SetFromEnvironment

func (c *ConfigValues) SetFromEnvironment() error

func (*ConfigValues) SetFromJSON

func (c *ConfigValues) SetFromJSON(filename string) error

func (*ConfigValues) SetFromMap

func (c *ConfigValues) SetFromMap(m map[string]interface{}) error

type InfoFlags

type InfoFlags struct {
	Version *bool
}

func KingpinInfoFlags

func KingpinInfoFlags() *InfoFlags

type LogFlags

type LogFlags struct {
	LogLevel  *string
	LogFormat *string
}

func KingpinLogFlags

func KingpinLogFlags() *LogFlags

type RefreshState

type RefreshState struct {
	Session              *session.Session
	Config               *aws.Config
	STSClient            *sts.STS
	SecretsManagerClient *secretsmanager.SecretsManager
	KMSClient            *kms.KMS
	SSMClient            *ssm.SSM
	Settings             map[string]string
}

type SessionFlags

type SessionFlags struct {
	RoleArn         *string
	RoleExternalID  *string
	RoleSessionName *string
	RolePolicy      *string
	Region          *string
	MFASerialNumber *string
	MFATokenCode    *string
	Duration        *time.Duration
}

func HandleFlags

func HandleFlags() *SessionFlags

func KingpinSessionFlags

func KingpinSessionFlags() *SessionFlags

type SessionTokenProvider

type SessionTokenProvider struct {
	SessionFlags *SessionFlags
	Session      *session.Session
}

func (*SessionTokenProvider) IsExpired

func (p *SessionTokenProvider) IsExpired() bool

func (*SessionTokenProvider) Retrieve

func (p *SessionTokenProvider) Retrieve() (credentials.Value, error)

type Source

type Source struct {
	Type       string
	Name       string
	Identifier string
	Collapse   bool
}

Jump to

Keyboard shortcuts

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