awsutil

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AwsFederatedSigninEndpointTemplate = "https://%v.signin.aws.amazon.com/federation"
	AwsConsoleURLTemplate              = "https://%v.console.aws.amazon.com/"
	DefaultIssuer                      = "Red Hat SRE"
)

Variables

This section is empty.

Functions

func AssumeRole

func AssumeRole(stsClient stscreds.AssumeRoleAPIClient, roleSessionName string, roleArn string) (aws.Credentials, error)

func AssumeRoleSequence

func AssumeRoleSequence(seedClient stscreds.AssumeRoleAPIClient, roleArnSessionSequence []RoleArnSession, proxyURL *string, stsClientProviderFunc STSClientProviderFunc) (aws.Credentials, error)

func AssumeRoleWithJWT

func AssumeRoleWithJWT(jwt string, roleArn string, stsClient stscreds.AssumeRoleWithWebIdentityAPIClient) (aws.Credentials, error)

func GetConsoleURL added in v0.1.11

func GetConsoleURL(signinToken string, region string) (*url.URL, error)

func StsClient added in v0.1.20

func StsClient(proxyURL *string) (*sts.Client, error)

Returns a new stsclient, proxy is optional.

Types

type AWSFederatedSessionData added in v0.1.11

type AWSFederatedSessionData struct {
	SessionID    string `json:"sessionId"`
	SessionKey   string `json:"sessionKey"`
	SessionToken string `json:"sessionToken"`
}

type AWSSigninTokenResponse added in v0.1.11

type AWSSigninTokenResponse struct {
	SigninToken string
}

func GetSigninToken added in v0.1.11

func GetSigninToken(awsCredentials aws.Credentials, region string) (*AWSSigninTokenResponse, error)

type IdentityTokenValue added in v0.1.15

type IdentityTokenValue string

IdentityTokenValue is for retrieving an identity token from the given file name

func (IdentityTokenValue) GetIdentityToken added in v0.1.15

func (j IdentityTokenValue) GetIdentityToken() ([]byte, error)

GetIdentityToken retrieves the JWT token from the file and returns the contents as a []byte

type RoleArnSession added in v0.1.23

type RoleArnSession struct {
	RoleSessionName string
	RoleArn         string
}

type STSClientProviderFunc

type STSClientProviderFunc func(optFns ...func(*config.LoadOptions) error) (stscreds.AssumeRoleAPIClient, error)
var DefaultSTSClientProviderFunc STSClientProviderFunc = func(optnFns ...func(options *config.LoadOptions) error) (stscreds.AssumeRoleAPIClient, 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
}

Jump to

Keyboard shortcuts

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