storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/cmd/config/notify/config.go (about) 1 /* 2 * MinIO Cloud Storage, (C) 2019 MinIO, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package notify 18 19 import ( 20 "storj.io/minio/pkg/event/target" 21 ) 22 23 // Config - notification target configuration structure, holds 24 // information about various notification targets. 25 type Config struct { 26 AMQP map[string]target.AMQPArgs `json:"amqp"` 27 Elasticsearch map[string]target.ElasticsearchArgs `json:"elasticsearch"` 28 Kafka map[string]target.KafkaArgs `json:"kafka"` 29 MQTT map[string]target.MQTTArgs `json:"mqtt"` 30 MySQL map[string]target.MySQLArgs `json:"mysql"` 31 NATS map[string]target.NATSArgs `json:"nats"` 32 NSQ map[string]target.NSQArgs `json:"nsq"` 33 PostgreSQL map[string]target.PostgreSQLArgs `json:"postgresql"` 34 Redis map[string]target.RedisArgs `json:"redis"` 35 Webhook map[string]target.WebhookArgs `json:"webhook"` 36 } 37 38 const ( 39 defaultTarget = "1" 40 ) 41 42 // NewConfig - initialize notification config. 43 func NewConfig() Config { 44 // Make sure to initialize notification targets 45 cfg := Config{ 46 NSQ: make(map[string]target.NSQArgs), 47 AMQP: make(map[string]target.AMQPArgs), 48 MQTT: make(map[string]target.MQTTArgs), 49 NATS: make(map[string]target.NATSArgs), 50 Redis: make(map[string]target.RedisArgs), 51 MySQL: make(map[string]target.MySQLArgs), 52 Kafka: make(map[string]target.KafkaArgs), 53 Webhook: make(map[string]target.WebhookArgs), 54 PostgreSQL: make(map[string]target.PostgreSQLArgs), 55 Elasticsearch: make(map[string]target.ElasticsearchArgs), 56 } 57 cfg.NSQ[defaultTarget] = target.NSQArgs{} 58 cfg.AMQP[defaultTarget] = target.AMQPArgs{} 59 cfg.MQTT[defaultTarget] = target.MQTTArgs{} 60 cfg.NATS[defaultTarget] = target.NATSArgs{} 61 cfg.Redis[defaultTarget] = target.RedisArgs{} 62 cfg.MySQL[defaultTarget] = target.MySQLArgs{} 63 cfg.Kafka[defaultTarget] = target.KafkaArgs{} 64 cfg.Webhook[defaultTarget] = target.WebhookArgs{} 65 cfg.PostgreSQL[defaultTarget] = target.PostgreSQLArgs{} 66 cfg.Elasticsearch[defaultTarget] = target.ElasticsearchArgs{} 67 return cfg 68 }