awsclient

package
v2.0.0-...-82fddbe Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const AwsRegion = "us-east-1"
View Source
const EcsClientKey = "ecs-client-key"
View Source
const FirehoseClientKey = "firehose-client-key"
View Source
const KmsClientKey = "kms-client-key"
View Source
const RedisClientKey = "redis-client-key"

Variables

View Source
var (
	ErrorUndefinedS3Bucket = errors.New("bucket undefined")
	ErrorUndefinedS3Key    = errors.New("key undefined")
)
View Source
var MemcachedClientKey = "memcached-client-key"
View Source
var SnsClientKey = "sns-client-key"
View Source
var SqsClientKey = "sqs-client-key"

Functions

func Decrypt

func Decrypt(ctx context.Context, encryptedString string) (decryptedString string, err error)

func GenerateSignedReqV2

func GenerateSignedReqV2(ctx context.Context, url, requestText, acceptType, apiKey string) (reqToFire *http.Request, err error)

func SetClientConfig

func SetClientConfig(config ClientConfig)

func SetFirehoseClient

func SetFirehoseClient(ctx context.Context, client FirehoseClient) context.Context

func SetS3Client

func SetS3Client(client S3Client)

func SetSecretsManagerClient

func SetSecretsManagerClient(client SecretsManagerClient)

func Setup

func Setup(ctx context.Context, options ClientConfig, customEndptResolver aws.EndpointResolverWithOptions, usePathStyle func(options2 *s3.Options)) error

func SetupWithDefault

func SetupWithDefault(ctx context.Context) error

func StandardizeError

func StandardizeError(ctx context.Context, err error) error

func StopThisTask

func StopThisTask(ctx context.Context)

Types

type CachingSecretsManagerClient

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

func NewLocalFirstSecretsManagerClient

func NewLocalFirstSecretsManagerClient(ctx context.Context) (CachingSecretsManagerClient, error)

func (CachingSecretsManagerClient) GetSecretValue

type ClientConfig

type ClientConfig struct {
	ReadTimeoutDuration time.Duration
	ListTimeoutDuration time.Duration
	MaxReadRetries      int
	MaxListRetries      int
	MaxPutRetries       int
}

func GetClientConfig

func GetClientConfig() ClientConfig

type CloudS3Client

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

func NewCloudS3Client

func NewCloudS3Client(client *s3.Client) CloudS3Client

func (CloudS3Client) DeleteObject

func (adapter CloudS3Client) DeleteObject(
	ctx context.Context,
	input *s3.DeleteObjectInput,
	options ...func(*s3.Options),
) (*s3.DeleteObjectOutput, error)

func (CloudS3Client) GetObject

func (adapter CloudS3Client) GetObject(
	ctx context.Context,
	input *s3.GetObjectInput,
	options ...func(*s3.Options),
) (*s3.GetObjectOutput, error)

func (CloudS3Client) HeadObject

func (adapter CloudS3Client) HeadObject(
	ctx context.Context,
	input *s3.HeadObjectInput,
	options ...func(*s3.Options),
) (*s3.HeadObjectOutput, error)

func (CloudS3Client) ListObjectsV2

func (adapter CloudS3Client) ListObjectsV2(
	ctx context.Context,
	inp *s3.ListObjectsV2Input,
	options ...func(*s3.Options),
) (*s3.ListObjectsV2Output, error)

func (CloudS3Client) PutObject

func (adapter CloudS3Client) PutObject(
	ctx context.Context,
	input *s3.PutObjectInput,
	options ...func(*s3.Options),
) (*s3.PutObjectOutput, error)

type DynamoClient

type DynamoClient interface {
	GetItem(ctx context.Context, parameters *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
	PutItem(ctx context.Context, parameters *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
}

type EcsClient

type EcsClient interface {
	StopTask(ctx context.Context, params *ecs.StopTaskInput, optFns ...func(*ecs.Options)) (*ecs.StopTaskOutput, error)
}

func GetEcsClient

func GetEcsClient(ctx context.Context) (context.Context, EcsClient, error)

type FirehoseClient

type FirehoseClient interface {
	PutRecord(ctx context.Context, params *firehose.PutRecordInput, optFns ...func(*firehose.Options)) (*firehose.PutRecordOutput, error)
}

func GetFirehoseClient

func GetFirehoseClient(ctx context.Context) (FirehoseClient, error)

type KmsClient

type KmsClient interface {
	Decrypt(ctx context.Context, params *kms.DecryptInput, optFns ...func(*kms.Options)) (*kms.DecryptOutput, error)
}

func GetKMSClient

func GetKMSClient(ctx context.Context) (context.Context, KmsClient, error)

type LocalFirstS3Client

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

func NewLocalFirstS3Client

func NewLocalFirstS3Client(client *s3.Client, directory string) LocalFirstS3Client

func (LocalFirstS3Client) DeleteObject

func (lfs3 LocalFirstS3Client) DeleteObject(
	ctx context.Context,
	input *s3.DeleteObjectInput,
	options ...func(*s3.Options),
) (*s3.DeleteObjectOutput, error)

func (LocalFirstS3Client) GetObject

func (lfs3 LocalFirstS3Client) GetObject(
	ctx context.Context,
	input *s3.GetObjectInput,
	options ...func(*s3.Options),
) (*s3.GetObjectOutput, error)

func (LocalFirstS3Client) HeadObject

func (lfs3 LocalFirstS3Client) HeadObject(
	ctx context.Context,
	input *s3.HeadObjectInput,
	options ...func(*s3.Options),
) (*s3.HeadObjectOutput, error)

func (LocalFirstS3Client) ListObjectsV2

func (lfs3 LocalFirstS3Client) ListObjectsV2(
	ctx context.Context,
	input *s3.ListObjectsV2Input,
	options ...func(*s3.Options),
) (*s3.ListObjectsV2Output, error)

func (LocalFirstS3Client) PutObject

func (lfs3 LocalFirstS3Client) PutObject(
	ctx context.Context,
	input *s3.PutObjectInput,
	options ...func(*s3.Options),
) (*s3.PutObjectOutput, error)

type LocalS3Client

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

func NewLocalS3Client

func NewLocalS3Client(directory string) LocalS3Client

func (LocalS3Client) DeleteObject

func (lc LocalS3Client) DeleteObject(ctx context.Context, input *s3.DeleteObjectInput, opts ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)

func (LocalS3Client) GetObject

func (lc LocalS3Client) GetObject(ctx context.Context, input *s3.GetObjectInput, options ...func(*s3.Options)) (*s3.GetObjectOutput, error)

func (LocalS3Client) HeadObject

func (lc LocalS3Client) HeadObject(ctx context.Context, input *s3.HeadObjectInput, opts ...func(*s3.Options)) (*s3.HeadObjectOutput, error)

func (LocalS3Client) ListObjectsV2

func (lc LocalS3Client) ListObjectsV2(ctx context.Context, input *s3.ListObjectsV2Input, options ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)

func (LocalS3Client) PutObject

func (lc LocalS3Client) PutObject(ctx context.Context, input *s3.PutObjectInput, opts ...func(*s3.Options)) (*s3.PutObjectOutput, error)

type MemcachedClient

type MemcachedClient interface {
	Get(key string) (item *memcache.Item, err error)
	Set(item *memcache.Item) error
}

func GetMemcachedClient

func GetMemcachedClient(ctx context.Context) (context.Context, MemcachedClient)

type RedisClient

type RedisClient struct {
	Client WrappedRedisClient
}

func GetRedisClient

func GetRedisClient(ctx context.Context, addr string) (context.Context, RedisClient)

func (RedisClient) Close

func (wrapper RedisClient) Close() error

func (RedisClient) Del

func (wrapper RedisClient) Del(ctx context.Context, key string) error

func (RedisClient) Get

func (wrapper RedisClient) Get(ctx context.Context, key string) ([]byte, error)

func (RedisClient) Scan

func (wrapper RedisClient) Scan(ctx context.Context, cursor uint64, match string, count int64) *redis.ScanCmd

func (RedisClient) Set

func (wrapper RedisClient) Set(ctx context.Context, key string, value []byte, expiration time.Duration) error

func (RedisClient) SetNX

func (wrapper RedisClient) SetNX(ctx context.Context, key string, value []byte, expiration time.Duration) (bool, error)

type S3Client

type S3Client interface {
	ListObjectsV2(context.Context, *s3.ListObjectsV2Input, ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)
	GetObject(context.Context, *s3.GetObjectInput, ...func(*s3.Options)) (*s3.GetObjectOutput, error)
	PutObject(context.Context, *s3.PutObjectInput, ...func(*s3.Options)) (*s3.PutObjectOutput, error)
	DeleteObject(context.Context, *s3.DeleteObjectInput, ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)
	HeadObject(ctx context.Context, params *s3.HeadObjectInput, optFns ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
}

func GetS3Client

func GetS3Client() S3Client

func NewS3Client

func NewS3Client(client *s3.Client) S3Client

type SecretsManagerClient

type SecretsManagerClient interface {
	GetSecretValue(ctx context.Context, params *secretsmanager.GetSecretValueInput, optFns ...func(*secretsmanager.Options)) (*secretsmanager.GetSecretValueOutput, error)
}

func GetSecretsManagerClient

func GetSecretsManagerClient(ctx context.Context) (SecretsManagerClient, error)

func NewCloudSecretsManagerClient

func NewCloudSecretsManagerClient(ctx context.Context) (SecretsManagerClient, error)

type SnsClient

type SnsClient interface {
	Publish(ctx context.Context, params *sns.PublishInput, optFns ...func(*sns.Options)) (*sns.PublishOutput, error)
}

func GetSNSClient

func GetSNSClient(ctx context.Context) (context.Context, SnsClient, error)

type SqsClient

type SqsClient interface {
	ReceiveMessage(ctx context.Context, params *sqs.ReceiveMessageInput, optFns ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error)
	DeleteMessage(ctx context.Context, params *sqs.DeleteMessageInput, optFns ...func(*sqs.Options)) (*sqs.DeleteMessageOutput, error)
}

func GetSQSClient

func GetSQSClient(ctx context.Context) (context.Context, SqsClient, error)

type UninitializedMemcachedClient

type UninitializedMemcachedClient struct {
}

func (UninitializedMemcachedClient) Get

func (cache UninitializedMemcachedClient) Get(key string) (item *memcache.Item, err error)

func (UninitializedMemcachedClient) Set

type WrappedRedisClient

type WrappedRedisClient interface {
	Get(ctx context.Context, key string) *redis.StringCmd
	Set(ctx context.Context, key string, value any, expiration time.Duration) *redis.StatusCmd
	SetNX(ctx context.Context, key string, value any, expiration time.Duration) *redis.BoolCmd
	Del(ctx context.Context, keys ...string) *redis.IntCmd
	Do(ctx context.Context, args ...interface{}) *redis.Cmd
	Scan(ctx context.Context, cursor uint64, match string, count int64) *redis.ScanCmd
	Close() error
	PSubscribe(ctx context.Context, channels ...string) *redis.PubSub
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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