aws

package module
v0.0.0-...-35bea94 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 37 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockSession

func NewMockSession() (*session.Session, *httptest.Server)

NewMockSession returns a new mock aws session safe for concurrent use Returns the mock server as well - user is responsible for calling server.Close() to free resources

Types

type ASG

type ASG struct {
	Svc autoscalingiface.AutoScalingAPI
}

ASG is an autoscaling svc

func NewASG

func NewASG(c client.ConfigProvider, config *aws.Config) *ASG

NewASG returns a new autoscaling service

type Client

type Client struct {

	// services
	ASG            *ASG
	EC2            *EC2
	IAM            *IAM
	KMS            *KMS
	Lambda         *Lambda
	S3             *S3
	Firehose       *Firehose
	SecretsManager *SecretsManager
	SSM            *SSM
	STS            *STS
	Support        *Support
	Organizations  *Organizations
	// contains filtered or unexported fields
}

Client is an aws client

func New

func New(sess *session.Session) *Client

New returns a new aws client

func (*Client) WithASG

func (c *Client) WithASG(conf *aws.Config) *Client

WithASG configures an autoscaling Svc

func (*Client) WithAllServices

func (c *Client) WithAllServices(conf *aws.Config) *Client

WithAllServices Convenience method that configures all services with the same aws.Config

func (*Client) WithEC2

func (c *Client) WithEC2(conf *aws.Config) *Client

WithEC2 configures an EC2 svc

func (*Client) WithFirehose

func (c *Client) WithFirehose(conf *aws.Config) *Client

WithFirehose configures the firehose service

func (*Client) WithIAM

func (c *Client) WithIAM(conf *aws.Config) *Client

WithIAM configures the IAM SVC

func (*Client) WithKMS

func (c *Client) WithKMS(conf *aws.Config) *Client

WithKMS configures the kms service

func (*Client) WithLambda

func (c *Client) WithLambda(conf *aws.Config) *Client

WithLambda configures the lambda service

func (*Client) WithMockASG

func (c *Client) WithMockASG(ctrl *gomock.Controller) (*Client, *mocks.MockAutoScalingAPI)

WithMockASG mocks the ASG svc

func (*Client) WithMockEC2

func (c *Client) WithMockEC2(ctrl *gomock.Controller) (*Client, *mocks.MockEC2API)

func (*Client) WithMockFirehose

func (c *Client) WithMockFirehose(ctrl *gomock.Controller) (*Client, *mocks.MockFirehoseAPI)

func (*Client) WithMockIAM

func (c *Client) WithMockIAM(ctrl *gomock.Controller) (*Client, *mocks.MockIAMAPI)

WithMockIAM mocks iam svc

func (*Client) WithMockKMS

func (c *Client) WithMockKMS(ctrl *gomock.Controller) (*Client, *mocks.MockKMSAPI)

WithMockKMS mocks the kms service

func (*Client) WithMockLambda

func (c *Client) WithMockLambda(ctrl *gomock.Controller) (*Client, *mocks.MockLambdaAPI)

WithMockLambda mocks the lambda service

func (*Client) WithMockOrganizations

func (c *Client) WithMockOrganizations(ctrl *gomock.Controller) (*Client, *mocks.MockOrganizationsAPI)

func (*Client) WithMockS3

func (c *Client) WithMockS3(ctrl *gomock.Controller) (*Client, *mocks.MockS3API, *mocks.MockDownloaderAPI)

WithMockS3 mocks s3 svc

func (*Client) WithMockSSM

func (c *Client) WithMockSSM(ctrl *gomock.Controller) (*Client, *mocks.MockSSMAPI)

WithMockSSM mocks the SSM service

func (*Client) WithMockSTS

func (c *Client) WithMockSTS(ctrl *gomock.Controller) (*Client, *mocks.MockSTSAPI)

WithMockSTS mocks the STS service

func (*Client) WithMockSecretsManager

func (c *Client) WithMockSecretsManager(ctrl *gomock.Controller) (*Client, *mocks.MockSecretsManagerAPI)

WithMockSecretsManager mocks the Secrets Manager svc

func (*Client) WithMockSupport

func (c *Client) WithMockSupport(ctrl *gomock.Controller) (*Client, *mocks.MockSupportAPI)

func (*Client) WithOrganizations

func (c *Client) WithOrganizations(conf *aws.Config) *Client

WithOrganizations configures an Organizations svc

func (*Client) WithS3

func (c *Client) WithS3(conf *aws.Config) *Client

WithS3 configures the s3 client

func (*Client) WithSSM

func (c *Client) WithSSM(conf *aws.Config) *Client

WithSSM configures the SSM service

func (*Client) WithSTS

func (c *Client) WithSTS(conf *aws.Config) *Client

WithSTS configures the STS service

func (*Client) WithSecretsManager

func (c *Client) WithSecretsManager(conf *aws.Config) *Client

WithSecretsManager configures a Secrets Manager svc

func (*Client) WithSupport

func (c *Client) WithSupport(conf *aws.Config) *Client

WithSupport configures an Support svc

type EC2

type EC2 struct {
	Svc ec2iface.EC2API
}

EC2 is an ec2 svc

func NewEC2

func NewEC2(c client.ConfigProvider, config *aws.Config) *EC2

NewEC2 returns a new EC2 svc

func (*EC2) GetAllInstances

func (e *EC2) GetAllInstances(ctx context.Context, f func(*ec2.Instance)) error

GetAllInstances will walk all instances and call func for each

func (*EC2) GetAllVPCs

func (e *EC2) GetAllVPCs(ctx context.Context, f func(*ec2.Vpc)) error

GetAllVPCs will call f for each VPCs

type Firehose

type Firehose struct {
	Svc firehoseiface.FirehoseAPI
}

Firehose is a firehose service

func NewFirehose

func NewFirehose(c client.ConfigProvider, config *aws.Config) *Firehose

NewFirehose returns a new firehose service

type IAM

type IAM struct {
	Svc iamiface.IAMAPI
}

IAM is an iam service

func NewIAM

func NewIAM(c client.ConfigProvider, config *aws.Config) *IAM

NewIAM returns a new IAM svc

func (*IAM) GetAnMFASerial

func (i *IAM) GetAnMFASerial(ctx context.Context, username *string) (string, error)

GetAnMFASerial returns the first MFA serial on the user, errors if no MFA found

func (*IAM) GetCurrentUser

func (i *IAM) GetCurrentUser(ctx context.Context) (*iam.User, error)

GetCurrentUser describes the calling user

func (*IAM) GetLoginProfile

func (i *IAM) GetLoginProfile(ctx context.Context, username string) (*iam.LoginProfile, error)

GetLoginProfile gets the login profile for this user if it exists

func (*IAM) GetMFASerials

func (i *IAM) GetMFASerials(ctx context.Context, username *string) ([]string, error)

GetMFASerials gets the mfaSerials for the username

func (*IAM) GetUser

func (i *IAM) GetUser(ctx context.Context, username *string) (*iam.User, error)

GetUser returns the caller aws user

func (*IAM) ListAllUsers

func (i *IAM) ListAllUsers(ctx context.Context, f func(*iam.User)) error

ListAllUsers will get all users in the current account and invoke f for each

type KMS

type KMS struct {
	Svc kmsiface.KMSAPI
}

KMS is a kms client

func NewKMS

func NewKMS(s client.ConfigProvider, conf *aws.Config) *KMS

NewKMS returns a KMS client

func (*KMS) Decrypt

func (k *KMS) Decrypt(ctx context.Context, ciphertext []byte, context map[string]*string) ([]byte, string, error)

Decrypt decrypts

func (*KMS) EncryptBytes

func (k *KMS) EncryptBytes(ctx context.Context, keyID string, plaintext []byte, context map[string]*string) (string, error)

EncryptBytes encrypts the plaintext using the keyID key and the given context result is base64 encoded string

type Lambda

type Lambda struct {
	Svc lambdaiface.LambdaAPI
}

Lambda is a Lambda client

func NewLambda

func NewLambda(c client.ConfigProvider, config *aws.Config) *Lambda

NewLambda returns a Lambda client

func (*Lambda) Execute

func (l *Lambda) Execute(ctx context.Context, functionName string, payload []byte) ([]byte, error)

Execute executes the given function with the given payload and returns the output

func (*Lambda) ExecuteWithQualifier

func (l *Lambda) ExecuteWithQualifier(ctx context.Context, functionName string, functionQualifier *string, payload []byte) ([]byte, error)

ExecuteWithQualifier executes the given function with the given payload and qualifier (lambda version) and returns the output

type Organizations

type Organizations struct {
	Svc organizationsiface.OrganizationsAPI
}

Organizations is a organizations interface

func NewOrganizations

func NewOrganizations(c client.ConfigProvider, config *aws.Config) *Organizations

NewOrganizations will return Organizations

type S3

type S3 struct {
	Svc        s3iface.S3API
	Downloader s3manageriface.DownloaderAPI
}

S3 is an s3 client

func NewS3

func NewS3(c client.ConfigProvider, config *aws.Config) *S3

NewS3 returns an s3 client

func (*S3) GetBucketACL

func (s *S3) GetBucketACL(ctx context.Context, bucketName string) (*s3.GetBucketAclOutput, error)

GetBucketACL gets the bucket's ACL

func (*S3) GetBucketLocation

func (s *S3) GetBucketLocation(ctx context.Context, bucketName string) (string, error)

GetBucketLocation gets the bucket's location (region)

func (*S3) GetBucketTagging

func (s *S3) GetBucketTagging(ctx context.Context, bucketName string) (*s3.GetBucketTaggingOutput, error)

GetBucketTagging returns the bucket's tags

func (*S3) ListBuckets

func (s *S3) ListBuckets(ctx context.Context) (*s3.ListBucketsOutput, error)

ListBuckets lists buckets

type SSM

type SSM struct {
	Svc ssmiface.SSMAPI
}

SSM is an ssm service

func NewSSM

func NewSSM(c client.ConfigProvider, config *aws.Config) *SSM

NewSSM returns a new SSM svc

type STS

type STS struct {
	Svc stsiface.STSAPI
}

STS is an STS client

func NewSTS

func NewSTS(c client.ConfigProvider, config *aws.Config) *STS

NewSTS returns an sts client

type SecretsManager

type SecretsManager struct {
	Svc secretsmanageriface.SecretsManagerAPI
}

SecretsManager is a secretsmanager service

func NewSecretsManager

func NewSecretsManager(c client.ConfigProvider, config *aws.Config) *SecretsManager

NewSecretsManager returns a new secrets manager

func (*SecretsManager) ReadStringLatestVersion

func (s *SecretsManager) ReadStringLatestVersion(ctx context.Context, secretID string) (*string, error)

ReadStringLatestVersion reads the latest verison of a string secret

type Support

type Support struct {
	Svc supportiface.SupportAPI
}

Support is a support interface

func NewSupport

func NewSupport(c client.ConfigProvider, config *aws.Config) *Support

NewSupport will return Support

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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