module Network.AWS.CloudTrail.CreateTrail
(
createTrail
, CreateTrail
, ctS3KeyPrefix
, ctSNSTopicName
, ctCloudWatchLogsLogGroupARN
, ctIncludeGlobalServiceEvents
, ctCloudWatchLogsRoleARN
, ctName
, ctS3BucketName
, createTrailResponse
, CreateTrailResponse
, ctrsS3KeyPrefix
, ctrsSNSTopicName
, ctrsCloudWatchLogsLogGroupARN
, ctrsName
, ctrsIncludeGlobalServiceEvents
, ctrsCloudWatchLogsRoleARN
, ctrsS3BucketName
, ctrsStatus
) where
import Network.AWS.CloudTrail.Types
import Network.AWS.CloudTrail.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateTrail = CreateTrail'
{ _ctS3KeyPrefix :: !(Maybe Text)
, _ctSNSTopicName :: !(Maybe Text)
, _ctCloudWatchLogsLogGroupARN :: !(Maybe Text)
, _ctIncludeGlobalServiceEvents :: !(Maybe Bool)
, _ctCloudWatchLogsRoleARN :: !(Maybe Text)
, _ctName :: !Text
, _ctS3BucketName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createTrail
:: Text
-> Text
-> CreateTrail
createTrail pName_ pS3BucketName_ =
CreateTrail'
{ _ctS3KeyPrefix = Nothing
, _ctSNSTopicName = Nothing
, _ctCloudWatchLogsLogGroupARN = Nothing
, _ctIncludeGlobalServiceEvents = Nothing
, _ctCloudWatchLogsRoleARN = 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});
ctCloudWatchLogsLogGroupARN :: Lens' CreateTrail (Maybe Text)
ctCloudWatchLogsLogGroupARN = lens _ctCloudWatchLogsLogGroupARN (\ s a -> s{_ctCloudWatchLogsLogGroupARN = 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});
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 Sv CreateTrail = CloudTrail
type Rs CreateTrail = CreateTrailResponse
request = postJSON
response
= receiveJSON
(\ s h x ->
CreateTrailResponse' <$>
(x .?> "S3KeyPrefix") <*> (x .?> "SnsTopicName") <*>
(x .?> "CloudWatchLogsLogGroupArn")
<*> (x .?> "Name")
<*> (x .?> "IncludeGlobalServiceEvents")
<*> (x .?> "CloudWatchLogsRoleArn")
<*> (x .?> "S3BucketName")
<*> (pure (fromEnum s)))
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
["S3KeyPrefix" .= _ctS3KeyPrefix,
"SnsTopicName" .= _ctSNSTopicName,
"CloudWatchLogsLogGroupArn" .=
_ctCloudWatchLogsLogGroupARN,
"IncludeGlobalServiceEvents" .=
_ctIncludeGlobalServiceEvents,
"CloudWatchLogsRoleArn" .= _ctCloudWatchLogsRoleARN,
"Name" .= _ctName, "S3BucketName" .= _ctS3BucketName]
instance ToPath CreateTrail where
toPath = const "/"
instance ToQuery CreateTrail where
toQuery = const mempty
data CreateTrailResponse = CreateTrailResponse'
{ _ctrsS3KeyPrefix :: !(Maybe Text)
, _ctrsSNSTopicName :: !(Maybe Text)
, _ctrsCloudWatchLogsLogGroupARN :: !(Maybe Text)
, _ctrsName :: !(Maybe Text)
, _ctrsIncludeGlobalServiceEvents :: !(Maybe Bool)
, _ctrsCloudWatchLogsRoleARN :: !(Maybe Text)
, _ctrsS3BucketName :: !(Maybe Text)
, _ctrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createTrailResponse
:: Int
-> CreateTrailResponse
createTrailResponse pStatus_ =
CreateTrailResponse'
{ _ctrsS3KeyPrefix = Nothing
, _ctrsSNSTopicName = Nothing
, _ctrsCloudWatchLogsLogGroupARN = Nothing
, _ctrsName = Nothing
, _ctrsIncludeGlobalServiceEvents = Nothing
, _ctrsCloudWatchLogsRoleARN = Nothing
, _ctrsS3BucketName = Nothing
, _ctrsStatus = pStatus_
}
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});
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});
ctrsStatus :: Lens' CreateTrailResponse Int
ctrsStatus = lens _ctrsStatus (\ s a -> s{_ctrsStatus = a});