aws

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSessionTags

func CreateSessionTags(claims *gtypes.GithubClaims) []types.Tag

CreateSessionTags creates session tags from GitHub claims for enhanced security and audit trail Session tags are limited to 50 tags with a combined size limit of 2048 characters

Types

type AwsConsumer

type AwsConsumer struct {
	AWS    AwsServiceWrapperInterface
	Config *gtvcfg.Config
}

AwsConsumer is the implementation of AwsConsumerInterface

func NewAwsConsumer

func NewAwsConsumer(cfg *gtvcfg.Config) *AwsConsumer

NewAwsConsumer creates a new AwsConsumer

func (*AwsConsumer) AssumeRole

func (a *AwsConsumer) AssumeRole(roleArn, sessionName string, sessionPolicy *string, duration *int32, claims *gtypes.GithubClaims) (*types.Credentials, error)

AssumeRole assumes the specified AWS IAM role and returns temporary credentials It also applies session tags based on GitHub claims for better traceability and security

func (*AwsConsumer) GetRole

func (a *AwsConsumer) GetRole(role string) (*iam.GetRoleOutput, error)

GetRole retrieves information about the specified AWS IAM role

func (*AwsConsumer) GetS3Object

func (a *AwsConsumer) GetS3Object(bucket, key string) (io.ReadCloser, error)

GetS3Object retrieves an object from S3

func (*AwsConsumer) GetSessionPolicyFromS3

func (a *AwsConsumer) GetSessionPolicyFromS3(bucket, prefix string) (string, error)

GetSessionPolicyFromS3 retrieves the IAM session policy from S3

func (*AwsConsumer) ReadS3Configuration

func (a *AwsConsumer) ReadS3Configuration() error

ReadS3Configuration reads the configured S3 Bucket and returns Config

func (*AwsConsumer) RoleHasTag

func (a *AwsConsumer) RoleHasTag(role string, tagKey, tagValue string) (bool, error)

RoleHasTag checks if an IAM role has a specific tag key and value

func (*AwsConsumer) SessionName

func (a *AwsConsumer) SessionName(name string) string

SessionName cleans the session name to be valid

type AwsConsumerInterface

type AwsConsumerInterface interface {
	ReadS3Configuration() error
	AssumeRole(roleARN, sessionName string, sessionPolicy *string, duration *int32, claims *gtypes.GithubClaims) (*types.Credentials, error)
	GetS3Object(bucket, key string) (io.ReadCloser, error)
	GetRole(role string) (*iam.GetRoleOutput, error)
}

AwsConsumerInterface encapsulates all actions performs with the AWS services

type AwsServiceWrapper

type AwsServiceWrapper struct {
	// contains filtered or unexported fields
}

AwsServiceWrapper is the implementation of AwsServiceWrapperInterface it wraps the actual AWS service call but has no additional functionality implemented

func NewAwsServiceWrapper

func NewAwsServiceWrapper() *AwsServiceWrapper

func (*AwsServiceWrapper) AssumeRole

func (s *AwsServiceWrapper) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error)

func (*AwsServiceWrapper) GetRole

func (s *AwsServiceWrapper) GetRole(input *iam.GetRoleInput) (*iam.GetRoleOutput, error)

func (*AwsServiceWrapper) GetS3Object

func (s *AwsServiceWrapper) GetS3Object(bucket, key string) (io.ReadCloser, error)

func (*AwsServiceWrapper) RefreshClients

func (s *AwsServiceWrapper) RefreshClients()

RefreshClients recreates AWS service clients, useful for long-running Lambda environments where clients might need refreshing periodically

type AwsServiceWrapperInterface

type AwsServiceWrapperInterface interface {
	GetS3Object(bucket, key string) (io.ReadCloser, error)
	AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error)
	GetRole(input *iam.GetRoleInput) (*iam.GetRoleOutput, error)
	RefreshClients()
}

AwsServiceWrapperInterface allows to test AWS specific code based on the AWS services

Jump to

Keyboard shortcuts

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