module Network.AWS.CloudTrail.Types.Product where
import Network.AWS.CloudTrail.Types.Sum
import Network.AWS.Prelude
data Event = Event'
{ _eUsername :: !(Maybe Text)
, _eResources :: !(Maybe [Resource])
, _eEventTime :: !(Maybe POSIX)
, _eCloudTrailEvent :: !(Maybe Text)
, _eEventName :: !(Maybe Text)
, _eEventId :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
event
:: Event
event =
Event'
{ _eUsername = Nothing
, _eResources = Nothing
, _eEventTime = Nothing
, _eCloudTrailEvent = Nothing
, _eEventName = Nothing
, _eEventId = Nothing
}
eUsername :: Lens' Event (Maybe Text)
eUsername = lens _eUsername (\ s a -> s{_eUsername = a});
eResources :: Lens' Event [Resource]
eResources = lens _eResources (\ s a -> s{_eResources = a}) . _Default . _Coerce;
eEventTime :: Lens' Event (Maybe UTCTime)
eEventTime = lens _eEventTime (\ s a -> s{_eEventTime = a}) . mapping _Time;
eCloudTrailEvent :: Lens' Event (Maybe Text)
eCloudTrailEvent = lens _eCloudTrailEvent (\ s a -> s{_eCloudTrailEvent = a});
eEventName :: Lens' Event (Maybe Text)
eEventName = lens _eEventName (\ s a -> s{_eEventName = a});
eEventId :: Lens' Event (Maybe Text)
eEventId = lens _eEventId (\ s a -> s{_eEventId = a});
instance FromJSON Event where
parseJSON
= withObject "Event"
(\ x ->
Event' <$>
(x .:? "Username") <*> (x .:? "Resources" .!= mempty)
<*> (x .:? "EventTime")
<*> (x .:? "CloudTrailEvent")
<*> (x .:? "EventName")
<*> (x .:? "EventId"))
data LookupAttribute = LookupAttribute'
{ _laAttributeKey :: !LookupAttributeKey
, _laAttributeValue :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
lookupAttribute
:: LookupAttributeKey
-> Text
-> LookupAttribute
lookupAttribute pAttributeKey_ pAttributeValue_ =
LookupAttribute'
{ _laAttributeKey = pAttributeKey_
, _laAttributeValue = pAttributeValue_
}
laAttributeKey :: Lens' LookupAttribute LookupAttributeKey
laAttributeKey = lens _laAttributeKey (\ s a -> s{_laAttributeKey = a});
laAttributeValue :: Lens' LookupAttribute Text
laAttributeValue = lens _laAttributeValue (\ s a -> s{_laAttributeValue = a});
instance ToJSON LookupAttribute where
toJSON LookupAttribute'{..}
= object
(catMaybes
[Just ("AttributeKey" .= _laAttributeKey),
Just ("AttributeValue" .= _laAttributeValue)])
data Resource = Resource'
{ _rResourceType :: !(Maybe Text)
, _rResourceName :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
resource
:: Resource
resource =
Resource'
{ _rResourceType = Nothing
, _rResourceName = Nothing
}
rResourceType :: Lens' Resource (Maybe Text)
rResourceType = lens _rResourceType (\ s a -> s{_rResourceType = a});
rResourceName :: Lens' Resource (Maybe Text)
rResourceName = lens _rResourceName (\ s a -> s{_rResourceName = a});
instance FromJSON Resource where
parseJSON
= withObject "Resource"
(\ x ->
Resource' <$>
(x .:? "ResourceType") <*> (x .:? "ResourceName"))
data Trail = Trail'
{ _tS3KeyPrefix :: !(Maybe Text)
, _tSNSTopicName :: !(Maybe Text)
, _tCloudWatchLogsLogGroupARN :: !(Maybe Text)
, _tName :: !(Maybe Text)
, _tIncludeGlobalServiceEvents :: !(Maybe Bool)
, _tCloudWatchLogsRoleARN :: !(Maybe Text)
, _tS3BucketName :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
trail
:: Trail
trail =
Trail'
{ _tS3KeyPrefix = Nothing
, _tSNSTopicName = Nothing
, _tCloudWatchLogsLogGroupARN = Nothing
, _tName = Nothing
, _tIncludeGlobalServiceEvents = Nothing
, _tCloudWatchLogsRoleARN = Nothing
, _tS3BucketName = Nothing
}
tS3KeyPrefix :: Lens' Trail (Maybe Text)
tS3KeyPrefix = lens _tS3KeyPrefix (\ s a -> s{_tS3KeyPrefix = a});
tSNSTopicName :: Lens' Trail (Maybe Text)
tSNSTopicName = lens _tSNSTopicName (\ s a -> s{_tSNSTopicName = a});
tCloudWatchLogsLogGroupARN :: Lens' Trail (Maybe Text)
tCloudWatchLogsLogGroupARN = lens _tCloudWatchLogsLogGroupARN (\ s a -> s{_tCloudWatchLogsLogGroupARN = a});
tName :: Lens' Trail (Maybe Text)
tName = lens _tName (\ s a -> s{_tName = a});
tIncludeGlobalServiceEvents :: Lens' Trail (Maybe Bool)
tIncludeGlobalServiceEvents = lens _tIncludeGlobalServiceEvents (\ s a -> s{_tIncludeGlobalServiceEvents = a});
tCloudWatchLogsRoleARN :: Lens' Trail (Maybe Text)
tCloudWatchLogsRoleARN = lens _tCloudWatchLogsRoleARN (\ s a -> s{_tCloudWatchLogsRoleARN = a});
tS3BucketName :: Lens' Trail (Maybe Text)
tS3BucketName = lens _tS3BucketName (\ s a -> s{_tS3BucketName = a});
instance FromJSON Trail where
parseJSON
= withObject "Trail"
(\ x ->
Trail' <$>
(x .:? "S3KeyPrefix") <*> (x .:? "SnsTopicName") <*>
(x .:? "CloudWatchLogsLogGroupArn")
<*> (x .:? "Name")
<*> (x .:? "IncludeGlobalServiceEvents")
<*> (x .:? "CloudWatchLogsRoleArn")
<*> (x .:? "S3BucketName"))