target

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MySQLFormat             = "format"
	MySQLDSNString          = "dsn_string"
	MySQLTable              = "table"
	MySQLHost               = "host"
	MySQLPort               = "port"
	MySQLUsername           = "username"
	MySQLPassword           = "password"
	MySQLDatabase           = "database"
	MySQLQueueLimit         = "queue_limit"
	MySQLQueueDir           = "queue_dir"
	MySQLMaxOpenConnections = "max_open_connections"

	EnvMySQLEnable             = "MINIO_NOTIFY_MYSQL_ENABLE"
	EnvMySQLFormat             = "MINIO_NOTIFY_MYSQL_FORMAT"
	EnvMySQLDSNString          = "MINIO_NOTIFY_MYSQL_DSN_STRING"
	EnvMySQLTable              = "MINIO_NOTIFY_MYSQL_TABLE"
	EnvMySQLHost               = "MINIO_NOTIFY_MYSQL_HOST"
	EnvMySQLPort               = "MINIO_NOTIFY_MYSQL_PORT"
	EnvMySQLUsername           = "MINIO_NOTIFY_MYSQL_USERNAME"
	EnvMySQLPassword           = "MINIO_NOTIFY_MYSQL_PASSWORD"
	EnvMySQLDatabase           = "MINIO_NOTIFY_MYSQL_DATABASE"
	EnvMySQLQueueLimit         = "MINIO_NOTIFY_MYSQL_QUEUE_LIMIT"
	EnvMySQLQueueDir           = "MINIO_NOTIFY_MYSQL_QUEUE_DIR"
	EnvMySQLMaxOpenConnections = "MINIO_NOTIFY_MYSQL_MAX_OPEN_CONNECTIONS"
)

MySQL related constants

View Source
const (
	PostgresFormat             = "format"
	PostgresConnectionString   = "connection_string"
	PostgresTable              = "table"
	PostgresHost               = "host"
	PostgresPort               = "port"
	PostgresUsername           = "username"
	PostgresPassword           = "password"
	PostgresDatabase           = "database"
	PostgresQueueDir           = "queue_dir"
	PostgresQueueLimit         = "queue_limit"
	PostgresMaxOpenConnections = "max_open_connections"

	EnvPostgresEnable             = "MINIO_NOTIFY_POSTGRES_ENABLE"
	EnvPostgresFormat             = "MINIO_NOTIFY_POSTGRES_FORMAT"
	EnvPostgresConnectionString   = "MINIO_NOTIFY_POSTGRES_CONNECTION_STRING"
	EnvPostgresTable              = "MINIO_NOTIFY_POSTGRES_TABLE"
	EnvPostgresHost               = "MINIO_NOTIFY_POSTGRES_HOST"
	EnvPostgresPort               = "MINIO_NOTIFY_POSTGRES_PORT"
	EnvPostgresUsername           = "MINIO_NOTIFY_POSTGRES_USERNAME"
	EnvPostgresPassword           = "MINIO_NOTIFY_POSTGRES_PASSWORD"
	EnvPostgresDatabase           = "MINIO_NOTIFY_POSTGRES_DATABASE"
	EnvPostgresQueueDir           = "MINIO_NOTIFY_POSTGRES_QUEUE_DIR"
	EnvPostgresQueueLimit         = "MINIO_NOTIFY_POSTGRES_QUEUE_LIMIT"
	EnvPostgresMaxOpenConnections = "MINIO_NOTIFY_POSTGRES_MAX_OPEN_CONNECTIONS"
)

Postgres constants

View Source
const (
	RedisFormat     = "format"
	RedisAddress    = "address"
	RedisPassword   = "password"
	RedisKey        = "key"
	RedisQueueDir   = "queue_dir"
	RedisQueueLimit = "queue_limit"

	EnvRedisEnable     = "MINIO_NOTIFY_REDIS_ENABLE"
	EnvRedisFormat     = "MINIO_NOTIFY_REDIS_FORMAT"
	EnvRedisAddress    = "MINIO_NOTIFY_REDIS_ADDRESS"
	EnvRedisPassword   = "MINIO_NOTIFY_REDIS_PASSWORD"
	EnvRedisKey        = "MINIO_NOTIFY_REDIS_KEY"
	EnvRedisQueueDir   = "MINIO_NOTIFY_REDIS_QUEUE_DIR"
	EnvRedisQueueLimit = "MINIO_NOTIFY_REDIS_QUEUE_LIMIT"
)

Redis constants

View Source
const (
	WebhookEndpoint   = "endpoint"
	WebhookAuthToken  = "auth_token"
	WebhookQueueDir   = "queue_dir"
	WebhookQueueLimit = "queue_limit"
	WebhookClientCert = "client_cert"
	WebhookClientKey  = "client_key"

	EnvWebhookEnable     = "MINIO_NOTIFY_WEBHOOK_ENABLE"
	EnvWebhookEndpoint   = "MINIO_NOTIFY_WEBHOOK_ENDPOINT"
	EnvWebhookAuthToken  = "MINIO_NOTIFY_WEBHOOK_AUTH_TOKEN"
	EnvWebhookQueueDir   = "MINIO_NOTIFY_WEBHOOK_QUEUE_DIR"
	EnvWebhookQueueLimit = "MINIO_NOTIFY_WEBHOOK_QUEUE_LIMIT"
	EnvWebhookClientCert = "MINIO_NOTIFY_WEBHOOK_CLIENT_CERT"
	EnvWebhookClientKey  = "MINIO_NOTIFY_WEBHOOK_CLIENT_KEY"
)

Webhook constants

Variables

This section is empty.

Functions

func IsConnErr

func IsConnErr(err error) bool

IsConnErr - To detect a connection error.

func IsConnRefusedErr

func IsConnRefusedErr(err error) bool

IsConnRefusedErr - To check fot "connection refused" error.

func IsConnResetErr

func IsConnResetErr(err error) bool

IsConnResetErr - Checks for connection reset errors.

Types

type MySQLArgs

type MySQLArgs struct {
	Enable             bool     `json:"enable"`
	Format             string   `json:"format"`
	DSN                string   `json:"dsnString"`
	Table              string   `json:"table"`
	Host               xnet.URL `json:"host"`
	Port               string   `json:"port"`
	User               string   `json:"user"`
	Password           string   `json:"password"`
	Database           string   `json:"database"`
	QueueDir           string   `json:"queueDir"`
	QueueLimit         uint64   `json:"queueLimit"`
	MaxOpenConnections int      `json:"maxOpenConnections"`
}

MySQLArgs - MySQL target arguments.

func (MySQLArgs) Validate

func (m MySQLArgs) Validate() error

Validate MySQLArgs fields

type MySQLTarget

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

MySQLTarget - MySQL target.

func NewMySQLTarget

func NewMySQLTarget(id string, args MySQLArgs, doneCh <-chan struct{}, loggerOnce func(ctx context.Context, err error, id interface{}, kind ...interface{}), test bool) (*MySQLTarget, error)

NewMySQLTarget - creates new MySQL target.

func (*MySQLTarget) Close

func (target *MySQLTarget) Close() error

Close - closes underneath connections to MySQL database.

func (*MySQLTarget) HasQueueStore

func (target *MySQLTarget) HasQueueStore() bool

HasQueueStore - Checks if the queueStore has been configured for the target

func (*MySQLTarget) ID

func (target *MySQLTarget) ID() event.TargetID

ID - returns target ID.

func (*MySQLTarget) IsActive

func (target *MySQLTarget) IsActive() (bool, error)

IsActive - Return true if target is up and active

func (*MySQLTarget) Save

func (target *MySQLTarget) Save(eventData event.Event) error

Save - saves the events to the store which will be replayed when the SQL connection is active.

func (*MySQLTarget) Send

func (target *MySQLTarget) Send(eventKey string) error

Send - reads an event from store and sends it to MySQL.

type PostgreSQLArgs

type PostgreSQLArgs struct {
	Enable             bool      `json:"enable"`
	Format             string    `json:"format"`
	ConnectionString   string    `json:"connectionString"`
	Table              string    `json:"table"`
	Host               xnet.Host `json:"host"`     // default: localhost
	Port               string    `json:"port"`     // default: 5432
	Username           string    `json:"username"` // default: user running minio
	Password           string    `json:"password"` // default: no password
	Database           string    `json:"database"` // default: same as user
	QueueDir           string    `json:"queueDir"`
	QueueLimit         uint64    `json:"queueLimit"`
	MaxOpenConnections int       `json:"maxOpenConnections"`
}

PostgreSQLArgs - PostgreSQL target arguments.

func (PostgreSQLArgs) Validate

func (p PostgreSQLArgs) Validate() error

Validate PostgreSQLArgs fields

type PostgreSQLTarget

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

PostgreSQLTarget - PostgreSQL target.

func NewPostgreSQLTarget

func NewPostgreSQLTarget(id string, args PostgreSQLArgs, doneCh <-chan struct{}, loggerOnce func(ctx context.Context, err error, id interface{}, kind ...interface{}), test bool) (*PostgreSQLTarget, error)

NewPostgreSQLTarget - creates new PostgreSQL target.

func (*PostgreSQLTarget) Close

func (target *PostgreSQLTarget) Close() error

Close - closes underneath connections to PostgreSQL database.

func (*PostgreSQLTarget) HasQueueStore

func (target *PostgreSQLTarget) HasQueueStore() bool

HasQueueStore - Checks if the queueStore has been configured for the target

func (*PostgreSQLTarget) ID

func (target *PostgreSQLTarget) ID() event.TargetID

ID - returns target ID.

func (*PostgreSQLTarget) IsActive

func (target *PostgreSQLTarget) IsActive() (bool, error)

IsActive - Return true if target is up and active

func (*PostgreSQLTarget) Save

func (target *PostgreSQLTarget) Save(eventData event.Event) error

Save - saves the events to the store if questore is configured, which will be replayed when the PostgreSQL connection is active.

func (*PostgreSQLTarget) Send

func (target *PostgreSQLTarget) Send(eventKey string) error

Send - reads an event from store and sends it to PostgreSQL.

type QueueStore

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

QueueStore - Filestore for persisting events.

func (*QueueStore) Del

func (store *QueueStore) Del(key string) error

Del - Deletes an entry from the store.

func (*QueueStore) Get

func (store *QueueStore) Get(key string) (event event.Event, err error)

Get - gets a event from the store.

func (*QueueStore) List

func (store *QueueStore) List() ([]string, error)

List - lists all files from the directory.

func (*QueueStore) Open

func (store *QueueStore) Open() error

Open - Creates the directory if not present.

func (*QueueStore) Put

func (store *QueueStore) Put(e event.Event) error

Put - puts a event to the store.

type RedisAccessEvent

type RedisAccessEvent struct {
	Event     []event.Event
	EventTime string
}

RedisAccessEvent holds event log data and timestamp

type RedisArgs

type RedisArgs struct {
	Enable     bool   `json:"enable"`
	Format     string `json:"format"`
	Addr       string `json:"address"`
	Password   string `json:"password"`
	Key        string `json:"key"`
	QueueDir   string `json:"queueDir"`
	QueueLimit uint64 `json:"queueLimit"`
}

RedisArgs - Redis target arguments.

func (RedisArgs) Validate

func (r RedisArgs) Validate() error

Validate RedisArgs fields

type RedisTarget

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

RedisTarget - Redis target.

func NewRedisTarget

func NewRedisTarget(id string, args RedisArgs, doneCh <-chan struct{}, loggerOnce func(ctx context.Context, err error, id interface{}, errKind ...interface{}), test bool) (*RedisTarget, error)

NewRedisTarget - creates new Redis target.

func (*RedisTarget) Close

func (target *RedisTarget) Close() error

Close - releases the resources used by the pool.

func (*RedisTarget) HasQueueStore

func (target *RedisTarget) HasQueueStore() bool

HasQueueStore - Checks if the queueStore has been configured for the target

func (*RedisTarget) ID

func (target *RedisTarget) ID() event.TargetID

ID - returns target ID.

func (*RedisTarget) IsActive

func (target *RedisTarget) IsActive() (bool, error)

IsActive - Return true if target is up and active

func (*RedisTarget) Save

func (target *RedisTarget) Save(eventData event.Event) error

Save - saves the events to the store if questore is configured, which will be replayed when the redis connection is active.

func (*RedisTarget) Send

func (target *RedisTarget) Send(eventKey string) error

Send - reads an event from store and sends it to redis.

type Store

type Store interface {
	Put(event event.Event) error
	Get(key string) (event.Event, error)
	List() ([]string, error)
	Del(key string) error
	Open() error
}

Store - To persist the events.

func NewQueueStore

func NewQueueStore(directory string, limit uint64) Store

NewQueueStore - Creates an instance for QueueStore.

type WebhookArgs

type WebhookArgs struct {
	Enable     bool            `json:"enable"`
	Endpoint   xnet.URL        `json:"endpoint"`
	AuthToken  string          `json:"authToken"`
	Transport  *http.Transport `json:"-"`
	QueueDir   string          `json:"queueDir"`
	QueueLimit uint64          `json:"queueLimit"`
	ClientCert string          `json:"clientCert"`
	ClientKey  string          `json:"clientKey"`
}

WebhookArgs - Webhook target arguments.

func (WebhookArgs) Validate

func (w WebhookArgs) Validate() error

Validate WebhookArgs fields

type WebhookTarget

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

WebhookTarget - Webhook target.

func NewWebhookTarget

func NewWebhookTarget(ctx context.Context, id string, args WebhookArgs, loggerOnce func(ctx context.Context, err error, id interface{}, kind ...interface{}), transport *http.Transport, test bool) (*WebhookTarget, error)

NewWebhookTarget - creates new Webhook target.

func (*WebhookTarget) Close

func (target *WebhookTarget) Close() error

Close - does nothing and available for interface compatibility.

func (*WebhookTarget) HasQueueStore

func (target *WebhookTarget) HasQueueStore() bool

HasQueueStore - Checks if the queueStore has been configured for the target

func (WebhookTarget) ID

func (target WebhookTarget) ID() event.TargetID

ID - returns target ID.

func (*WebhookTarget) IsActive

func (target *WebhookTarget) IsActive() (bool, error)

IsActive - Return true if target is up and active

func (*WebhookTarget) Save

func (target *WebhookTarget) Save(eventData event.Event) error

Save - saves the events to the store if queuestore is configured, which will be replayed when the wenhook connection is active.

func (*WebhookTarget) Send

func (target *WebhookTarget) Send(eventKey string) error

Send - reads an event from store and sends it to webhook.

Jump to

Keyboard shortcuts

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