aws

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigRootACM = "aws"
)
View Source
const FxGroup = `aws`

Variables

View Source
var Module = &bootstrap.Module{
	Name:       "AWS",
	Precedence: bootstrap.AwsPrecedence,
	Options: []fx.Option{
		fx.Provide(BindAwsProperties, ProvideConfigLoader),
	},
}

Functions

func FxCustomizerProvider

func FxCustomizerProvider(constructor interface{}) fx.Annotated

func LoadConfig

func LoadConfig(ctx context.Context, opts ...config.LoadOptionsFunc) (aws.Config, error)

func NewEnvCredentialsProvider

func NewEnvCredentialsProvider() aws.CredentialsProvider

func NewStsCredentialsProvider

func NewStsCredentialsProvider(ctx context.Context, p *Properties, opts ...config.LoadOptionsFunc) (aws.CredentialsProvider, error)

func WithBasicProperties

func WithBasicProperties(p *Properties) config.LoadOptionsFunc

func WithCredentialsProperties

func WithCredentialsProperties(ctx context.Context, p *Properties, globalOpts ...config.LoadOptionsFunc) config.LoadOptionsFunc

Types

type CfgLoaderDI

type CfgLoaderDI struct {
	fx.In
	Properties  Properties
	Customizers []config.LoadOptionsFunc `group:"aws"`
}

type ConfigLoader

type ConfigLoader interface {
	Load(ctx context.Context, opts ...config.LoadOptionsFunc) (aws.Config, error)
}

func NewConfigLoader

func NewConfigLoader(p Properties, customizers ...config.LoadOptionsFunc) ConfigLoader

func ProvideConfigLoader

func ProvideConfigLoader(di CfgLoaderDI) ConfigLoader

type Credentials

type Credentials struct {
	//Type is one of static, env or sts.  Defaults to env.
	Type CredentialsType `json:"type"`

	//The following is only relevant to static credential
	//Id is the AWS_ACCESS_KEY_ID for the account
	Id string `json:"id"`
	//Secret is the AWS_SECRET_ACCESS_KEY
	Secret string `json:"secret"`

	//The follow is relevant to sts credentials (Used in EKS)
	//RoleARN defines role to be assumed by application if omitted environment variable AWS_ROLE_ARN will be used
	RoleARN string `json:"role-arn"`
	//TokenFile is the path to the STS OIDC token file if omitted environment variable AWS_WEB_IDENTITY_TOKEN_FILE will be used
	TokenFile string `json:"token-file"`
	//RoleSessionName username to associate with session e.g. service account
	RoleSessionName string `json:"role-session-name"`
}

Credentials defines the type of credentials to use for AWS

type CredentialsType

type CredentialsType string
const (
	CredentialsTypeStatic CredentialsType = `static`
	CredentialsTypeSTS    CredentialsType = `sts`
)

type Properties

type Properties struct {
	//Region for AWS client defaults to us-east-1
	Region string `json:"region"`
	//Endpoint for AWS client default empty can be used to override if consuming localstack
	Endpoint string `json:"endpoint"`
	//Credentials to be used to authenticate the AWS client
	Credentials Credentials `json:"credentials"`
}

Properties describes common config used to consume AWS services

func BindAwsProperties

func BindAwsProperties(ctx *bootstrap.ApplicationContext) Properties

func NewProperties

func NewProperties() Properties

type PropertiesBasedConfigLoader

type PropertiesBasedConfigLoader struct {
	Properties  *Properties
	Customizers []config.LoadOptionsFunc
}

func (*PropertiesBasedConfigLoader) Load

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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