Documentation
¶
Index ¶
- Variables
- func FetchRegisteredTargets(ctx context.Context, cfg config.Config, transport *http.Transport, test bool, ...) (_ *event.TargetList, err error)
- func GetNotificationTargets(ctx context.Context, cfg config.Config, transport *http.Transport, test bool) (*event.TargetList, error)
- func GetNotifyMySQL(mysqlKVS map[string]config.KVS) (map[string]target.MySQLArgs, error)
- func GetNotifyPostgres(postgresKVS map[string]config.KVS) (map[string]target.PostgreSQLArgs, error)
- func GetNotifyRedis(redisKVS map[string]config.KVS) (map[string]target.RedisArgs, error)
- func GetNotifyWebhook(webhookKVS map[string]config.KVS, transport *http.Transport) (map[string]target.WebhookArgs, error)
- func RegisterNotificationTargets(ctx context.Context, cfg config.Config, transport *http.Transport, ...) (*event.TargetList, error)
- func SetNotifyMySQL(s config.Config, sqlName string, cfg target.MySQLArgs) error
- func SetNotifyPostgres(s config.Config, psqName string, cfg target.PostgreSQLArgs) error
- func SetNotifyRedis(s config.Config, redisName string, cfg target.RedisArgs) error
- func SetNotifyWebhook(s config.Config, whName string, cfg target.WebhookArgs) error
- func TestNotificationTargets(ctx context.Context, cfg config.Config, transport *http.Transport, ...) error
- type Config
Constants ¶
This section is empty.
Variables ¶
var ( HelpWebhook = config.HelpKVS{ config.HelpKV{ Key: target.WebhookEndpoint, Description: "webhook server endpoint e.g. http://localhost:8080/minio/events", Type: "url", }, config.HelpKV{ Key: target.WebhookAuthToken, Description: "opaque string or JWT authorization token", Optional: true, Type: "string", }, config.HelpKV{ Key: target.WebhookQueueDir, Description: queueDirComment, Optional: true, Type: "path", }, config.HelpKV{ Key: target.WebhookQueueLimit, Description: queueLimitComment, Optional: true, Type: "number", }, config.HelpKV{ Key: config.Comment, Description: config.DefaultComment, Optional: true, Type: "sentence", }, config.HelpKV{ Key: target.WebhookClientCert, Description: "client cert for Webhook mTLS auth", Optional: true, Type: "string", }, config.HelpKV{ Key: target.WebhookClientKey, Description: "client cert key for Webhook mTLS auth", Optional: true, Type: "string", }, } HelpAMQP = config.HelpKVS{ config.HelpKV{ Key: config.Comment, Description: config.DefaultComment, Optional: true, Type: "sentence", }, } HelpKafka = config.HelpKVS{ config.HelpKV{ Key: config.Comment, Description: config.DefaultComment, Optional: true, Type: "sentence", }, } HelpMQTT = config.HelpKVS{ config.HelpKV{ Key: config.Comment, Description: config.DefaultComment, Optional: true, Type: "sentence", }, } HelpPostgres = config.HelpKVS{ config.HelpKV{ Key: target.PostgresConnectionString, Description: `Postgres server connection-string e.g. "host=localhost port=5432 dbname=minio_events user=postgres password=password sslmode=disable"`, Type: "string", }, config.HelpKV{ Key: target.PostgresTable, Description: "DB table name to store/update events, table is auto-created", Type: "string", }, config.HelpKV{ Key: target.PostgresFormat, Description: formatComment, Type: "namespace*|access", }, config.HelpKV{ Key: target.PostgresQueueDir, Description: queueDirComment, Optional: true, Type: "path", }, config.HelpKV{ Key: target.PostgresQueueLimit, Description: queueLimitComment, Optional: true, Type: "number", }, config.HelpKV{ Key: config.Comment, Description: config.DefaultComment, Optional: true, Type: "sentence", }, config.HelpKV{ Key: target.PostgresMaxOpenConnections, Description: "To set the maximum number of open connections to the database. The value is set to `2` by default.", Optional: true, Type: "number", }, } HelpMySQL = config.HelpKVS{ config.HelpKV{ Key: target.MySQLDSNString, Description: `MySQL data-source-name connection string e.g. "<user>:<password>@tcp(<host>:<port>)/<database>"`, Optional: true, Type: "string", }, config.HelpKV{ Key: target.MySQLTable, Description: "DB table name to store/update events, table is auto-created", Type: "string", }, config.HelpKV{ Key: target.MySQLFormat, Description: formatComment, Type: "namespace*|access", }, config.HelpKV{ Key: target.MySQLQueueDir, Description: queueDirComment, Optional: true, Type: "path", }, config.HelpKV{ Key: target.MySQLQueueLimit, Description: queueLimitComment, Optional: true, Type: "number", }, config.HelpKV{ Key: config.Comment, Description: config.DefaultComment, Optional: true, Type: "sentence", }, config.HelpKV{ Key: target.MySQLMaxOpenConnections, Description: "To set the maximum number of open connections to the database. The value is set to `2` by default.", Optional: true, Type: "number", }, } HelpNATS = config.HelpKVS{ config.HelpKV{ Key: config.Comment, Description: config.DefaultComment, Optional: true, Type: "sentence", }, } HelpNSQ = config.HelpKVS{ config.HelpKV{ Key: config.Comment, Description: config.DefaultComment, Optional: true, Type: "sentence", }, } HelpES = config.HelpKVS{ config.HelpKV{ Key: config.Comment, Description: config.DefaultComment, Optional: true, Type: "sentence", }, } HelpRedis = config.HelpKVS{ config.HelpKV{ Key: target.RedisAddress, Description: "Redis server's address. For example: `localhost:6379`", Type: "address", }, config.HelpKV{ Key: target.RedisKey, Description: "Redis key to store/update events, key is auto-created", Type: "string", }, config.HelpKV{ Key: target.RedisFormat, Description: formatComment, Type: "namespace*|access", }, config.HelpKV{ Key: target.RedisPassword, Description: "Redis server password", Optional: true, Type: "string", }, config.HelpKV{ Key: target.RedisQueueDir, Description: queueDirComment, Optional: true, Type: "path", }, config.HelpKV{ Key: target.RedisQueueLimit, Description: queueLimitComment, Optional: true, Type: "number", }, config.HelpKV{ Key: config.Comment, Description: config.DefaultComment, Optional: true, Type: "sentence", }, } )
Help template inputs for all notification targets
var ( DefaultMySQLKVS = config.KVS{ config.KV{ Key: config.Enable, Value: config.EnableOff, }, config.KV{ Key: target.MySQLFormat, Value: formatNamespace, }, config.KV{ Key: target.MySQLDSNString, Value: "", }, config.KV{ Key: target.MySQLTable, Value: "", }, config.KV{ Key: target.MySQLQueueDir, Value: "", }, config.KV{ Key: target.MySQLQueueLimit, Value: "0", }, config.KV{ Key: target.MySQLMaxOpenConnections, Value: "2", }, } )
DefaultMySQLKVS - default KV for MySQL
var ( DefaultNotificationKVS = map[string]config.KVS{ config.NotifyMySQLSubSys: DefaultMySQLKVS, config.NotifyPostgresSubSys: DefaultPostgresKVS, config.NotifyRedisSubSys: DefaultRedisKVS, config.NotifyWebhookSubSys: DefaultWebhookKVS, } )
DefaultNotificationKVS - default notification list of kvs.
var ( DefaultPostgresKVS = config.KVS{ config.KV{ Key: config.Enable, Value: config.EnableOff, }, config.KV{ Key: target.PostgresFormat, Value: formatNamespace, }, config.KV{ Key: target.PostgresConnectionString, Value: "", }, config.KV{ Key: target.PostgresTable, Value: "", }, config.KV{ Key: target.PostgresQueueDir, Value: "", }, config.KV{ Key: target.PostgresQueueLimit, Value: "0", }, config.KV{ Key: target.PostgresMaxOpenConnections, Value: "2", }, } )
DefaultPostgresKVS - default Postgres KV for server config.
var ( DefaultRedisKVS = config.KVS{ config.KV{ Key: config.Enable, Value: config.EnableOff, }, config.KV{ Key: target.RedisFormat, Value: formatNamespace, }, config.KV{ Key: target.RedisAddress, Value: "", }, config.KV{ Key: target.RedisKey, Value: "", }, config.KV{ Key: target.RedisPassword, Value: "", }, config.KV{ Key: target.RedisQueueDir, Value: "", }, config.KV{ Key: target.RedisQueueLimit, Value: "0", }, } )
DefaultRedisKVS - default KV for redis config
var ( DefaultWebhookKVS = config.KVS{ config.KV{ Key: config.Enable, Value: config.EnableOff, }, config.KV{ Key: target.WebhookEndpoint, Value: "", }, config.KV{ Key: target.WebhookAuthToken, Value: "", }, config.KV{ Key: target.WebhookQueueLimit, Value: "0", }, config.KV{ Key: target.WebhookQueueDir, Value: "", }, config.KV{ Key: target.WebhookClientCert, Value: "", }, config.KV{ Key: target.WebhookClientKey, Value: "", }, } )
DefaultWebhookKVS - default KV for webhook config
var ErrTargetsOffline = errors.New("one or more targets are offline. Please use `mc admin info --json` to check the offline targets")
ErrTargetsOffline - Indicates single/multiple target failures.
Functions ¶
func FetchRegisteredTargets ¶
func FetchRegisteredTargets(ctx context.Context, cfg config.Config, transport *http.Transport, test bool, returnOnTargetError bool) (_ *event.TargetList, err error)
FetchRegisteredTargets - Returns a set of configured TargetList If `returnOnTargetError` is set to true, The function returns when a target initialization fails Else, the function will return a complete TargetList irrespective of errors
func GetNotificationTargets ¶
func GetNotificationTargets(ctx context.Context, cfg config.Config, transport *http.Transport, test bool) (*event.TargetList, error)
GetNotificationTargets registers and initializes all notification targets, returns error if any.
func GetNotifyMySQL ¶
GetNotifyMySQL - returns a map of registered notification 'mysql' targets
func GetNotifyPostgres ¶
GetNotifyPostgres - returns a map of registered notification 'postgres' targets
func GetNotifyRedis ¶
GetNotifyRedis - returns a map of registered notification 'redis' targets
func GetNotifyWebhook ¶
func GetNotifyWebhook(webhookKVS map[string]config.KVS, transport *http.Transport) ( map[string]target.WebhookArgs, error)
GetNotifyWebhook - returns a map of registered notification 'webhook' targets
func RegisterNotificationTargets ¶
func RegisterNotificationTargets(ctx context.Context, cfg config.Config, transport *http.Transport, targetIDs []event.TargetID, test bool, returnOnTargetError bool) (*event.TargetList, error)
RegisterNotificationTargets - returns TargetList which contains enabled targets in serverConfig. A new notification target is added like below * Add a new target in pkg/event/target package. * Add newly added target configuration to serverConfig.Notify.<TARGET_NAME>. * Handle the configuration in this function to create/add into TargetList.
func SetNotifyMySQL ¶
SetNotifyMySQL - helper for config migration from older config.
func SetNotifyPostgres ¶
SetNotifyPostgres - helper for config migration from older config.
func SetNotifyRedis ¶
SetNotifyRedis - helper for config migration from older config.
func SetNotifyWebhook ¶
SetNotifyWebhook - helper for config migration from older config.
Types ¶
type Config ¶
type Config struct { MySQL map[string]target.MySQLArgs `json:"mysql"` PostgreSQL map[string]target.PostgreSQLArgs `json:"postgresql"` Redis map[string]target.RedisArgs `json:"redis"` Webhook map[string]target.WebhookArgs `json:"webhook"` }
Config - notification target configuration structure, holds information about various notification targets.