appres

package
v0.0.59 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AwsSetQueueTimeout

func AwsSetQueueTimeout(svc *sqs.Client, envURL *url.URL, queueURL *string) error

// NewAwsConfigForSQS configures aws connection

func NewAwsConfigForSQS() aws.Config {
	awsEndpoint := os.Getenv("AWS_ENDPOINT_SQS")

	return NewAwsConfig(awsEndpoint)
}

// NewAwsConfigForS3 configures aws connection

func NewAwsConfigForS3() aws.Config {
	awsEndpoint := os.Getenv("AWS_ENDPOINT_S3")

	return NewAwsConfig(awsEndpoint)
}

// NewAwsConfigForSNS configures aws connection

func NewAwsConfigForSNS() aws.Config {
	awsEndpoint := os.Getenv("AWS_ENDPOINT_SNS")

	return NewAwsConfig(awsEndpoint)
}

// NewAwsConfigForDDB configures aws connection

func NewAwsConfigForDDB() aws.Config {
	awsEndpoint := os.Getenv("AWS_ENDPOINT_DDB")

	return NewAwsConfig(awsEndpoint)
}

AwsSetQueueTimeout sets timeout for sqs queue

func GetTimeoutFromURL

func GetTimeoutFromURL(qURL *url.URL) string

GetTimeoutFromURL retrieve value from querystring parameter timeout

func NewAwsConfig

func NewAwsConfig() aws.Config

NewAwsConfig configures aws connection

func ResetMqInMemoryDynamoDb

func ResetMqInMemoryDynamoDb()

ResetMqInMemoryDynamoDb resets the singleton

func ResetQueueInMemory

func ResetQueueInMemory()

ResetQueueInMemory reset the singleton

Types

type AppRes

type AppRes interface {
	Begin() error
	Commit() error
	Rollback() error
}

AppRes interface for allowing transactions

type Bucket

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

Bucket wrapper for S3 Bucket

func NewBucket

func NewBucket(url *url.URL) *Bucket

NewBucket returns a configured S3 Bucket App Resource

func (*Bucket) Begin

func (b *Bucket) Begin() error

Begin transaction

func (*Bucket) Commit

func (b *Bucket) Commit() error

Commit transaction

func (*Bucket) Del

func (b *Bucket) Del(name string) error

Del wrapper for S3 Bucket

func (*Bucket) Exists

func (b *Bucket) Exists(name string) (bool, error)

Exists wrapper for S3 Bucket

func (*Bucket) Get

func (b *Bucket) Get(name string) (interface{}, error)

Get wrapper for S3 Bucket

func (*Bucket) Put

func (b *Bucket) Put(name string, item interface{}) error

Put wrapper for S3 Bucket

func (*Bucket) Rollback

func (b *Bucket) Rollback() error

Rollback transaction

type Ddb

type Ddb interface {
	CreateTable(input *dynamodb.CreateTableInput) error
	ListTables() ([]string, error)
	Put(tableName string, item interface{}) error
	PutConditional(tableName string, item interface{}, condition *string, conditionAttributes map[string]interface{}) error
	Get(tableName string, key map[string]string) (map[string]types.AttributeValue, error)
	Del(tableName string, key map[string]string) error
	Query(queryInput *dynamodb.QueryInput) ([]map[string]types.AttributeValue, error)
	Scan(tableName string, filter expression.ConditionBuilder) ([]map[string]types.AttributeValue, error)
}

Ddb interface for allowing swap outs for testing

type Dir

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

Dir is a wrapper for a directory

func NewDir

func NewDir(url *url.URL) *Dir

NewDir returns a configured Directory App Resource

func (*Dir) Begin

func (dir *Dir) Begin() error

Begin transaction

func (*Dir) Commit

func (dir *Dir) Commit() error

Commit transaction

func (*Dir) Del

func (dir *Dir) Del(name string) error

Del wrapper for S3 Bucket

func (*Dir) Exists

func (dir *Dir) Exists(name string) (bool, error)

Exists wrapper for S3 Bucket

func (*Dir) Get

func (dir *Dir) Get(name string) (interface{}, error)

Get wrapper for S3 Bucket

func (*Dir) Put

func (dir *Dir) Put(name string, item interface{}) error

Put wrapper for Directory

func (*Dir) Rollback

func (dir *Dir) Rollback() error

Rollback transaction

type DynamoDb

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

DynamoDb is a wrapper for AWS DynamoDb

func NewDynamoDb

func NewDynamoDb(url *url.URL) *DynamoDb

NewDynamoDb return a configured DynamoDb Resource

func (*DynamoDb) Begin

func (ddb *DynamoDb) Begin() error

Begin transaction

func (*DynamoDb) Commit

func (ddb *DynamoDb) Commit() error

Commit transaction

func (*DynamoDb) CreateTable

func (ddb *DynamoDb) CreateTable(input *dynamodb.CreateTableInput) error

CreateTable is a wrapper for creating S3 Tables

func (*DynamoDb) Del added in v0.0.54

func (ddb *DynamoDb) Del(tableName string, key map[string]string) error

Del is a wrapper for removing an item from a DynamoDb table

func (*DynamoDb) Get

func (ddb *DynamoDb) Get(tableName string, key map[string]string) (map[string]types.AttributeValue, error)

Get is a wrapper for getting data from a DynamoDb table

func (*DynamoDb) ListTables

func (ddb *DynamoDb) ListTables() ([]string, error)

ListTables is a wrapper for listing S3 Tables

func (*DynamoDb) Put

func (ddb *DynamoDb) Put(tableName string, item interface{}) error

Put is a wrapper for putting data in a DynamoDb table

func (*DynamoDb) PutConditional added in v0.0.54

func (ddb *DynamoDb) PutConditional(tableName string, item interface{}, condition *string, conditionAttributes map[string]interface{}) error

PutConditional is a wrapper for putting data in a DynamoDb table

func (*DynamoDb) Query added in v0.0.54

func (ddb *DynamoDb) Query(queryInput *dynamodb.QueryInput) ([]map[string]types.AttributeValue, error)

Query is a wrapper for getting data from a DynamoDb table

func (*DynamoDb) Rollback

func (ddb *DynamoDb) Rollback() error

Rollback transaction

func (*DynamoDb) Scan added in v0.0.54

func (ddb *DynamoDb) Scan(tableName string, filter expression.ConditionBuilder) ([]map[string]types.AttributeValue, error)

Scan is a wrapper for getting data from a DynamoDb table

type DynamoDbItemNotFound added in v0.0.33

type DynamoDbItemNotFound struct {
	TableName string
	Key       interface{}
}

DynamoDbItemNotFound is a signal

func (*DynamoDbItemNotFound) Error added in v0.0.33

func (e *DynamoDbItemNotFound) Error() string

type FS

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

FS is a wrapper for a file

func NewFS

func NewFS(url *url.URL) *FS

NewFS returns a configured File System App Resource

func (*FS) Begin

func (fs *FS) Begin() error

Begin transaction

func (*FS) Commit

func (fs *FS) Commit() error

Commit transaction

func (*FS) Del

func (fs *FS) Del(path string, name string) error

Del wrapper for FileSystem

func (*FS) Get

func (fs *FS) Get(path string, name string) ([]byte, error)

Get wrapper for FileSystem

func (*FS) Put

func (fs *FS) Put(path string, name string, payload []byte) error

Put wrapper for FileSystem

func (*FS) Rollback

func (fs *FS) Rollback() error

Rollback transaction

type FileSystem

type FileSystem interface {
	Put(path string, name string, payload []byte) error
	Get(path string, name string) ([]byte, error)
	Del(path string, name string) error
}

FileSystem interface for allowing swap outs for testing

type InMemKeyVal

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

InMemKeyVal is swap in unit testing involving calls to KeyVal stores

func NewInMemKeyVal

func NewInMemKeyVal(url *url.URL) *InMemKeyVal

NewInMemKeyVal returns a configured In Memory Key Value App Resource

func (*InMemKeyVal) Begin

func (r *InMemKeyVal) Begin() error

Begin transaction

func (*InMemKeyVal) Commit

func (r *InMemKeyVal) Commit() error

Commit transaction

func (*InMemKeyVal) Del

func (r *InMemKeyVal) Del(key string) error

Del wrapper for InMemory Key Value Store

func (*InMemKeyVal) Exists

func (r *InMemKeyVal) Exists(key string) (bool, error)

Exists wrapper for InMemory Key Value Store

func (*InMemKeyVal) Get

func (r *InMemKeyVal) Get(key string) (interface{}, error)

Get wrapper for InMemory Key Value Store

func (*InMemKeyVal) Put

func (r *InMemKeyVal) Put(key string, item interface{}) error

Put wrapper for InMemory Key Value Store

func (*InMemKeyVal) Rollback

func (r *InMemKeyVal) Rollback() error

Rollback transaction

type KeyVal

type KeyVal interface {
	Put(key string, item interface{}) error
	Exists(key string) (bool, error)
	Get(key string) (interface{}, error)
	Del(key string) error
}

KeyVal interface for allowing swap outs for testing

type MqInMemoryDynamoDb

type MqInMemoryDynamoDb struct {
	TableNames []string
	List       []interface{}
	// contains filtered or unexported fields
}

MqInMemoryDynamoDb is swap in unit testing involving calls to DynamoDb

func NewMqInMemoryDynamoDb

func NewMqInMemoryDynamoDb(url *url.URL) *MqInMemoryDynamoDb

NewMqInMemoryDynamoDb returns the singleton, creating if necessary

func NewMqInMemoryDynamoDbFromString

func NewMqInMemoryDynamoDbFromString(urlString string) *MqInMemoryDynamoDb

NewMqInMemoryDynamoDbFromString is an adapter for NewMqInMemoryDynamoDb

func (*MqInMemoryDynamoDb) Begin

func (ddb *MqInMemoryDynamoDb) Begin() error

Begin transaction

func (*MqInMemoryDynamoDb) Commit

func (ddb *MqInMemoryDynamoDb) Commit() error

Commit transaction

func (*MqInMemoryDynamoDb) CreateTable

func (ddb *MqInMemoryDynamoDb) CreateTable(input *dynamodb.CreateTableInput) error

CreateTable is a wrapper for creating mock S3 Tables

func (*MqInMemoryDynamoDb) Get

func (ddb *MqInMemoryDynamoDb) Get(tableName string, key map[string]string) (map[string]types.AttributeValue, error)

Get is a wrapper for getting data from mock S3 Tables

func (*MqInMemoryDynamoDb) ListTables

func (ddb *MqInMemoryDynamoDb) ListTables() ([]string, error)

ListTables is a wrapper for listing mock S3 Tables

func (*MqInMemoryDynamoDb) Put

func (ddb *MqInMemoryDynamoDb) Put(tableName string, item interface{}) error

Put is a wrapper for putting data into mock S3 Tables

func (*MqInMemoryDynamoDb) Rollback

func (ddb *MqInMemoryDynamoDb) Rollback() error

Rollback transaction

type Publisher added in v0.0.47

type Publisher interface {
	Name() string
	Publish(payload string) error
	Commit() error
}

Publisher is the generic interface to a Publisher

func NewPublisher added in v0.0.47

func NewPublisher(urlString string) Publisher

NewPublisher allows Publishers to be created and returned, based on the url string provided.

type PublisherInMemory added in v0.0.47

type PublisherInMemory struct {
	List []string
	// contains filtered or unexported fields
}

PublisherInMemory is a wrapper for a AWS SNS Topic

func NewPublisherInMemory added in v0.0.47

func NewPublisherInMemory(url *url.URL) *PublisherInMemory

NewPublisherInMemory returns an InMemory Publisher for testing purposes

func (*PublisherInMemory) Begin added in v0.0.47

func (p *PublisherInMemory) Begin() error

Begin transaction

func (*PublisherInMemory) Commit added in v0.0.47

func (p *PublisherInMemory) Commit() error

Commit transaction

func (*PublisherInMemory) Name added in v0.0.47

func (p *PublisherInMemory) Name() string

Name returns the name of the wrapped queue

func (*PublisherInMemory) Publish added in v0.0.47

func (p *PublisherInMemory) Publish(Message string) error

Publish wrapper for AWS SNS Topic

func (*PublisherInMemory) Rollback added in v0.0.47

func (p *PublisherInMemory) Rollback() error

Rollback transaction

type PublisherSns added in v0.0.47

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

PublisherSns is a wrapper for a AWS SNS Topic

func NewPublisherSns added in v0.0.47

func NewPublisherSns(url *url.URL) *PublisherSns

NewPublisherSns returns a configured Sqs App Resource

func (*PublisherSns) Begin added in v0.0.47

func (q *PublisherSns) Begin() error

Begin transaction

func (*PublisherSns) Commit added in v0.0.47

func (q *PublisherSns) Commit() error

Commit transaction

func (*PublisherSns) Name added in v0.0.47

func (q *PublisherSns) Name() string

Name returns the name of the wrapped queue

func (*PublisherSns) Publish added in v0.0.47

func (q *PublisherSns) Publish(Message string) error

Publish wrapper for AWS SNS Topic

func (*PublisherSns) Rollback added in v0.0.47

func (q *PublisherSns) Rollback() error

Rollback transaction

type Queue

type Queue interface {
	Name() string
	Send(payload string) error
	Retrieve() (*string, error)
	Commit() error
}

Queue is the generic interface to a queue

func NewQueue

func NewQueue(urlString string) Queue

NewQueue allows queues to be created and returned, based on the url string provided.

type QueueBeanstalk

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

QueueBeanstalk is a wrapper for a Beanstalk tube

func NewQueueBeanstalk

func NewQueueBeanstalk(url *url.URL) *QueueBeanstalk

NewQueueBeanstalk returns a configured Beanstalk App Resource

func (*QueueBeanstalk) Begin

func (q *QueueBeanstalk) Begin() error

Begin transaction

func (*QueueBeanstalk) Commit

func (q *QueueBeanstalk) Commit() error

Commit transaction

func (*QueueBeanstalk) Name

func (q *QueueBeanstalk) Name() string

Name returns the name of the wrapped queue

func (*QueueBeanstalk) Retrieve

func (q *QueueBeanstalk) Retrieve() (*string, error)

Retrieve wrapper for Beanstalk Queue

func (*QueueBeanstalk) Rollback

func (q *QueueBeanstalk) Rollback() error

Rollback transaction

func (*QueueBeanstalk) Send

func (q *QueueBeanstalk) Send(payload string) error

Send wrapper for Beanstalk Queue

type QueueInMemory

type QueueInMemory struct {
	List []string
	// contains filtered or unexported fields
}

QueueInMemory swap in queue for testing

func NewQueueInMemory

func NewQueueInMemory(url *url.URL) *QueueInMemory

NewQueueInMemory returns the singleton, creating if necessary

func NewQueueInMemoryFromString

func NewQueueInMemoryFromString(urlString string) *QueueInMemory

NewQueueInMemoryFromString adapter for NewQueueInMemory

func (*QueueInMemory) Begin

func (mq *QueueInMemory) Begin() error

Begin transaction

func (*QueueInMemory) Commit

func (mq *QueueInMemory) Commit() error

Commit transaction

func (*QueueInMemory) Init

func (mq *QueueInMemory) Init() error

Init wrapper for InMemory Queue

func (*QueueInMemory) Move

func (mq *QueueInMemory) Move(fromS string, toS string)

Move message to a different queue

func (*QueueInMemory) Name

func (mq *QueueInMemory) Name() string

Name wrapper for InMemory Queue

func (*QueueInMemory) Retrieve

func (mq *QueueInMemory) Retrieve() (*string, error)

Retrieve wrapper for InMemory Queue

func (*QueueInMemory) Rollback

func (mq *QueueInMemory) Rollback() error

Rollback transaction

func (*QueueInMemory) Send

func (mq *QueueInMemory) Send(payload string) error

Send wrapper for InMemory Queue

type QueueSqs

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

QueueSqs is a wrapper for a AWS SQS Queue

func NewQueueSqs

func NewQueueSqs(url *url.URL) *QueueSqs

NewQueueSqs returns a configured Sqs App Resource

func (*QueueSqs) Begin

func (q *QueueSqs) Begin() error

Begin transaction

func (*QueueSqs) Commit

func (q *QueueSqs) Commit() error

Commit transaction

func (*QueueSqs) CreateQueue

func (q *QueueSqs) CreateQueue()

CreateQueue ensures the named queue exists

func (*QueueSqs) Name

func (q *QueueSqs) Name() string

Name returns the name of the wrapped queue

func (*QueueSqs) Retrieve

func (q *QueueSqs) Retrieve() (*string, error)

Retrieve wrapper for AWS SQS Queue

func (*QueueSqs) Rollback

func (q *QueueSqs) Rollback() error

Rollback transaction

func (*QueueSqs) Send

func (q *QueueSqs) Send(Message string) error

Send wrapper for AWS SQS Queue

type Redis

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

Redis is a wrapper for a Redis

func NewRedis

func NewRedis(url *url.URL) *Redis

NewRedis returns a configured Redis App Resource

func (*Redis) Begin

func (r *Redis) Begin() error

Begin transaction

func (*Redis) Commit

func (r *Redis) Commit() error

Commit transaction

func (*Redis) Del

func (r *Redis) Del(key string) error

Del wrapper for Redis

func (*Redis) Exists

func (r *Redis) Exists(name string) (bool, error)

Exists wrapper for Redis

func (*Redis) Get

func (r *Redis) Get(key string) (interface{}, error)

Get wrapper for Redis

func (*Redis) Put

func (r *Redis) Put(key string, item interface{}) error

Put wrapper for Redis

func (*Redis) Rollback

func (r *Redis) Rollback() error

Rollback transaction

type S3

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

S3 is a wrapper for S3

func NewS3

func NewS3(url *url.URL) *S3

NewS3 returns a configured S3 App Resource

func (*S3) Begin

func (s *S3) Begin() error

Begin transaction

func (*S3) Commit

func (s *S3) Commit() error

Commit transaction

func (*S3) Del

func (s *S3) Del(path string, name string) error

Del wrapper for S3

func (*S3) Get

func (s *S3) Get(path string, name string) ([]byte, error)

Get wrapper for S3

func (*S3) Put

func (s *S3) Put(path string, name string, payload []byte) error

Put wrapper for S3

func (*S3) Rollback

func (s *S3) Rollback() error

Rollback transaction

Jump to

Keyboard shortcuts

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