aws

package
v0.0.0-...-49b685b Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UsersBucket = "users"
	NotesBucket = "notes"
)
View Source
const (
	CommandQueue = "000000000000/commandQueue"
)

Variables

This section is empty.

Functions

func GetCommandQueueUrl

func GetCommandQueueUrl(host string) string

Types

type BucketClient

type BucketClient interface {
	Put(bucket, fileName string, content []byte, ctx context.Context) (string, error)
	Delete(bucket, fileName string, ctx context.Context) error
	Get(bucket, fileName string, ctx context.Context) ([]byte, error)
	Exist(bucket string, fileName string) (bool, error)
}

func NewS3

func NewS3(config Config) BucketClient

type Config

type Config struct {
	Address string `json:"address"`
	Region  string `json:"region"`
	Profile string `json:"profile"`
	ID      string `json:"ID"`
	Secret  string `json:"secret"`
}

type Message

type Message struct {
	Body string
	// contains filtered or unexported fields
}

type Queue

type Queue interface {
	Push(message string, ctx context.Context) (string, error)
	Pull(ctx context.Context) ([]Message, error)
	Delete(msg Message) error
	InQueue(messageId string) (bool, error)
}

func NewSQSQueue

func NewSQSQueue(config Config, queueURL string) (Queue, error)

type S3

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

func (S3) Delete

func (s S3) Delete(bucket, fileName string, ctx context.Context) error

func (S3) Exist

func (s S3) Exist(bucket string, fileName string) (bool, error)

func (S3) Get

func (s S3) Get(bucket, fileName string, ctx context.Context) ([]byte, error)

func (S3) Put

func (s S3) Put(bucket, fileName string, content []byte, ctx context.Context) (string, error)

type S3Storage

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

func (*S3Storage) GetNotes

func (s *S3Storage) GetNotes(dir string, name string, ctx context.Context) (string, error)

func (*S3Storage) GetUserInfo

func (s *S3Storage) GetUserInfo(name string, ctx context.Context) (models.UserInfo, error)

func (*S3Storage) IsUserExist

func (s *S3Storage) IsUserExist(login string) (bool, error)

func (*S3Storage) PutNotes

func (s *S3Storage) PutNotes(dir string, note models.Note, ctx context.Context) error

func (*S3Storage) PutUser

func (s *S3Storage) PutUser(userInfo models.UserInfo, ctx context.Context) error

type SqsClient

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

func (*SqsClient) Delete

func (s *SqsClient) Delete(msg Message) error

func (*SqsClient) InQueue

func (s *SqsClient) InQueue(messageId string) (bool, error)

func (*SqsClient) Pull

func (s *SqsClient) Pull(ctx context.Context) ([]Message, error)

func (*SqsClient) Push

func (s *SqsClient) Push(message string, ctx context.Context) (string, error)

type Storage

type Storage interface {
	GetUserInfo(name string, ctx context.Context) (models.UserInfo, error)
	PutUser(userInfo models.UserInfo, ctx context.Context) error
	IsUserExist(login string) (bool, error)
	PutNotes(dir string, note models.Note, ctx context.Context) error
	GetNotes(dir string, name string, ctx context.Context) (string, error)
}

func NewStorage

func NewStorage(s3 BucketClient) Storage

Jump to

Keyboard shortcuts

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