awsUtil

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssumeRole

func AssumeRole(roleSessionName string, stsClient STSRoleAssumer, roleArn string) (*types.Credentials, error)

func AssumeRoleSequence

func AssumeRoleSequence(roleSessionName string, seedClient STSRoleAssumer, roleArnSequence []string, proxyUrl string, stsClientProviderFunc STSClientProviderFunc) (*types.Credentials, error)

func AssumeRoleWithJWT

func AssumeRoleWithJWT(jwt string, roleArn string, stsClient STSRoleWithWebIdentityAssumer) (*types.Credentials, error)

func StsClientWithProxy

func StsClientWithProxy(proxyUrl string) (*sts.Client, error)

Types

type AWSCredentialsResponse

type AWSCredentialsResponse struct {
	AccessKeyId     string `json:"AccessKeyId" yaml:"AccessKeyId"`
	SecretAccessKey string `json:"SecretAccessKey" yaml:"SecretAccessKey"`
	SessionToken    string `json:"SessionToken" yaml:"SessionToken"`
	Region          string `json:"Region,omitempty" yaml:"Region,omitempty"`
	Expiration      string `json:"Expiration,omitempty" yaml:"Expiration,omitempty"`
}

func (AWSCredentialsResponse) EnvFormat

func (r AWSCredentialsResponse) EnvFormat() string

func (AWSCredentialsResponse) RenderOutput

func (r AWSCredentialsResponse) RenderOutput(outputFormat string) (string, error)

type STSClientProviderFunc

type STSClientProviderFunc func(optFns ...func(*config.LoadOptions) error) (STSRoleAssumer, error)
var DefaultSTSClientProviderFunc STSClientProviderFunc = func(optnFns ...func(options *config.LoadOptions) error) (STSRoleAssumer, error) {
	cfg, err := config.LoadDefaultConfig(context.TODO(), optnFns...)
	if err != nil {
		return nil, fmt.Errorf("failed to load default AWS config: %w", err)
	}
	return sts.NewFromConfig(cfg), nil
}

type STSRoleAssumer

type STSRoleAssumer interface {
	AssumeRole(ctx context.Context, params *sts.AssumeRoleInput, optFns ...func(*sts.Options)) (*sts.AssumeRoleOutput, error)
}

type STSRoleWithWebIdentityAssumer

type STSRoleWithWebIdentityAssumer interface {
	AssumeRoleWithWebIdentity(ctx context.Context, params *sts.AssumeRoleWithWebIdentityInput, optFns ...func(*sts.Options)) (*sts.AssumeRoleWithWebIdentityOutput, error)
}

Jump to

Keyboard shortcuts

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