aws

package
v0.0.0-...-9a5b211 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Overview

The interfaces are here to make the callers of these API's testable, giving us the ability to mock them. At the time of writing github.com/aws/aws-sdk-go-v2 does not provide interfaces that can be mocked. Add new function signatures as necessary.

Index

Constants

View Source
const (
	Name = "datalift.service.aws"
)

Variables

This section is empty.

Functions

func ConvertError

func ConvertError(e error) error

Use error handling techniques outlined in https://aws.github.io/aws-sdk-go-v2/docs/handling-errors/ to extract embedded HTTP status information and error messages from AWS SDK errors and create the corresponding gRPC status.

func New

func New(cfg *anypb.Any, logger *zap.Logger, scope tally.Scope) (service.Service, error)

Types

type Client

type Client interface {
	S3GetBucketPolicy(ctx context.Context, account, region, bucket, accountID string) (*s3.GetBucketPolicyOutput, error)
	S3StreamingGet(ctx context.Context, account, region, bucket, key string) (io.ReadCloser, error)

	GetCallerIdentity(ctx context.Context, account, region string) (*sts.GetCallerIdentityOutput, error)

	SimulateCustomPolicy(ctx context.Context, account, region string, customPolicySimulatorParams *iam.SimulateCustomPolicyInput) (*iam.SimulateCustomPolicyOutput, error)

	Accounts() []string
	AccountsAndRegions() map[string][]string
	GetAccountsInRegion(region string) []string
	GetPrimaryAccountAlias() string
	Regions() []string

	GetDirectClient(account string, region string) (DirectClient, error)
}

type DirectClient

type DirectClient interface {
	Config() *aws.Config
	IAM() *iam.Client
	S3() *s3.Client
	STS() *sts.Client
}

DirectClient gives access to the underlying AWS clients from the Golang SDK. This allows arbitrary feature development on top of AWS from other services and modules without having to contribute to the upstream interface. Using these clients will make mocking extremely difficult since it returns the AWS SDK's struct types and not an interface that can be substituted for. It is recommended following initial development of a feature that you add the calls to a service interface so they can be tested more easily.

Jump to

Keyboard shortcuts

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