awsutil

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AwsFederatedSigninEndpoint = "https://signin.aws.amazon.com/federation"
	AwsConsoleURL              = "https://console.aws.amazon.com/"
	DefaultIssuer              = "Red Hat SRE"
)

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 GetConsoleURL added in v0.1.11

func GetConsoleURL(signinToken string) (*url.URL, 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 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 *types.Credentials) (*AWSSigninTokenResponse, 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