-
Notifications
You must be signed in to change notification settings - Fork 203
/
eventConfig.go
32 lines (28 loc) · 1016 Bytes
/
eventConfig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT
package logs
import "github.com/aws/amazon-cloudwatch-agent/tool/runtime"
type EventConfig struct {
EventName string `event_name`
EventLevels []string `event_levels`
EventFormat string `event_format`
LogGroup string `log_group_name`
LogStream string `log_stream_name`
Retention int `retention_in_days`
}
func (config *EventConfig) ToMap(ctx *runtime.Context) (string, map[string]interface{}) {
resultMap := make(map[string]interface{})
resultMap["event_name"] = config.EventName
if config.EventLevels != nil && len(config.EventLevels) > 0 {
resultMap["event_levels"] = config.EventLevels
}
if config.EventFormat != "" {
resultMap["event_format"] = config.EventFormat
}
resultMap["log_group_name"] = config.LogGroup
resultMap["log_stream_name"] = config.LogStream
if config.Retention != 0 {
resultMap["retention_in_days"] = config.Retention
}
return "", resultMap
}