module Network.AWS.CloudTrail.CreateTrail
(
createTrail
, CreateTrail
, ctS3KeyPrefix
, ctSNSTopicName
, ctEnableLogFileValidation
, ctCloudWatchLogsLogGroupARN
, ctKMSKeyId
, ctIncludeGlobalServiceEvents
, ctCloudWatchLogsRoleARN
, ctIsMultiRegionTrail
, ctName
, ctS3BucketName
, createTrailResponse
, CreateTrailResponse
, ctrsLogFileValidationEnabled
, ctrsTrailARN
, ctrsS3KeyPrefix
, ctrsSNSTopicName
, ctrsCloudWatchLogsLogGroupARN
, ctrsKMSKeyId
, ctrsName
, ctrsIncludeGlobalServiceEvents
, ctrsCloudWatchLogsRoleARN
, ctrsS3BucketName
, ctrsIsMultiRegionTrail
, ctrsResponseStatus
) where
import Network.AWS.CloudTrail.Types
import Network.AWS.CloudTrail.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateTrail = CreateTrail'
{ _ctS3KeyPrefix :: !(Maybe Text)
, _ctSNSTopicName :: !(Maybe Text)
, _ctEnableLogFileValidation :: !(Maybe Bool)
, _ctCloudWatchLogsLogGroupARN :: !(Maybe Text)
, _ctKMSKeyId :: !(Maybe Text)
, _ctIncludeGlobalServiceEvents :: !(Maybe Bool)
, _ctCloudWatchLogsRoleARN :: !(Maybe Text)
, _ctIsMultiRegionTrail :: !(Maybe Bool)
, _ctName :: !Text
, _ctS3BucketName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createTrail
:: Text
-> Text
-> CreateTrail
createTrail pName_ pS3BucketName_ =
CreateTrail'
{ _ctS3KeyPrefix = Nothing
, _ctSNSTopicName = Nothing
, _ctEnableLogFileValidation = Nothing
, _ctCloudWatchLogsLogGroupARN = Nothing
, _ctKMSKeyId = Nothing
, _ctIncludeGlobalServiceEvents = Nothing
, _ctCloudWatchLogsRoleARN = Nothing
, _ctIsMultiRegionTrail = Nothing
, _ctName = pName_
, _ctS3BucketName = pS3BucketName_
}
ctS3KeyPrefix :: Lens' CreateTrail (Maybe Text)
ctS3KeyPrefix = lens _ctS3KeyPrefix (\ s a -> s{_ctS3KeyPrefix = a});
ctSNSTopicName :: Lens' CreateTrail (Maybe Text)
ctSNSTopicName = lens _ctSNSTopicName (\ s a -> s{_ctSNSTopicName = a});
ctEnableLogFileValidation :: Lens' CreateTrail (Maybe Bool)
ctEnableLogFileValidation = lens _ctEnableLogFileValidation (\ s a -> s{_ctEnableLogFileValidation = a});
ctCloudWatchLogsLogGroupARN :: Lens' CreateTrail (Maybe Text)
ctCloudWatchLogsLogGroupARN = lens _ctCloudWatchLogsLogGroupARN (\ s a -> s{_ctCloudWatchLogsLogGroupARN = a});
ctKMSKeyId :: Lens' CreateTrail (Maybe Text)
ctKMSKeyId = lens _ctKMSKeyId (\ s a -> s{_ctKMSKeyId = a});
ctIncludeGlobalServiceEvents :: Lens' CreateTrail (Maybe Bool)
ctIncludeGlobalServiceEvents = lens _ctIncludeGlobalServiceEvents (\ s a -> s{_ctIncludeGlobalServiceEvents = a});
ctCloudWatchLogsRoleARN :: Lens' CreateTrail (Maybe Text)
ctCloudWatchLogsRoleARN = lens _ctCloudWatchLogsRoleARN (\ s a -> s{_ctCloudWatchLogsRoleARN = a});
ctIsMultiRegionTrail :: Lens' CreateTrail (Maybe Bool)
ctIsMultiRegionTrail = lens _ctIsMultiRegionTrail (\ s a -> s{_ctIsMultiRegionTrail = a});
ctName :: Lens' CreateTrail Text
ctName = lens _ctName (\ s a -> s{_ctName = a});
ctS3BucketName :: Lens' CreateTrail Text
ctS3BucketName = lens _ctS3BucketName (\ s a -> s{_ctS3BucketName = a});
instance AWSRequest CreateTrail where
type Rs CreateTrail = CreateTrailResponse
request = postJSON cloudTrail
response
= receiveJSON
(\ s h x ->
CreateTrailResponse' <$>
(x .?> "LogFileValidationEnabled") <*>
(x .?> "TrailARN")
<*> (x .?> "S3KeyPrefix")
<*> (x .?> "SnsTopicName")
<*> (x .?> "CloudWatchLogsLogGroupArn")
<*> (x .?> "KmsKeyId")
<*> (x .?> "Name")
<*> (x .?> "IncludeGlobalServiceEvents")
<*> (x .?> "CloudWatchLogsRoleArn")
<*> (x .?> "S3BucketName")
<*> (x .?> "IsMultiRegionTrail")
<*> (pure (fromEnum s)))
instance Hashable CreateTrail
instance NFData CreateTrail
instance ToHeaders CreateTrail where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.CreateTrail"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateTrail where
toJSON CreateTrail'{..}
= object
(catMaybes
[("S3KeyPrefix" .=) <$> _ctS3KeyPrefix,
("SnsTopicName" .=) <$> _ctSNSTopicName,
("EnableLogFileValidation" .=) <$>
_ctEnableLogFileValidation,
("CloudWatchLogsLogGroupArn" .=) <$>
_ctCloudWatchLogsLogGroupARN,
("KmsKeyId" .=) <$> _ctKMSKeyId,
("IncludeGlobalServiceEvents" .=) <$>
_ctIncludeGlobalServiceEvents,
("CloudWatchLogsRoleArn" .=) <$>
_ctCloudWatchLogsRoleARN,
("IsMultiRegionTrail" .=) <$> _ctIsMultiRegionTrail,
Just ("Name" .= _ctName),
Just ("S3BucketName" .= _ctS3BucketName)])
instance ToPath CreateTrail where
toPath = const "/"
instance ToQuery CreateTrail where
toQuery = const mempty
data CreateTrailResponse = CreateTrailResponse'
{ _ctrsLogFileValidationEnabled :: !(Maybe Bool)
, _ctrsTrailARN :: !(Maybe Text)
, _ctrsS3KeyPrefix :: !(Maybe Text)
, _ctrsSNSTopicName :: !(Maybe Text)
, _ctrsCloudWatchLogsLogGroupARN :: !(Maybe Text)
, _ctrsKMSKeyId :: !(Maybe Text)
, _ctrsName :: !(Maybe Text)
, _ctrsIncludeGlobalServiceEvents :: !(Maybe Bool)
, _ctrsCloudWatchLogsRoleARN :: !(Maybe Text)
, _ctrsS3BucketName :: !(Maybe Text)
, _ctrsIsMultiRegionTrail :: !(Maybe Bool)
, _ctrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createTrailResponse
:: Int
-> CreateTrailResponse
createTrailResponse pResponseStatus_ =
CreateTrailResponse'
{ _ctrsLogFileValidationEnabled = Nothing
, _ctrsTrailARN = Nothing
, _ctrsS3KeyPrefix = Nothing
, _ctrsSNSTopicName = Nothing
, _ctrsCloudWatchLogsLogGroupARN = Nothing
, _ctrsKMSKeyId = Nothing
, _ctrsName = Nothing
, _ctrsIncludeGlobalServiceEvents = Nothing
, _ctrsCloudWatchLogsRoleARN = Nothing
, _ctrsS3BucketName = Nothing
, _ctrsIsMultiRegionTrail = Nothing
, _ctrsResponseStatus = pResponseStatus_
}
ctrsLogFileValidationEnabled :: Lens' CreateTrailResponse (Maybe Bool)
ctrsLogFileValidationEnabled = lens _ctrsLogFileValidationEnabled (\ s a -> s{_ctrsLogFileValidationEnabled = a});
ctrsTrailARN :: Lens' CreateTrailResponse (Maybe Text)
ctrsTrailARN = lens _ctrsTrailARN (\ s a -> s{_ctrsTrailARN = a});
ctrsS3KeyPrefix :: Lens' CreateTrailResponse (Maybe Text)
ctrsS3KeyPrefix = lens _ctrsS3KeyPrefix (\ s a -> s{_ctrsS3KeyPrefix = a});
ctrsSNSTopicName :: Lens' CreateTrailResponse (Maybe Text)
ctrsSNSTopicName = lens _ctrsSNSTopicName (\ s a -> s{_ctrsSNSTopicName = a});
ctrsCloudWatchLogsLogGroupARN :: Lens' CreateTrailResponse (Maybe Text)
ctrsCloudWatchLogsLogGroupARN = lens _ctrsCloudWatchLogsLogGroupARN (\ s a -> s{_ctrsCloudWatchLogsLogGroupARN = a});
ctrsKMSKeyId :: Lens' CreateTrailResponse (Maybe Text)
ctrsKMSKeyId = lens _ctrsKMSKeyId (\ s a -> s{_ctrsKMSKeyId = a});
ctrsName :: Lens' CreateTrailResponse (Maybe Text)
ctrsName = lens _ctrsName (\ s a -> s{_ctrsName = a});
ctrsIncludeGlobalServiceEvents :: Lens' CreateTrailResponse (Maybe Bool)
ctrsIncludeGlobalServiceEvents = lens _ctrsIncludeGlobalServiceEvents (\ s a -> s{_ctrsIncludeGlobalServiceEvents = a});
ctrsCloudWatchLogsRoleARN :: Lens' CreateTrailResponse (Maybe Text)
ctrsCloudWatchLogsRoleARN = lens _ctrsCloudWatchLogsRoleARN (\ s a -> s{_ctrsCloudWatchLogsRoleARN = a});
ctrsS3BucketName :: Lens' CreateTrailResponse (Maybe Text)
ctrsS3BucketName = lens _ctrsS3BucketName (\ s a -> s{_ctrsS3BucketName = a});
ctrsIsMultiRegionTrail :: Lens' CreateTrailResponse (Maybe Bool)
ctrsIsMultiRegionTrail = lens _ctrsIsMultiRegionTrail (\ s a -> s{_ctrsIsMultiRegionTrail = a});
ctrsResponseStatus :: Lens' CreateTrailResponse Int
ctrsResponseStatus = lens _ctrsResponseStatus (\ s a -> s{_ctrsResponseStatus = a});
instance NFData CreateTrailResponse