module Network.AWS.CloudTrail.CreateTrail
(
CreateTrail
, createTrail
, ctCloudWatchLogsLogGroupArn
, ctCloudWatchLogsRoleArn
, ctIncludeGlobalServiceEvents
, ctName
, ctS3BucketName
, ctS3KeyPrefix
, ctSnsTopicName
, CreateTrailResponse
, createTrailResponse
, ctrCloudWatchLogsLogGroupArn
, ctrCloudWatchLogsRoleArn
, ctrIncludeGlobalServiceEvents
, ctrName
, ctrS3BucketName
, ctrS3KeyPrefix
, ctrSnsTopicName
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.CloudTrail.Types
import qualified GHC.Exts
data CreateTrail = CreateTrail
{ _ctCloudWatchLogsLogGroupArn :: Maybe Text
, _ctCloudWatchLogsRoleArn :: Maybe Text
, _ctIncludeGlobalServiceEvents :: Maybe Bool
, _ctName :: Text
, _ctS3BucketName :: Text
, _ctS3KeyPrefix :: Maybe Text
, _ctSnsTopicName :: Maybe Text
} deriving (Eq, Ord, Show)
createTrail :: Text
-> Text
-> CreateTrail
createTrail p1 p2 = CreateTrail
{ _ctName = p1
, _ctS3BucketName = p2
, _ctS3KeyPrefix = Nothing
, _ctSnsTopicName = Nothing
, _ctIncludeGlobalServiceEvents = Nothing
, _ctCloudWatchLogsLogGroupArn = Nothing
, _ctCloudWatchLogsRoleArn = Nothing
}
ctCloudWatchLogsLogGroupArn :: Lens' CreateTrail (Maybe Text)
ctCloudWatchLogsLogGroupArn =
lens _ctCloudWatchLogsLogGroupArn
(\s a -> s { _ctCloudWatchLogsLogGroupArn = a })
ctCloudWatchLogsRoleArn :: Lens' CreateTrail (Maybe Text)
ctCloudWatchLogsRoleArn =
lens _ctCloudWatchLogsRoleArn (\s a -> s { _ctCloudWatchLogsRoleArn = a })
ctIncludeGlobalServiceEvents :: Lens' CreateTrail (Maybe Bool)
ctIncludeGlobalServiceEvents =
lens _ctIncludeGlobalServiceEvents
(\s a -> s { _ctIncludeGlobalServiceEvents = 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 })
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 })
data CreateTrailResponse = CreateTrailResponse
{ _ctrCloudWatchLogsLogGroupArn :: Maybe Text
, _ctrCloudWatchLogsRoleArn :: Maybe Text
, _ctrIncludeGlobalServiceEvents :: Maybe Bool
, _ctrName :: Maybe Text
, _ctrS3BucketName :: Maybe Text
, _ctrS3KeyPrefix :: Maybe Text
, _ctrSnsTopicName :: Maybe Text
} deriving (Eq, Ord, Show)
createTrailResponse :: CreateTrailResponse
createTrailResponse = CreateTrailResponse
{ _ctrName = Nothing
, _ctrS3BucketName = Nothing
, _ctrS3KeyPrefix = Nothing
, _ctrSnsTopicName = Nothing
, _ctrIncludeGlobalServiceEvents = Nothing
, _ctrCloudWatchLogsLogGroupArn = Nothing
, _ctrCloudWatchLogsRoleArn = Nothing
}
ctrCloudWatchLogsLogGroupArn :: Lens' CreateTrailResponse (Maybe Text)
ctrCloudWatchLogsLogGroupArn =
lens _ctrCloudWatchLogsLogGroupArn
(\s a -> s { _ctrCloudWatchLogsLogGroupArn = a })
ctrCloudWatchLogsRoleArn :: Lens' CreateTrailResponse (Maybe Text)
ctrCloudWatchLogsRoleArn =
lens _ctrCloudWatchLogsRoleArn
(\s a -> s { _ctrCloudWatchLogsRoleArn = a })
ctrIncludeGlobalServiceEvents :: Lens' CreateTrailResponse (Maybe Bool)
ctrIncludeGlobalServiceEvents =
lens _ctrIncludeGlobalServiceEvents
(\s a -> s { _ctrIncludeGlobalServiceEvents = a })
ctrName :: Lens' CreateTrailResponse (Maybe Text)
ctrName = lens _ctrName (\s a -> s { _ctrName = a })
ctrS3BucketName :: Lens' CreateTrailResponse (Maybe Text)
ctrS3BucketName = lens _ctrS3BucketName (\s a -> s { _ctrS3BucketName = a })
ctrS3KeyPrefix :: Lens' CreateTrailResponse (Maybe Text)
ctrS3KeyPrefix = lens _ctrS3KeyPrefix (\s a -> s { _ctrS3KeyPrefix = a })
ctrSnsTopicName :: Lens' CreateTrailResponse (Maybe Text)
ctrSnsTopicName = lens _ctrSnsTopicName (\s a -> s { _ctrSnsTopicName = a })
instance ToPath CreateTrail where
toPath = const "/"
instance ToQuery CreateTrail where
toQuery = const mempty
instance ToHeaders CreateTrail
instance ToJSON CreateTrail where
toJSON CreateTrail{..} = object
[ "Name" .= _ctName
, "S3BucketName" .= _ctS3BucketName
, "S3KeyPrefix" .= _ctS3KeyPrefix
, "SnsTopicName" .= _ctSnsTopicName
, "IncludeGlobalServiceEvents" .= _ctIncludeGlobalServiceEvents
, "CloudWatchLogsLogGroupArn" .= _ctCloudWatchLogsLogGroupArn
, "CloudWatchLogsRoleArn" .= _ctCloudWatchLogsRoleArn
]
instance AWSRequest CreateTrail where
type Sv CreateTrail = CloudTrail
type Rs CreateTrail = CreateTrailResponse
request = post "CreateTrail"
response = jsonResponse
instance FromJSON CreateTrailResponse where
parseJSON = withObject "CreateTrailResponse" $ \o -> CreateTrailResponse
<$> o .:? "CloudWatchLogsLogGroupArn"
<*> o .:? "CloudWatchLogsRoleArn"
<*> o .:? "IncludeGlobalServiceEvents"
<*> o .:? "Name"
<*> o .:? "S3BucketName"
<*> o .:? "S3KeyPrefix"
<*> o .:? "SnsTopicName"