awsutil

package
v0.1.37 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 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

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

func StsClient

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

Returns a new stsclient, proxy is optional.

Types

type AWSFederatedSessionData

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

type AWSSigninTokenResponse

type AWSSigninTokenResponse struct {
	SigninToken string
}

func GetSigninToken

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

type IdentityTokenValue

type IdentityTokenValue string

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

func (IdentityTokenValue) GetIdentityToken

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

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

type RoleArnSession

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