@@ -2,6 +2,7 @@ package resources
2
2
3
3
import (
4
4
"context"
5
+ "github.com/gotidy/ptr"
5
6
"strings"
6
7
"time"
7
8
@@ -87,14 +88,19 @@ func (l *CloudWatchLogsLogGroupLister) List(_ context.Context, o interface{}) ([
87
88
lastEvent = time .Unix (* logGroup .CreationTime / 1000 , 0 )
88
89
}
89
90
91
+ var retentionInDays int64
92
+ if logGroup .RetentionInDays != nil {
93
+ retentionInDays = ptr .ToInt64 (logGroup .RetentionInDays )
94
+ }
90
95
91
96
resources = append (resources , & CloudWatchLogsLogGroup {
92
- svc : svc ,
93
- logGroup : logGroup ,
94
- lastEvent : lastEvent .Format (time .RFC3339 ),
95
- tags : tagResp .Tags ,
97
+ svc : svc ,
98
+ logGroup : logGroup ,
99
+ lastEvent : lastEvent .Format (time .RFC3339 ),
100
+ retentionInDays : retentionInDays ,
101
+ tags : tagResp .Tags ,
96
102
})
97
- }
103
+ }
98
104
if output .NextToken == nil {
99
105
break
100
106
}
@@ -106,10 +112,11 @@ func (l *CloudWatchLogsLogGroupLister) List(_ context.Context, o interface{}) ([
106
112
}
107
113
108
114
type CloudWatchLogsLogGroup struct {
109
- svc * cloudwatchlogs.CloudWatchLogs
110
- logGroup * cloudwatchlogs.LogGroup
111
- lastEvent string
112
- tags map [string ]* string
115
+ svc * cloudwatchlogs.CloudWatchLogs
116
+ logGroup * cloudwatchlogs.LogGroup
117
+ lastEvent string
118
+ retentionInDays int64
119
+ tags map [string ]* string
113
120
}
114
121
115
122
func (f * CloudWatchLogsLogGroup ) Remove (_ context.Context ) error {
@@ -129,12 +136,10 @@ func (f *CloudWatchLogsLogGroup) Properties() types.Properties {
129
136
Set ("logGroupName" , f .logGroup .LogGroupName ).
130
137
Set ("CreatedTime" , f .logGroup .CreationTime ).
131
138
Set ("LastEvent" , f .lastEvent ).
132
- Set ("RetentionInDays" , f .logGroup .RetentionInDays )
133
-
139
+ Set ("RetentionInDays" , f .retentionInDays )
134
140
135
141
for k , v := range f .tags {
136
142
properties .SetTag (& k , v )
137
143
}
138
144
return properties
139
145
}
140
-
0 commit comments