{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CloudTrail.CreateTrail
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a trail that specifies the settings for delivery of log data to
-- an Amazon S3 bucket.
module Amazonka.CloudTrail.CreateTrail
  ( -- * Creating a Request
    CreateTrail (..),
    newCreateTrail,

    -- * Request Lenses
    createTrail_s3KeyPrefix,
    createTrail_snsTopicName,
    createTrail_enableLogFileValidation,
    createTrail_cloudWatchLogsLogGroupArn,
    createTrail_kmsKeyId,
    createTrail_includeGlobalServiceEvents,
    createTrail_tagsList,
    createTrail_isOrganizationTrail,
    createTrail_cloudWatchLogsRoleArn,
    createTrail_isMultiRegionTrail,
    createTrail_name,
    createTrail_s3BucketName,

    -- * Destructuring the Response
    CreateTrailResponse (..),
    newCreateTrailResponse,

    -- * Response Lenses
    createTrailResponse_logFileValidationEnabled,
    createTrailResponse_trailARN,
    createTrailResponse_s3KeyPrefix,
    createTrailResponse_snsTopicARN,
    createTrailResponse_snsTopicName,
    createTrailResponse_cloudWatchLogsLogGroupArn,
    createTrailResponse_kmsKeyId,
    createTrailResponse_name,
    createTrailResponse_includeGlobalServiceEvents,
    createTrailResponse_isOrganizationTrail,
    createTrailResponse_cloudWatchLogsRoleArn,
    createTrailResponse_s3BucketName,
    createTrailResponse_isMultiRegionTrail,
    createTrailResponse_httpStatus,
  )
where

import Amazonka.CloudTrail.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Specifies the settings for each trail.
--
-- /See:/ 'newCreateTrail' smart constructor.
data CreateTrail = CreateTrail'
  { -- | Specifies the Amazon S3 key prefix that comes after the name of the
    -- bucket you have designated for log file delivery. For more information,
    -- see
    -- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-find-log-files.html Finding Your CloudTrail Log Files>.
    -- The maximum length is 200 characters.
    CreateTrail -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | Specifies the name of the Amazon SNS topic defined for notification of
    -- log file delivery. The maximum length is 256 characters.
    CreateTrail -> Maybe Text
snsTopicName :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether log file integrity validation is enabled. The default
    -- is false.
    --
    -- When you disable log file integrity validation, the chain of digest
    -- files is broken after one hour. CloudTrail does not create digest files
    -- for log files that were delivered during a period in which log file
    -- integrity validation was disabled. For example, if you enable log file
    -- integrity validation at noon on January 1, disable it at noon on January
    -- 2, and re-enable it at noon on January 10, digest files will not be
    -- created for the log files delivered from noon on January 2 to noon on
    -- January 10. The same applies whenever you stop CloudTrail logging or
    -- delete a trail.
    CreateTrail -> Maybe Bool
enableLogFileValidation :: Prelude.Maybe Prelude.Bool,
    -- | Specifies a log group name using an Amazon Resource Name (ARN), a unique
    -- identifier that represents the log group to which CloudTrail logs will
    -- be delivered. Not required unless you specify @CloudWatchLogsRoleArn@.
    CreateTrail -> Maybe Text
cloudWatchLogsLogGroupArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies the KMS key ID to use to encrypt the logs delivered by
    -- CloudTrail. The value can be an alias name prefixed by \"alias\/\", a
    -- fully specified ARN to an alias, a fully specified ARN to a key, or a
    -- globally unique identifier.
    --
    -- CloudTrail also supports KMS multi-Region keys. For more information
    -- about multi-Region keys, see
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html Using multi-Region keys>
    -- in the /Key Management Service Developer Guide/.
    --
    -- Examples:
    --
    -- -   alias\/MyAliasName
    --
    -- -   arn:aws:kms:us-east-2:123456789012:alias\/MyAliasName
    --
    -- -   arn:aws:kms:us-east-2:123456789012:key\/12345678-1234-1234-1234-123456789012
    --
    -- -   12345678-1234-1234-1234-123456789012
    CreateTrail -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the trail is publishing events from global services
    -- such as IAM to the log files.
    CreateTrail -> Maybe Bool
includeGlobalServiceEvents :: Prelude.Maybe Prelude.Bool,
    CreateTrail -> Maybe [Tag]
tagsList :: Prelude.Maybe [Tag],
    -- | Specifies whether the trail is created for all accounts in an
    -- organization in Organizations, or only for the current Amazon Web
    -- Services account. The default is false, and cannot be true unless the
    -- call is made on behalf of an Amazon Web Services account that is the
    -- management account for an organization in Organizations.
    CreateTrail -> Maybe Bool
isOrganizationTrail :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the role for the CloudWatch Logs endpoint to assume to write
    -- to a user\'s log group.
    CreateTrail -> Maybe Text
cloudWatchLogsRoleArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the trail is created in the current region or in all
    -- regions. The default is false, which creates a trail only in the region
    -- where you are signed in. As a best practice, consider creating trails
    -- that log events in all regions.
    CreateTrail -> Maybe Bool
isMultiRegionTrail :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the name of the trail. The name must meet the following
    -- requirements:
    --
    -- -   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.),
    --     underscores (_), or dashes (-)
    --
    -- -   Start with a letter or number, and end with a letter or number
    --
    -- -   Be between 3 and 128 characters
    --
    -- -   Have no adjacent periods, underscores or dashes. Names like
    --     @my-_namespace@ and @my--namespace@ are not valid.
    --
    -- -   Not be in IP address format (for example, 192.168.5.4)
    CreateTrail -> Text
name :: Prelude.Text,
    -- | Specifies the name of the Amazon S3 bucket designated for publishing log
    -- files. See
    -- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/create_trail_naming_policy.html Amazon S3 Bucket Naming Requirements>.
    CreateTrail -> Text
s3BucketName :: Prelude.Text
  }
  deriving (CreateTrail -> CreateTrail -> Bool
(CreateTrail -> CreateTrail -> Bool)
-> (CreateTrail -> CreateTrail -> Bool) -> Eq CreateTrail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTrail -> CreateTrail -> Bool
$c/= :: CreateTrail -> CreateTrail -> Bool
== :: CreateTrail -> CreateTrail -> Bool
$c== :: CreateTrail -> CreateTrail -> Bool
Prelude.Eq, ReadPrec [CreateTrail]
ReadPrec CreateTrail
Int -> ReadS CreateTrail
ReadS [CreateTrail]
(Int -> ReadS CreateTrail)
-> ReadS [CreateTrail]
-> ReadPrec CreateTrail
-> ReadPrec [CreateTrail]
-> Read CreateTrail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTrail]
$creadListPrec :: ReadPrec [CreateTrail]
readPrec :: ReadPrec CreateTrail
$creadPrec :: ReadPrec CreateTrail
readList :: ReadS [CreateTrail]
$creadList :: ReadS [CreateTrail]
readsPrec :: Int -> ReadS CreateTrail
$creadsPrec :: Int -> ReadS CreateTrail
Prelude.Read, Int -> CreateTrail -> ShowS
[CreateTrail] -> ShowS
CreateTrail -> String
(Int -> CreateTrail -> ShowS)
-> (CreateTrail -> String)
-> ([CreateTrail] -> ShowS)
-> Show CreateTrail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTrail] -> ShowS
$cshowList :: [CreateTrail] -> ShowS
show :: CreateTrail -> String
$cshow :: CreateTrail -> String
showsPrec :: Int -> CreateTrail -> ShowS
$cshowsPrec :: Int -> CreateTrail -> ShowS
Prelude.Show, (forall x. CreateTrail -> Rep CreateTrail x)
-> (forall x. Rep CreateTrail x -> CreateTrail)
-> Generic CreateTrail
forall x. Rep CreateTrail x -> CreateTrail
forall x. CreateTrail -> Rep CreateTrail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTrail x -> CreateTrail
$cfrom :: forall x. CreateTrail -> Rep CreateTrail x
Prelude.Generic)

-- |
-- Create a value of 'CreateTrail' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 's3KeyPrefix', 'createTrail_s3KeyPrefix' - Specifies the Amazon S3 key prefix that comes after the name of the
-- bucket you have designated for log file delivery. For more information,
-- see
-- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-find-log-files.html Finding Your CloudTrail Log Files>.
-- The maximum length is 200 characters.
--
-- 'snsTopicName', 'createTrail_snsTopicName' - Specifies the name of the Amazon SNS topic defined for notification of
-- log file delivery. The maximum length is 256 characters.
--
-- 'enableLogFileValidation', 'createTrail_enableLogFileValidation' - Specifies whether log file integrity validation is enabled. The default
-- is false.
--
-- When you disable log file integrity validation, the chain of digest
-- files is broken after one hour. CloudTrail does not create digest files
-- for log files that were delivered during a period in which log file
-- integrity validation was disabled. For example, if you enable log file
-- integrity validation at noon on January 1, disable it at noon on January
-- 2, and re-enable it at noon on January 10, digest files will not be
-- created for the log files delivered from noon on January 2 to noon on
-- January 10. The same applies whenever you stop CloudTrail logging or
-- delete a trail.
--
-- 'cloudWatchLogsLogGroupArn', 'createTrail_cloudWatchLogsLogGroupArn' - Specifies a log group name using an Amazon Resource Name (ARN), a unique
-- identifier that represents the log group to which CloudTrail logs will
-- be delivered. Not required unless you specify @CloudWatchLogsRoleArn@.
--
-- 'kmsKeyId', 'createTrail_kmsKeyId' - Specifies the KMS key ID to use to encrypt the logs delivered by
-- CloudTrail. The value can be an alias name prefixed by \"alias\/\", a
-- fully specified ARN to an alias, a fully specified ARN to a key, or a
-- globally unique identifier.
--
-- CloudTrail also supports KMS multi-Region keys. For more information
-- about multi-Region keys, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html Using multi-Region keys>
-- in the /Key Management Service Developer Guide/.
--
-- Examples:
--
-- -   alias\/MyAliasName
--
-- -   arn:aws:kms:us-east-2:123456789012:alias\/MyAliasName
--
-- -   arn:aws:kms:us-east-2:123456789012:key\/12345678-1234-1234-1234-123456789012
--
-- -   12345678-1234-1234-1234-123456789012
--
-- 'includeGlobalServiceEvents', 'createTrail_includeGlobalServiceEvents' - Specifies whether the trail is publishing events from global services
-- such as IAM to the log files.
--
-- 'tagsList', 'createTrail_tagsList' - Undocumented member.
--
-- 'isOrganizationTrail', 'createTrail_isOrganizationTrail' - Specifies whether the trail is created for all accounts in an
-- organization in Organizations, or only for the current Amazon Web
-- Services account. The default is false, and cannot be true unless the
-- call is made on behalf of an Amazon Web Services account that is the
-- management account for an organization in Organizations.
--
-- 'cloudWatchLogsRoleArn', 'createTrail_cloudWatchLogsRoleArn' - Specifies the role for the CloudWatch Logs endpoint to assume to write
-- to a user\'s log group.
--
-- 'isMultiRegionTrail', 'createTrail_isMultiRegionTrail' - Specifies whether the trail is created in the current region or in all
-- regions. The default is false, which creates a trail only in the region
-- where you are signed in. As a best practice, consider creating trails
-- that log events in all regions.
--
-- 'name', 'createTrail_name' - Specifies the name of the trail. The name must meet the following
-- requirements:
--
-- -   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.),
--     underscores (_), or dashes (-)
--
-- -   Start with a letter or number, and end with a letter or number
--
-- -   Be between 3 and 128 characters
--
-- -   Have no adjacent periods, underscores or dashes. Names like
--     @my-_namespace@ and @my--namespace@ are not valid.
--
-- -   Not be in IP address format (for example, 192.168.5.4)
--
-- 's3BucketName', 'createTrail_s3BucketName' - Specifies the name of the Amazon S3 bucket designated for publishing log
-- files. See
-- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/create_trail_naming_policy.html Amazon S3 Bucket Naming Requirements>.
newCreateTrail ::
  -- | 'name'
  Prelude.Text ->
  -- | 's3BucketName'
  Prelude.Text ->
  CreateTrail
newCreateTrail :: Text -> Text -> CreateTrail
newCreateTrail Text
pName_ Text
pS3BucketName_ =
  CreateTrail' :: Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe [Tag]
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Text
-> Text
-> CreateTrail
CreateTrail'
    { $sel:s3KeyPrefix:CreateTrail' :: Maybe Text
s3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicName:CreateTrail' :: Maybe Text
snsTopicName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enableLogFileValidation:CreateTrail' :: Maybe Bool
enableLogFileValidation = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsLogGroupArn:CreateTrail' :: Maybe Text
cloudWatchLogsLogGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:CreateTrail' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:includeGlobalServiceEvents:CreateTrail' :: Maybe Bool
includeGlobalServiceEvents = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:tagsList:CreateTrail' :: Maybe [Tag]
tagsList = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:isOrganizationTrail:CreateTrail' :: Maybe Bool
isOrganizationTrail = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsRoleArn:CreateTrail' :: Maybe Text
cloudWatchLogsRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isMultiRegionTrail:CreateTrail' :: Maybe Bool
isMultiRegionTrail = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateTrail' :: Text
name = Text
pName_,
      $sel:s3BucketName:CreateTrail' :: Text
s3BucketName = Text
pS3BucketName_
    }

-- | Specifies the Amazon S3 key prefix that comes after the name of the
-- bucket you have designated for log file delivery. For more information,
-- see
-- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-find-log-files.html Finding Your CloudTrail Log Files>.
-- The maximum length is 200 characters.
createTrail_s3KeyPrefix :: Lens.Lens' CreateTrail (Prelude.Maybe Prelude.Text)
createTrail_s3KeyPrefix :: (Maybe Text -> f (Maybe Text)) -> CreateTrail -> f CreateTrail
createTrail_s3KeyPrefix = (CreateTrail -> Maybe Text)
-> (CreateTrail -> Maybe Text -> CreateTrail)
-> Lens CreateTrail CreateTrail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:CreateTrail' :: CreateTrail -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: CreateTrail
s@CreateTrail' {} Maybe Text
a -> CreateTrail
s {$sel:s3KeyPrefix:CreateTrail' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: CreateTrail)

-- | Specifies the name of the Amazon SNS topic defined for notification of
-- log file delivery. The maximum length is 256 characters.
createTrail_snsTopicName :: Lens.Lens' CreateTrail (Prelude.Maybe Prelude.Text)
createTrail_snsTopicName :: (Maybe Text -> f (Maybe Text)) -> CreateTrail -> f CreateTrail
createTrail_snsTopicName = (CreateTrail -> Maybe Text)
-> (CreateTrail -> Maybe Text -> CreateTrail)
-> Lens CreateTrail CreateTrail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Maybe Text
snsTopicName :: Maybe Text
$sel:snsTopicName:CreateTrail' :: CreateTrail -> Maybe Text
snsTopicName} -> Maybe Text
snsTopicName) (\s :: CreateTrail
s@CreateTrail' {} Maybe Text
a -> CreateTrail
s {$sel:snsTopicName:CreateTrail' :: Maybe Text
snsTopicName = Maybe Text
a} :: CreateTrail)

-- | Specifies whether log file integrity validation is enabled. The default
-- is false.
--
-- When you disable log file integrity validation, the chain of digest
-- files is broken after one hour. CloudTrail does not create digest files
-- for log files that were delivered during a period in which log file
-- integrity validation was disabled. For example, if you enable log file
-- integrity validation at noon on January 1, disable it at noon on January
-- 2, and re-enable it at noon on January 10, digest files will not be
-- created for the log files delivered from noon on January 2 to noon on
-- January 10. The same applies whenever you stop CloudTrail logging or
-- delete a trail.
createTrail_enableLogFileValidation :: Lens.Lens' CreateTrail (Prelude.Maybe Prelude.Bool)
createTrail_enableLogFileValidation :: (Maybe Bool -> f (Maybe Bool)) -> CreateTrail -> f CreateTrail
createTrail_enableLogFileValidation = (CreateTrail -> Maybe Bool)
-> (CreateTrail -> Maybe Bool -> CreateTrail)
-> Lens CreateTrail CreateTrail (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Maybe Bool
enableLogFileValidation :: Maybe Bool
$sel:enableLogFileValidation:CreateTrail' :: CreateTrail -> Maybe Bool
enableLogFileValidation} -> Maybe Bool
enableLogFileValidation) (\s :: CreateTrail
s@CreateTrail' {} Maybe Bool
a -> CreateTrail
s {$sel:enableLogFileValidation:CreateTrail' :: Maybe Bool
enableLogFileValidation = Maybe Bool
a} :: CreateTrail)

-- | Specifies a log group name using an Amazon Resource Name (ARN), a unique
-- identifier that represents the log group to which CloudTrail logs will
-- be delivered. Not required unless you specify @CloudWatchLogsRoleArn@.
createTrail_cloudWatchLogsLogGroupArn :: Lens.Lens' CreateTrail (Prelude.Maybe Prelude.Text)
createTrail_cloudWatchLogsLogGroupArn :: (Maybe Text -> f (Maybe Text)) -> CreateTrail -> f CreateTrail
createTrail_cloudWatchLogsLogGroupArn = (CreateTrail -> Maybe Text)
-> (CreateTrail -> Maybe Text -> CreateTrail)
-> Lens CreateTrail CreateTrail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Maybe Text
cloudWatchLogsLogGroupArn :: Maybe Text
$sel:cloudWatchLogsLogGroupArn:CreateTrail' :: CreateTrail -> Maybe Text
cloudWatchLogsLogGroupArn} -> Maybe Text
cloudWatchLogsLogGroupArn) (\s :: CreateTrail
s@CreateTrail' {} Maybe Text
a -> CreateTrail
s {$sel:cloudWatchLogsLogGroupArn:CreateTrail' :: Maybe Text
cloudWatchLogsLogGroupArn = Maybe Text
a} :: CreateTrail)

-- | Specifies the KMS key ID to use to encrypt the logs delivered by
-- CloudTrail. The value can be an alias name prefixed by \"alias\/\", a
-- fully specified ARN to an alias, a fully specified ARN to a key, or a
-- globally unique identifier.
--
-- CloudTrail also supports KMS multi-Region keys. For more information
-- about multi-Region keys, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html Using multi-Region keys>
-- in the /Key Management Service Developer Guide/.
--
-- Examples:
--
-- -   alias\/MyAliasName
--
-- -   arn:aws:kms:us-east-2:123456789012:alias\/MyAliasName
--
-- -   arn:aws:kms:us-east-2:123456789012:key\/12345678-1234-1234-1234-123456789012
--
-- -   12345678-1234-1234-1234-123456789012
createTrail_kmsKeyId :: Lens.Lens' CreateTrail (Prelude.Maybe Prelude.Text)
createTrail_kmsKeyId :: (Maybe Text -> f (Maybe Text)) -> CreateTrail -> f CreateTrail
createTrail_kmsKeyId = (CreateTrail -> Maybe Text)
-> (CreateTrail -> Maybe Text -> CreateTrail)
-> Lens CreateTrail CreateTrail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateTrail' :: CreateTrail -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateTrail
s@CreateTrail' {} Maybe Text
a -> CreateTrail
s {$sel:kmsKeyId:CreateTrail' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateTrail)

-- | Specifies whether the trail is publishing events from global services
-- such as IAM to the log files.
createTrail_includeGlobalServiceEvents :: Lens.Lens' CreateTrail (Prelude.Maybe Prelude.Bool)
createTrail_includeGlobalServiceEvents :: (Maybe Bool -> f (Maybe Bool)) -> CreateTrail -> f CreateTrail
createTrail_includeGlobalServiceEvents = (CreateTrail -> Maybe Bool)
-> (CreateTrail -> Maybe Bool -> CreateTrail)
-> Lens CreateTrail CreateTrail (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Maybe Bool
includeGlobalServiceEvents :: Maybe Bool
$sel:includeGlobalServiceEvents:CreateTrail' :: CreateTrail -> Maybe Bool
includeGlobalServiceEvents} -> Maybe Bool
includeGlobalServiceEvents) (\s :: CreateTrail
s@CreateTrail' {} Maybe Bool
a -> CreateTrail
s {$sel:includeGlobalServiceEvents:CreateTrail' :: Maybe Bool
includeGlobalServiceEvents = Maybe Bool
a} :: CreateTrail)

-- | Undocumented member.
createTrail_tagsList :: Lens.Lens' CreateTrail (Prelude.Maybe [Tag])
createTrail_tagsList :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateTrail -> f CreateTrail
createTrail_tagsList = (CreateTrail -> Maybe [Tag])
-> (CreateTrail -> Maybe [Tag] -> CreateTrail)
-> Lens CreateTrail CreateTrail (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Maybe [Tag]
tagsList :: Maybe [Tag]
$sel:tagsList:CreateTrail' :: CreateTrail -> Maybe [Tag]
tagsList} -> Maybe [Tag]
tagsList) (\s :: CreateTrail
s@CreateTrail' {} Maybe [Tag]
a -> CreateTrail
s {$sel:tagsList:CreateTrail' :: Maybe [Tag]
tagsList = Maybe [Tag]
a} :: CreateTrail) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateTrail -> f CreateTrail)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateTrail
-> f CreateTrail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies whether the trail is created for all accounts in an
-- organization in Organizations, or only for the current Amazon Web
-- Services account. The default is false, and cannot be true unless the
-- call is made on behalf of an Amazon Web Services account that is the
-- management account for an organization in Organizations.
createTrail_isOrganizationTrail :: Lens.Lens' CreateTrail (Prelude.Maybe Prelude.Bool)
createTrail_isOrganizationTrail :: (Maybe Bool -> f (Maybe Bool)) -> CreateTrail -> f CreateTrail
createTrail_isOrganizationTrail = (CreateTrail -> Maybe Bool)
-> (CreateTrail -> Maybe Bool -> CreateTrail)
-> Lens CreateTrail CreateTrail (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Maybe Bool
isOrganizationTrail :: Maybe Bool
$sel:isOrganizationTrail:CreateTrail' :: CreateTrail -> Maybe Bool
isOrganizationTrail} -> Maybe Bool
isOrganizationTrail) (\s :: CreateTrail
s@CreateTrail' {} Maybe Bool
a -> CreateTrail
s {$sel:isOrganizationTrail:CreateTrail' :: Maybe Bool
isOrganizationTrail = Maybe Bool
a} :: CreateTrail)

-- | Specifies the role for the CloudWatch Logs endpoint to assume to write
-- to a user\'s log group.
createTrail_cloudWatchLogsRoleArn :: Lens.Lens' CreateTrail (Prelude.Maybe Prelude.Text)
createTrail_cloudWatchLogsRoleArn :: (Maybe Text -> f (Maybe Text)) -> CreateTrail -> f CreateTrail
createTrail_cloudWatchLogsRoleArn = (CreateTrail -> Maybe Text)
-> (CreateTrail -> Maybe Text -> CreateTrail)
-> Lens CreateTrail CreateTrail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Maybe Text
cloudWatchLogsRoleArn :: Maybe Text
$sel:cloudWatchLogsRoleArn:CreateTrail' :: CreateTrail -> Maybe Text
cloudWatchLogsRoleArn} -> Maybe Text
cloudWatchLogsRoleArn) (\s :: CreateTrail
s@CreateTrail' {} Maybe Text
a -> CreateTrail
s {$sel:cloudWatchLogsRoleArn:CreateTrail' :: Maybe Text
cloudWatchLogsRoleArn = Maybe Text
a} :: CreateTrail)

-- | Specifies whether the trail is created in the current region or in all
-- regions. The default is false, which creates a trail only in the region
-- where you are signed in. As a best practice, consider creating trails
-- that log events in all regions.
createTrail_isMultiRegionTrail :: Lens.Lens' CreateTrail (Prelude.Maybe Prelude.Bool)
createTrail_isMultiRegionTrail :: (Maybe Bool -> f (Maybe Bool)) -> CreateTrail -> f CreateTrail
createTrail_isMultiRegionTrail = (CreateTrail -> Maybe Bool)
-> (CreateTrail -> Maybe Bool -> CreateTrail)
-> Lens CreateTrail CreateTrail (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Maybe Bool
isMultiRegionTrail :: Maybe Bool
$sel:isMultiRegionTrail:CreateTrail' :: CreateTrail -> Maybe Bool
isMultiRegionTrail} -> Maybe Bool
isMultiRegionTrail) (\s :: CreateTrail
s@CreateTrail' {} Maybe Bool
a -> CreateTrail
s {$sel:isMultiRegionTrail:CreateTrail' :: Maybe Bool
isMultiRegionTrail = Maybe Bool
a} :: CreateTrail)

-- | Specifies the name of the trail. The name must meet the following
-- requirements:
--
-- -   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.),
--     underscores (_), or dashes (-)
--
-- -   Start with a letter or number, and end with a letter or number
--
-- -   Be between 3 and 128 characters
--
-- -   Have no adjacent periods, underscores or dashes. Names like
--     @my-_namespace@ and @my--namespace@ are not valid.
--
-- -   Not be in IP address format (for example, 192.168.5.4)
createTrail_name :: Lens.Lens' CreateTrail Prelude.Text
createTrail_name :: (Text -> f Text) -> CreateTrail -> f CreateTrail
createTrail_name = (CreateTrail -> Text)
-> (CreateTrail -> Text -> CreateTrail)
-> Lens CreateTrail CreateTrail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Text
name :: Text
$sel:name:CreateTrail' :: CreateTrail -> Text
name} -> Text
name) (\s :: CreateTrail
s@CreateTrail' {} Text
a -> CreateTrail
s {$sel:name:CreateTrail' :: Text
name = Text
a} :: CreateTrail)

-- | Specifies the name of the Amazon S3 bucket designated for publishing log
-- files. See
-- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/create_trail_naming_policy.html Amazon S3 Bucket Naming Requirements>.
createTrail_s3BucketName :: Lens.Lens' CreateTrail Prelude.Text
createTrail_s3BucketName :: (Text -> f Text) -> CreateTrail -> f CreateTrail
createTrail_s3BucketName = (CreateTrail -> Text)
-> (CreateTrail -> Text -> CreateTrail)
-> Lens CreateTrail CreateTrail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrail' {Text
s3BucketName :: Text
$sel:s3BucketName:CreateTrail' :: CreateTrail -> Text
s3BucketName} -> Text
s3BucketName) (\s :: CreateTrail
s@CreateTrail' {} Text
a -> CreateTrail
s {$sel:s3BucketName:CreateTrail' :: Text
s3BucketName = Text
a} :: CreateTrail)

instance Core.AWSRequest CreateTrail where
  type AWSResponse CreateTrail = CreateTrailResponse
  request :: CreateTrail -> Request CreateTrail
request = Service -> CreateTrail -> Request CreateTrail
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateTrail
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTrail)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateTrail))
-> Logger
-> Service
-> Proxy CreateTrail
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTrail)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Int
-> CreateTrailResponse
CreateTrailResponse'
            (Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Int
 -> CreateTrailResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> CreateTrailResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LogFileValidationEnabled")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Int
   -> CreateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TrailARN")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Int
   -> CreateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"S3KeyPrefix")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Int
   -> CreateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SnsTopicARN")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Int
   -> CreateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SnsTopicName")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Int
   -> CreateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CloudWatchLogsLogGroupArn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Int
   -> CreateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"KmsKeyId")
            Either
  String
  (Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Int
   -> CreateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Name")
            Either
  String
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Int
   -> CreateTrailResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"IncludeGlobalServiceEvents")
            Either
  String
  (Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Int
   -> CreateTrailResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Bool -> Int -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"IsOrganizationTrail")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Bool -> Int -> CreateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Bool -> Int -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CloudWatchLogsRoleArn")
            Either
  String (Maybe Text -> Maybe Bool -> Int -> CreateTrailResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> Int -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"S3BucketName")
            Either String (Maybe Bool -> Int -> CreateTrailResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> CreateTrailResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"IsMultiRegionTrail")
            Either String (Int -> CreateTrailResponse)
-> Either String Int -> Either String CreateTrailResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateTrail

instance Prelude.NFData CreateTrail

instance Core.ToHeaders CreateTrail where
  toHeaders :: CreateTrail -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateTrail -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.CreateTrail" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateTrail where
  toJSON :: CreateTrail -> Value
toJSON CreateTrail' {Maybe Bool
Maybe [Tag]
Maybe Text
Text
s3BucketName :: Text
name :: Text
isMultiRegionTrail :: Maybe Bool
cloudWatchLogsRoleArn :: Maybe Text
isOrganizationTrail :: Maybe Bool
tagsList :: Maybe [Tag]
includeGlobalServiceEvents :: Maybe Bool
kmsKeyId :: Maybe Text
cloudWatchLogsLogGroupArn :: Maybe Text
enableLogFileValidation :: Maybe Bool
snsTopicName :: Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3BucketName:CreateTrail' :: CreateTrail -> Text
$sel:name:CreateTrail' :: CreateTrail -> Text
$sel:isMultiRegionTrail:CreateTrail' :: CreateTrail -> Maybe Bool
$sel:cloudWatchLogsRoleArn:CreateTrail' :: CreateTrail -> Maybe Text
$sel:isOrganizationTrail:CreateTrail' :: CreateTrail -> Maybe Bool
$sel:tagsList:CreateTrail' :: CreateTrail -> Maybe [Tag]
$sel:includeGlobalServiceEvents:CreateTrail' :: CreateTrail -> Maybe Bool
$sel:kmsKeyId:CreateTrail' :: CreateTrail -> Maybe Text
$sel:cloudWatchLogsLogGroupArn:CreateTrail' :: CreateTrail -> Maybe Text
$sel:enableLogFileValidation:CreateTrail' :: CreateTrail -> Maybe Bool
$sel:snsTopicName:CreateTrail' :: CreateTrail -> Maybe Text
$sel:s3KeyPrefix:CreateTrail' :: CreateTrail -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"S3KeyPrefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3KeyPrefix,
            (Text
"SnsTopicName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
snsTopicName,
            (Text
"EnableLogFileValidation" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableLogFileValidation,
            (Text
"CloudWatchLogsLogGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cloudWatchLogsLogGroupArn,
            (Text
"KmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Text
"IncludeGlobalServiceEvents" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeGlobalServiceEvents,
            (Text
"TagsList" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tagsList,
            (Text
"IsOrganizationTrail" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isOrganizationTrail,
            (Text
"CloudWatchLogsRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cloudWatchLogsRoleArn,
            (Text
"IsMultiRegionTrail" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isMultiRegionTrail,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3BucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3BucketName)
          ]
      )

instance Core.ToPath CreateTrail where
  toPath :: CreateTrail -> ByteString
toPath = ByteString -> CreateTrail -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateTrail where
  toQuery :: CreateTrail -> QueryString
toQuery = QueryString -> CreateTrail -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | Returns the objects or data listed below if successful. Otherwise,
-- returns an error.
--
-- /See:/ 'newCreateTrailResponse' smart constructor.
data CreateTrailResponse = CreateTrailResponse'
  { -- | Specifies whether log file integrity validation is enabled.
    CreateTrailResponse -> Maybe Bool
logFileValidationEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the ARN of the trail that was created. The format of a trail
    -- ARN is:
    --
    -- @arn:aws:cloudtrail:us-east-2:123456789012:trail\/MyTrail@
    CreateTrailResponse -> Maybe Text
trailARN :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Amazon S3 key prefix that comes after the name of the
    -- bucket you have designated for log file delivery. For more information,
    -- see
    -- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-find-log-files.html Finding Your CloudTrail Log Files>.
    CreateTrailResponse -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send
    -- notifications when log files are delivered. The format of a topic ARN
    -- is:
    --
    -- @arn:aws:sns:us-east-2:123456789012:MyTopic@
    CreateTrailResponse -> Maybe Text
snsTopicARN :: Prelude.Maybe Prelude.Text,
    -- | This field is no longer in use. Use SnsTopicARN.
    CreateTrailResponse -> Maybe Text
snsTopicName :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Amazon Resource Name (ARN) of the log group to which
    -- CloudTrail logs will be delivered.
    CreateTrailResponse -> Maybe Text
cloudWatchLogsLogGroupArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies the KMS key ID that encrypts the logs delivered by CloudTrail.
    -- The value is a fully specified ARN to a KMS key in the following format.
    --
    -- @arn:aws:kms:us-east-2:123456789012:key\/12345678-1234-1234-1234-123456789012@
    CreateTrailResponse -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the name of the trail.
    CreateTrailResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the trail is publishing events from global services
    -- such as IAM to the log files.
    CreateTrailResponse -> Maybe Bool
includeGlobalServiceEvents :: Prelude.Maybe Prelude.Bool,
    -- | Specifies whether the trail is an organization trail.
    CreateTrailResponse -> Maybe Bool
isOrganizationTrail :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the role for the CloudWatch Logs endpoint to assume to write
    -- to a user\'s log group.
    CreateTrailResponse -> Maybe Text
cloudWatchLogsRoleArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies the name of the Amazon S3 bucket designated for publishing log
    -- files.
    CreateTrailResponse -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the trail exists in one region or in all regions.
    CreateTrailResponse -> Maybe Bool
isMultiRegionTrail :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    CreateTrailResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateTrailResponse -> CreateTrailResponse -> Bool
(CreateTrailResponse -> CreateTrailResponse -> Bool)
-> (CreateTrailResponse -> CreateTrailResponse -> Bool)
-> Eq CreateTrailResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTrailResponse -> CreateTrailResponse -> Bool
$c/= :: CreateTrailResponse -> CreateTrailResponse -> Bool
== :: CreateTrailResponse -> CreateTrailResponse -> Bool
$c== :: CreateTrailResponse -> CreateTrailResponse -> Bool
Prelude.Eq, ReadPrec [CreateTrailResponse]
ReadPrec CreateTrailResponse
Int -> ReadS CreateTrailResponse
ReadS [CreateTrailResponse]
(Int -> ReadS CreateTrailResponse)
-> ReadS [CreateTrailResponse]
-> ReadPrec CreateTrailResponse
-> ReadPrec [CreateTrailResponse]
-> Read CreateTrailResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTrailResponse]
$creadListPrec :: ReadPrec [CreateTrailResponse]
readPrec :: ReadPrec CreateTrailResponse
$creadPrec :: ReadPrec CreateTrailResponse
readList :: ReadS [CreateTrailResponse]
$creadList :: ReadS [CreateTrailResponse]
readsPrec :: Int -> ReadS CreateTrailResponse
$creadsPrec :: Int -> ReadS CreateTrailResponse
Prelude.Read, Int -> CreateTrailResponse -> ShowS
[CreateTrailResponse] -> ShowS
CreateTrailResponse -> String
(Int -> CreateTrailResponse -> ShowS)
-> (CreateTrailResponse -> String)
-> ([CreateTrailResponse] -> ShowS)
-> Show CreateTrailResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTrailResponse] -> ShowS
$cshowList :: [CreateTrailResponse] -> ShowS
show :: CreateTrailResponse -> String
$cshow :: CreateTrailResponse -> String
showsPrec :: Int -> CreateTrailResponse -> ShowS
$cshowsPrec :: Int -> CreateTrailResponse -> ShowS
Prelude.Show, (forall x. CreateTrailResponse -> Rep CreateTrailResponse x)
-> (forall x. Rep CreateTrailResponse x -> CreateTrailResponse)
-> Generic CreateTrailResponse
forall x. Rep CreateTrailResponse x -> CreateTrailResponse
forall x. CreateTrailResponse -> Rep CreateTrailResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTrailResponse x -> CreateTrailResponse
$cfrom :: forall x. CreateTrailResponse -> Rep CreateTrailResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateTrailResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'logFileValidationEnabled', 'createTrailResponse_logFileValidationEnabled' - Specifies whether log file integrity validation is enabled.
--
-- 'trailARN', 'createTrailResponse_trailARN' - Specifies the ARN of the trail that was created. The format of a trail
-- ARN is:
--
-- @arn:aws:cloudtrail:us-east-2:123456789012:trail\/MyTrail@
--
-- 's3KeyPrefix', 'createTrailResponse_s3KeyPrefix' - Specifies the Amazon S3 key prefix that comes after the name of the
-- bucket you have designated for log file delivery. For more information,
-- see
-- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-find-log-files.html Finding Your CloudTrail Log Files>.
--
-- 'snsTopicARN', 'createTrailResponse_snsTopicARN' - Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send
-- notifications when log files are delivered. The format of a topic ARN
-- is:
--
-- @arn:aws:sns:us-east-2:123456789012:MyTopic@
--
-- 'snsTopicName', 'createTrailResponse_snsTopicName' - This field is no longer in use. Use SnsTopicARN.
--
-- 'cloudWatchLogsLogGroupArn', 'createTrailResponse_cloudWatchLogsLogGroupArn' - Specifies the Amazon Resource Name (ARN) of the log group to which
-- CloudTrail logs will be delivered.
--
-- 'kmsKeyId', 'createTrailResponse_kmsKeyId' - Specifies the KMS key ID that encrypts the logs delivered by CloudTrail.
-- The value is a fully specified ARN to a KMS key in the following format.
--
-- @arn:aws:kms:us-east-2:123456789012:key\/12345678-1234-1234-1234-123456789012@
--
-- 'name', 'createTrailResponse_name' - Specifies the name of the trail.
--
-- 'includeGlobalServiceEvents', 'createTrailResponse_includeGlobalServiceEvents' - Specifies whether the trail is publishing events from global services
-- such as IAM to the log files.
--
-- 'isOrganizationTrail', 'createTrailResponse_isOrganizationTrail' - Specifies whether the trail is an organization trail.
--
-- 'cloudWatchLogsRoleArn', 'createTrailResponse_cloudWatchLogsRoleArn' - Specifies the role for the CloudWatch Logs endpoint to assume to write
-- to a user\'s log group.
--
-- 's3BucketName', 'createTrailResponse_s3BucketName' - Specifies the name of the Amazon S3 bucket designated for publishing log
-- files.
--
-- 'isMultiRegionTrail', 'createTrailResponse_isMultiRegionTrail' - Specifies whether the trail exists in one region or in all regions.
--
-- 'httpStatus', 'createTrailResponse_httpStatus' - The response's http status code.
newCreateTrailResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateTrailResponse
newCreateTrailResponse :: Int -> CreateTrailResponse
newCreateTrailResponse Int
pHttpStatus_ =
  CreateTrailResponse' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Int
-> CreateTrailResponse
CreateTrailResponse'
    { $sel:logFileValidationEnabled:CreateTrailResponse' :: Maybe Bool
logFileValidationEnabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:trailARN:CreateTrailResponse' :: Maybe Text
trailARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3KeyPrefix:CreateTrailResponse' :: Maybe Text
s3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicARN:CreateTrailResponse' :: Maybe Text
snsTopicARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicName:CreateTrailResponse' :: Maybe Text
snsTopicName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsLogGroupArn:CreateTrailResponse' :: Maybe Text
cloudWatchLogsLogGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:CreateTrailResponse' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateTrailResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:includeGlobalServiceEvents:CreateTrailResponse' :: Maybe Bool
includeGlobalServiceEvents = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:isOrganizationTrail:CreateTrailResponse' :: Maybe Bool
isOrganizationTrail = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsRoleArn:CreateTrailResponse' :: Maybe Text
cloudWatchLogsRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketName:CreateTrailResponse' :: Maybe Text
s3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isMultiRegionTrail:CreateTrailResponse' :: Maybe Bool
isMultiRegionTrail = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateTrailResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Specifies whether log file integrity validation is enabled.
createTrailResponse_logFileValidationEnabled :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Bool)
createTrailResponse_logFileValidationEnabled :: (Maybe Bool -> f (Maybe Bool))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_logFileValidationEnabled = (CreateTrailResponse -> Maybe Bool)
-> (CreateTrailResponse -> Maybe Bool -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Bool
logFileValidationEnabled :: Maybe Bool
$sel:logFileValidationEnabled:CreateTrailResponse' :: CreateTrailResponse -> Maybe Bool
logFileValidationEnabled} -> Maybe Bool
logFileValidationEnabled) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Bool
a -> CreateTrailResponse
s {$sel:logFileValidationEnabled:CreateTrailResponse' :: Maybe Bool
logFileValidationEnabled = Maybe Bool
a} :: CreateTrailResponse)

-- | Specifies the ARN of the trail that was created. The format of a trail
-- ARN is:
--
-- @arn:aws:cloudtrail:us-east-2:123456789012:trail\/MyTrail@
createTrailResponse_trailARN :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Text)
createTrailResponse_trailARN :: (Maybe Text -> f (Maybe Text))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_trailARN = (CreateTrailResponse -> Maybe Text)
-> (CreateTrailResponse -> Maybe Text -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Text
trailARN :: Maybe Text
$sel:trailARN:CreateTrailResponse' :: CreateTrailResponse -> Maybe Text
trailARN} -> Maybe Text
trailARN) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Text
a -> CreateTrailResponse
s {$sel:trailARN:CreateTrailResponse' :: Maybe Text
trailARN = Maybe Text
a} :: CreateTrailResponse)

-- | Specifies the Amazon S3 key prefix that comes after the name of the
-- bucket you have designated for log file delivery. For more information,
-- see
-- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-find-log-files.html Finding Your CloudTrail Log Files>.
createTrailResponse_s3KeyPrefix :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Text)
createTrailResponse_s3KeyPrefix :: (Maybe Text -> f (Maybe Text))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_s3KeyPrefix = (CreateTrailResponse -> Maybe Text)
-> (CreateTrailResponse -> Maybe Text -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:CreateTrailResponse' :: CreateTrailResponse -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Text
a -> CreateTrailResponse
s {$sel:s3KeyPrefix:CreateTrailResponse' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: CreateTrailResponse)

-- | Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send
-- notifications when log files are delivered. The format of a topic ARN
-- is:
--
-- @arn:aws:sns:us-east-2:123456789012:MyTopic@
createTrailResponse_snsTopicARN :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Text)
createTrailResponse_snsTopicARN :: (Maybe Text -> f (Maybe Text))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_snsTopicARN = (CreateTrailResponse -> Maybe Text)
-> (CreateTrailResponse -> Maybe Text -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Text
snsTopicARN :: Maybe Text
$sel:snsTopicARN:CreateTrailResponse' :: CreateTrailResponse -> Maybe Text
snsTopicARN} -> Maybe Text
snsTopicARN) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Text
a -> CreateTrailResponse
s {$sel:snsTopicARN:CreateTrailResponse' :: Maybe Text
snsTopicARN = Maybe Text
a} :: CreateTrailResponse)

-- | This field is no longer in use. Use SnsTopicARN.
createTrailResponse_snsTopicName :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Text)
createTrailResponse_snsTopicName :: (Maybe Text -> f (Maybe Text))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_snsTopicName = (CreateTrailResponse -> Maybe Text)
-> (CreateTrailResponse -> Maybe Text -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Text
snsTopicName :: Maybe Text
$sel:snsTopicName:CreateTrailResponse' :: CreateTrailResponse -> Maybe Text
snsTopicName} -> Maybe Text
snsTopicName) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Text
a -> CreateTrailResponse
s {$sel:snsTopicName:CreateTrailResponse' :: Maybe Text
snsTopicName = Maybe Text
a} :: CreateTrailResponse)

-- | Specifies the Amazon Resource Name (ARN) of the log group to which
-- CloudTrail logs will be delivered.
createTrailResponse_cloudWatchLogsLogGroupArn :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Text)
createTrailResponse_cloudWatchLogsLogGroupArn :: (Maybe Text -> f (Maybe Text))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_cloudWatchLogsLogGroupArn = (CreateTrailResponse -> Maybe Text)
-> (CreateTrailResponse -> Maybe Text -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Text
cloudWatchLogsLogGroupArn :: Maybe Text
$sel:cloudWatchLogsLogGroupArn:CreateTrailResponse' :: CreateTrailResponse -> Maybe Text
cloudWatchLogsLogGroupArn} -> Maybe Text
cloudWatchLogsLogGroupArn) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Text
a -> CreateTrailResponse
s {$sel:cloudWatchLogsLogGroupArn:CreateTrailResponse' :: Maybe Text
cloudWatchLogsLogGroupArn = Maybe Text
a} :: CreateTrailResponse)

-- | Specifies the KMS key ID that encrypts the logs delivered by CloudTrail.
-- The value is a fully specified ARN to a KMS key in the following format.
--
-- @arn:aws:kms:us-east-2:123456789012:key\/12345678-1234-1234-1234-123456789012@
createTrailResponse_kmsKeyId :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Text)
createTrailResponse_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_kmsKeyId = (CreateTrailResponse -> Maybe Text)
-> (CreateTrailResponse -> Maybe Text -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateTrailResponse' :: CreateTrailResponse -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Text
a -> CreateTrailResponse
s {$sel:kmsKeyId:CreateTrailResponse' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateTrailResponse)

-- | Specifies the name of the trail.
createTrailResponse_name :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Text)
createTrailResponse_name :: (Maybe Text -> f (Maybe Text))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_name = (CreateTrailResponse -> Maybe Text)
-> (CreateTrailResponse -> Maybe Text -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Text
name :: Maybe Text
$sel:name:CreateTrailResponse' :: CreateTrailResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Text
a -> CreateTrailResponse
s {$sel:name:CreateTrailResponse' :: Maybe Text
name = Maybe Text
a} :: CreateTrailResponse)

-- | Specifies whether the trail is publishing events from global services
-- such as IAM to the log files.
createTrailResponse_includeGlobalServiceEvents :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Bool)
createTrailResponse_includeGlobalServiceEvents :: (Maybe Bool -> f (Maybe Bool))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_includeGlobalServiceEvents = (CreateTrailResponse -> Maybe Bool)
-> (CreateTrailResponse -> Maybe Bool -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Bool
includeGlobalServiceEvents :: Maybe Bool
$sel:includeGlobalServiceEvents:CreateTrailResponse' :: CreateTrailResponse -> Maybe Bool
includeGlobalServiceEvents} -> Maybe Bool
includeGlobalServiceEvents) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Bool
a -> CreateTrailResponse
s {$sel:includeGlobalServiceEvents:CreateTrailResponse' :: Maybe Bool
includeGlobalServiceEvents = Maybe Bool
a} :: CreateTrailResponse)

-- | Specifies whether the trail is an organization trail.
createTrailResponse_isOrganizationTrail :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Bool)
createTrailResponse_isOrganizationTrail :: (Maybe Bool -> f (Maybe Bool))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_isOrganizationTrail = (CreateTrailResponse -> Maybe Bool)
-> (CreateTrailResponse -> Maybe Bool -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Bool
isOrganizationTrail :: Maybe Bool
$sel:isOrganizationTrail:CreateTrailResponse' :: CreateTrailResponse -> Maybe Bool
isOrganizationTrail} -> Maybe Bool
isOrganizationTrail) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Bool
a -> CreateTrailResponse
s {$sel:isOrganizationTrail:CreateTrailResponse' :: Maybe Bool
isOrganizationTrail = Maybe Bool
a} :: CreateTrailResponse)

-- | Specifies the role for the CloudWatch Logs endpoint to assume to write
-- to a user\'s log group.
createTrailResponse_cloudWatchLogsRoleArn :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Text)
createTrailResponse_cloudWatchLogsRoleArn :: (Maybe Text -> f (Maybe Text))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_cloudWatchLogsRoleArn = (CreateTrailResponse -> Maybe Text)
-> (CreateTrailResponse -> Maybe Text -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Text
cloudWatchLogsRoleArn :: Maybe Text
$sel:cloudWatchLogsRoleArn:CreateTrailResponse' :: CreateTrailResponse -> Maybe Text
cloudWatchLogsRoleArn} -> Maybe Text
cloudWatchLogsRoleArn) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Text
a -> CreateTrailResponse
s {$sel:cloudWatchLogsRoleArn:CreateTrailResponse' :: Maybe Text
cloudWatchLogsRoleArn = Maybe Text
a} :: CreateTrailResponse)

-- | Specifies the name of the Amazon S3 bucket designated for publishing log
-- files.
createTrailResponse_s3BucketName :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Text)
createTrailResponse_s3BucketName :: (Maybe Text -> f (Maybe Text))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_s3BucketName = (CreateTrailResponse -> Maybe Text)
-> (CreateTrailResponse -> Maybe Text -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Text
s3BucketName :: Maybe Text
$sel:s3BucketName:CreateTrailResponse' :: CreateTrailResponse -> Maybe Text
s3BucketName} -> Maybe Text
s3BucketName) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Text
a -> CreateTrailResponse
s {$sel:s3BucketName:CreateTrailResponse' :: Maybe Text
s3BucketName = Maybe Text
a} :: CreateTrailResponse)

-- | Specifies whether the trail exists in one region or in all regions.
createTrailResponse_isMultiRegionTrail :: Lens.Lens' CreateTrailResponse (Prelude.Maybe Prelude.Bool)
createTrailResponse_isMultiRegionTrail :: (Maybe Bool -> f (Maybe Bool))
-> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_isMultiRegionTrail = (CreateTrailResponse -> Maybe Bool)
-> (CreateTrailResponse -> Maybe Bool -> CreateTrailResponse)
-> Lens
     CreateTrailResponse CreateTrailResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Maybe Bool
isMultiRegionTrail :: Maybe Bool
$sel:isMultiRegionTrail:CreateTrailResponse' :: CreateTrailResponse -> Maybe Bool
isMultiRegionTrail} -> Maybe Bool
isMultiRegionTrail) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Maybe Bool
a -> CreateTrailResponse
s {$sel:isMultiRegionTrail:CreateTrailResponse' :: Maybe Bool
isMultiRegionTrail = Maybe Bool
a} :: CreateTrailResponse)

-- | The response's http status code.
createTrailResponse_httpStatus :: Lens.Lens' CreateTrailResponse Prelude.Int
createTrailResponse_httpStatus :: (Int -> f Int) -> CreateTrailResponse -> f CreateTrailResponse
createTrailResponse_httpStatus = (CreateTrailResponse -> Int)
-> (CreateTrailResponse -> Int -> CreateTrailResponse)
-> Lens CreateTrailResponse CreateTrailResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrailResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateTrailResponse' :: CreateTrailResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateTrailResponse
s@CreateTrailResponse' {} Int
a -> CreateTrailResponse
s {$sel:httpStatus:CreateTrailResponse' :: Int
httpStatus = Int
a} :: CreateTrailResponse)

instance Prelude.NFData CreateTrailResponse