github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/internal/config/notify/config.go (about) 1 // Copyright (c) 2015-2021 MinIO, Inc. 2 // 3 // This file is part of MinIO Object Storage stack 4 // 5 // This program is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU Affero General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Affero General Public License for more details. 14 // 15 // You should have received a copy of the GNU Affero General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 package notify 19 20 import ( 21 "github.com/minio/minio/internal/event/target" 22 ) 23 24 // Config - notification target configuration structure, holds 25 // information about various notification targets. 26 type Config struct { 27 AMQP map[string]target.AMQPArgs `json:"amqp"` 28 Elasticsearch map[string]target.ElasticsearchArgs `json:"elasticsearch"` 29 Kafka map[string]target.KafkaArgs `json:"kafka"` 30 MQTT map[string]target.MQTTArgs `json:"mqtt"` 31 MySQL map[string]target.MySQLArgs `json:"mysql"` 32 NATS map[string]target.NATSArgs `json:"nats"` 33 NSQ map[string]target.NSQArgs `json:"nsq"` 34 PostgreSQL map[string]target.PostgreSQLArgs `json:"postgresql"` 35 Redis map[string]target.RedisArgs `json:"redis"` 36 Webhook map[string]target.WebhookArgs `json:"webhook"` 37 } 38 39 const ( 40 defaultTarget = "1" 41 ) 42 43 // NewConfig - initialize notification config. 44 func NewConfig() Config { 45 // Make sure to initialize notification targets 46 cfg := Config{ 47 NSQ: make(map[string]target.NSQArgs), 48 AMQP: make(map[string]target.AMQPArgs), 49 MQTT: make(map[string]target.MQTTArgs), 50 NATS: make(map[string]target.NATSArgs), 51 Redis: make(map[string]target.RedisArgs), 52 MySQL: make(map[string]target.MySQLArgs), 53 Kafka: make(map[string]target.KafkaArgs), 54 Webhook: make(map[string]target.WebhookArgs), 55 PostgreSQL: make(map[string]target.PostgreSQLArgs), 56 Elasticsearch: make(map[string]target.ElasticsearchArgs), 57 } 58 cfg.NSQ[defaultTarget] = target.NSQArgs{} 59 cfg.AMQP[defaultTarget] = target.AMQPArgs{} 60 cfg.MQTT[defaultTarget] = target.MQTTArgs{} 61 cfg.NATS[defaultTarget] = target.NATSArgs{} 62 cfg.Redis[defaultTarget] = target.RedisArgs{} 63 cfg.MySQL[defaultTarget] = target.MySQLArgs{} 64 cfg.Kafka[defaultTarget] = target.KafkaArgs{} 65 cfg.Webhook[defaultTarget] = target.WebhookArgs{} 66 cfg.PostgreSQL[defaultTarget] = target.PostgreSQLArgs{} 67 cfg.Elasticsearch[defaultTarget] = target.ElasticsearchArgs{} 68 return cfg 69 }