client

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: LGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAMQPConfig added in v0.6.0

func NewAMQPConfig(vhost string, channelMax int, heartbeat time.Duration) amqp.Config

NewAMQPConfig is a simple AMQP Config constructor

func NewAWSConfig

func NewAWSConfig() *aws.Config

NewAWSConfig is AWS Config constructor

func NewAWSSession

func NewAWSSession(config *aws.Config) *session.Session

NewAWSSession is AWS Session constructor

func NewS3Client

func NewS3Client(session *session.Session) *s3.S3

NewS3Client is AWS S3 constructor

func NewSFTPClient

func NewSFTPClient(sshClient *ssh.Client) (*sftp.Client, error)

NewSFTPClient is SFTP client constructor

func NewSSHClient

func NewSSHClient(host string, port uint32, sshConfig *ssh.ClientConfig) (*ssh.Client, error)

NewSSHClient is SSH client constructor

func NewSSHConfig

func NewSSHConfig(user string, password string) *ssh.ClientConfig

NewSSHConfig is SSH ClientConfig constructor

Types

type AMQPChannel added in v0.9.0

type AMQPChannel struct {
	sync.Mutex
	*amqp.Channel
	// contains filtered or unexported fields
}

AMQPChannel is AMQP chan wrapper struct

func NewAMQPChannel added in v0.9.0

func NewAMQPChannel(channel *amqp.Channel) *AMQPChannel

NewAMQPChannel is wrapper for AMPQ channels constructor

func (*AMQPChannel) Close added in v0.9.0

func (ac *AMQPChannel) Close() error

Close closes running channel and change internal state

func (*AMQPChannel) IsClosed added in v0.9.0

func (ac *AMQPChannel) IsClosed() bool

IsClosed change internal channel state

type AMQPConnection added in v0.9.0

type AMQPConnection struct {
	*amqp.Connection
	// contains filtered or unexported fields
}

AMQPConnection is a struct to handle AMQP connection

func NewAMQPConnection added in v0.9.0

func NewAMQPConnection(config *AMQPConnectionConfig) (*AMQPConnection, error)

NewAMQPConnection is AMQPConnection constructor

func (*AMQPConnection) Channel added in v0.9.0

func (ac *AMQPConnection) Channel() (*AMQPChannel, error)

type AMQPConnectionConfig added in v0.9.0

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

AMQPConnection is a struct to manage AMQP connections

func NewAMQPConnectionConfig added in v0.9.0

func NewAMQPConnectionConfig(host string, port int, user, password string, config *amqp.Config) *AMQPConnectionConfig

NewAMQPConnectionConfig is AMQP client constructor

type AWSManager

type AWSManager struct {
	S3Manager *S3Manager
	// contains filtered or unexported fields
}

AWSManager is a struct to manage AWS SDK

func NewAWSManager

func NewAWSManager(session *session.Session) *AWSManager

NewAWSManager is AWSManager constructor

type DownloadOptions added in v0.7.0

type DownloadOptions struct {
	IfMatch                    string
	IfModifiedSince            *time.Time
	IfNoneMatch                string
	IfUnmodifiedSince          *time.Time
	ResponseCacheControl       string
	ResponseContentDisposition string
	ResponseContentEncoding    string
	ResponseContentLanguage    string
	ResponseContentType        string
	ResponseExpires            *time.Time
	VersionId                  string
}

type RedisConfig

type RedisConfig struct {
	Host string
	Port uint16
	DB   uint8
}

RedisConfig is a struct definition for Redis Client

func (*RedisConfig) ToOption

func (rc *RedisConfig) ToOption() *redis.Options

ToOption is used by RedisConfig to generate Option struct from client

type RedisManager

type RedisManager struct {
	Clients map[string]*redis.Client

	sync.RWMutex
	// contains filtered or unexported fields
}

RedisManager is a struct to manage Redis clients

func NewRedisManager

func NewRedisManager(config RedisConfig, logger *logrus.Logger) *RedisManager

NewRedisManager is RedisManager struct constructor

func (*RedisManager) AddClient

func (rw *RedisManager) AddClient(category string) (*redis.Client, error)

AddClient pushes a new client in manager

func (*RedisManager) Close

func (rw *RedisManager) Close() error

Close closes all connections

func (*RedisManager) GetCategories

func (rw *RedisManager) GetCategories() (clientsCat []string)

GetCategories fetches categories of client available

type S3Manager

type S3Manager struct {
	S3 map[string]StorageAccessLayer
	sync.Mutex
	// contains filtered or unexported fields
}

S3Manager is a struct to control S3 client

func NewS3Manager

func NewS3Manager(session *session.Session) *S3Manager

NewS3Manager is a S3Manager constructor

func (*S3Manager) Add

func (sm *S3Manager) Add(bucketName string) *S3Wrapper

Add is used to add a bucket to the manager

type S3Wrapper

type S3Wrapper struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

S3Wrapper is a S3 Adapter

func NewS3Wrapper

func NewS3Wrapper(bucketName string, s3Client *s3.S3) *S3Wrapper

NewS3Wrapper is S3Wrapper struct constructor

func (*S3Wrapper) Delete

func (s3w *S3Wrapper) Delete(path string, filename ...string) (*s3.DeleteObjectsOutput, error)

Delete drops files from S3

func (*S3Wrapper) Download

func (s3w *S3Wrapper) Download(path string, filename string, data io.WriterAt, options *DownloadOptions) (int64, error)

Download fetches a file from S3

func (*S3Wrapper) Read

func (s3w *S3Wrapper) Read(path string, limit int64, readFrom string) (*s3.ListObjectsV2Output, error)

Read gets file content from S3

func (*S3Wrapper) Upload

func (s3w *S3Wrapper) Upload(path string, filename string, data io.Reader, options *UploadOptions) (string, error)

Upload pushes a file to S3

type SFTPManager

type SFTPManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SFTPManager is a struct to manage SFTP connections

func NewSFTPManager

func NewSFTPManager(host string, port uint32, sshConfig *ssh.ClientConfig, maxCap uint) *SFTPManager

NewSFTPManager is SFTPManager constructor

func (*SFTPManager) AddClient

func (sm *SFTPManager) AddClient() error

AddClient adds a new SFTP client in pool

func (*SFTPManager) Close

func (sm *SFTPManager) Close() error

Close closes all SFTP connections

func (*SFTPManager) GetClient added in v0.3.0

func (sm *SFTPManager) GetClient() (*SFTPWrapper, error)

GetClient get a new SFTP client in pool

func (*SFTPManager) PutClient added in v0.3.1

func (sm *SFTPManager) PutClient(client *SFTPWrapper)

PutClient add an existing SFTP client in pool

func (*SFTPManager) SetPoolFactory added in v0.5.0

func (sm *SFTPManager) SetPoolFactory(factory syncPkg.Factory)

SetPoolFactory adds func factory to pool

type SFTPWrapper

type SFTPWrapper struct {
	sync.Mutex

	Client *sftp.Client

	Reconnects uint64
	// contains filtered or unexported fields
}

SFTPWrapper is SFTP client wrapper struct

func NewSFTPWrapper

func NewSFTPWrapper(sshClient *ssh.Client, sftpClient *sftp.Client) *SFTPWrapper

NewSFTPWrapper is SFTPWrapper constructor

func (*SFTPWrapper) Close

func (s *SFTPWrapper) Close() error

Close closes connection from SFTP => chan notify ssh connection to close

type StorageAccessLayer

type StorageAccessLayer interface {
	Upload(path string, filename string, data io.Reader, options *UploadOptions) (string, error)
	Download(path string, filename string, data io.WriterAt, options *DownloadOptions) (int64, error)
	Read(path string, limit int64, readFrom string) (*s3.ListObjectsV2Output, error)
	Delete(path string, files ...string) (*s3.DeleteObjectsOutput, error)
}

StorageAccessLayer is a common interface for AWS storage Specific to S3 for now...

type UploadOptions added in v0.7.0

type UploadOptions struct {
	ACL                       string
	CacheControl              string
	ContentDisposition        string
	ContentEncoding           string
	ContentLanguage           string
	ContentMD5                string
	ContentType               string
	Expires                   *time.Time
	GrantFullControl          string
	GrantRead                 string
	GrantReadACP              string
	GrantWriteACP             string
	Metadata                  map[string]string
	ObjectLockMode            string
	ObjectLockRetainUntilDate *time.Time
	ServerSideEncryption      string
	StorageClass              string
	Tagging                   string
}

Jump to

Keyboard shortcuts

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