@@ -2,6 +2,7 @@ package utils
2
2
3
3
import (
4
4
"context"
5
+ "strconv"
5
6
"strings"
6
7
"unicode/utf8"
7
8
@@ -79,7 +80,7 @@ func LookupEvents(ctx context.Context, svc *cloudtrail.Client, input *cloudtrail
79
80
return events [:returnSize ], nil
80
81
}
81
82
82
- func composeLookupAttributesInput (eventId , eventName string , readOnly , noReadOnly bool , userName , resourceName , resourceType , eventSource , accessKeyId string ) []ctypes.LookupAttribute {
83
+ func composeLookupAttributesInput (eventId , eventName string , isReadOnlyFlagSet , readOnly bool , userName , resourceName , resourceType , eventSource , accessKeyId string ) []ctypes.LookupAttribute {
83
84
lookupAttributesInput := []ctypes.LookupAttribute {}
84
85
85
86
// LookupAttributeKeyEventId
@@ -101,23 +102,14 @@ func composeLookupAttributesInput(eventId, eventName string, readOnly, noReadOnl
101
102
}
102
103
103
104
// LookupAttributeKeyReadOnly
104
- var shouldPassReadonly bool
105
- var lookupAttributeKeyReadOnlyValue * string
106
- if readOnly != noReadOnly {
107
- shouldPassReadonly = true
108
- if readOnly {
109
- lookupAttributeKeyReadOnlyValue = aws .String ("true" )
110
- }
111
- if noReadOnly {
112
- lookupAttributeKeyReadOnlyValue = aws .String ("false" )
113
- }
114
- }
115
- if shouldPassReadonly {
116
- attrReadOnly := ctypes.LookupAttribute {
117
- AttributeKey : ctypes .LookupAttributeKeyReadOnly ,
118
- AttributeValue : lookupAttributeKeyReadOnlyValue ,
119
- }
120
- lookupAttributesInput = append (lookupAttributesInput , attrReadOnly )
105
+ if isReadOnlyFlagSet {
106
+ lookupAttributesInput = append (
107
+ lookupAttributesInput ,
108
+ ctypes.LookupAttribute {
109
+ AttributeKey : ctypes .LookupAttributeKeyReadOnly ,
110
+ AttributeValue : aws .String (strconv .FormatBool (readOnly )),
111
+ },
112
+ )
121
113
}
122
114
123
115
// LookupAttributeKeyUsername
0 commit comments