client

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: LGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package client contains struct for client third parties

Package client contains struct for client third parties

Package client contains struct for client third parties

Package client contains struct for client third parties

Package client contains struct for client third parties

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 interface {
	Close() error
	IsClosed() bool
	NotifyClose(c chan *amqp.Error) chan *amqp.Error
	NotifyFlow(c chan bool) chan bool
	NotifyReturn(c chan amqp.Return) chan amqp.Return
	NotifyCancel(c chan string) chan string
	NotifyConfirm(ack, nack chan uint64) (chan uint64, chan uint64)
	NotifyPublish(confirm chan amqp.Confirmation) chan amqp.Confirmation
	Qos(prefetchCount, prefetchSize int, global bool) error
	Cancel(consumer string, noWait bool) error
	QueueDeclare(name string, durable, autoDelete, exclusive, noWait bool, args amqp.Table) (amqp.Queue, error)
	QueueDeclarePassive(name string, durable, autoDelete, exclusive, noWait bool, args amqp.Table) (amqp.Queue, error)
	QueueInspect(name string) (amqp.Queue, error)
	QueueBind(name, key, exchange string, noWait bool, args amqp.Table) error
	QueueUnbind(name, key, exchange string, args amqp.Table) error
	QueuePurge(name string, noWait bool) (int, error)
	QueueDelete(name string, ifUnused, ifEmpty, noWait bool) (int, error)
	Consume(queue, consumer string, autoAck, exclusive, noLocal, noWait bool, args amqp.Table) (<-chan amqp.Delivery, error)
	ExchangeDeclare(name, kind string, durable, autoDelete, internal, noWait bool, args amqp.Table) error
	ExchangeDeclarePassive(name, kind string, durable, autoDelete, internal, noWait bool, args amqp.Table) error
	ExchangeDelete(name string, ifUnused, noWait bool) error
	ExchangeBind(destination, key, source string, noWait bool, args amqp.Table) error
	ExchangeUnbind(destination, key, source string, noWait bool, args amqp.Table) error
	Publish(exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error
	PublishWithDeferredConfirm(exchange, key string, mandatory, immediate bool, msg amqp.Publishing) (*amqp.DeferredConfirmation, error)
	Get(queue string, autoAck bool) (msg amqp.Delivery, ok bool, err error)
	Tx() error
	TxCommit() error
	TxRollback() error
	Flow(active bool) error
	Confirm(noWait bool) error
	Recover(requeue bool) error
	Ack(tag uint64, multiple bool) error
	Nack(tag uint64, multiple bool, requeue bool) error
	Reject(tag uint64, requeue bool) error
	GetNextPublishSeqNo() uint64
}

AMQPChannel is an interface for amqp channel wrapper

type AMQPConnection added in v0.9.0

type AMQPConnection interface {
	LocalAddr() net.Addr
	ConnectionState() tls.ConnectionState
	NotifyClose(receiver chan *amqp.Error) chan *amqp.Error
	NotifyBlocked(receiver chan amqp.Blocking) chan amqp.Blocking
	Close() error
	IsClosed() bool
	Channel() (AMQPChannel, error)
}

AMQPConnection is a client wrapper interface

func NewAMQPConnection added in v0.9.0

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

NewAMQPConnection is AMQPConnection constructor

type AMQPConnectionConfig added in v0.9.0

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

AMQPConnectionConfig 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) *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 {
	// 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

func (*S3Manager) Delete added in v1.13.0

func (sm *S3Manager) Delete(bucketName string) error

Delete is used to delete a bucket from the manager

func (*S3Manager) Get added in v1.13.0

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

Get is used to fetch a bucket from the manager

func (*S3Manager) GetAll added in v1.13.0

func (sm *S3Manager) GetAll() map[string]StorageAccessLayer

GetAll is used to fetch all buckets from the manager

type S3Wrapper

type S3Wrapper struct {
	// 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 {
	// 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 {
	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) Client

func (s *SFTPWrapper) Client() *sftp.Client

Client ensures that client can be fetched and is not reconnecting

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
}

Directories

Path Synopsis
Package mock_source is a generated GoMock package.
Package mock_source is a generated GoMock package.

Jump to

Keyboard shortcuts

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