{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.Trail
-- 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)
module Amazonka.CloudTrail.Types.Trail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The settings for a trail.
--
-- /See:/ 'newTrail' smart constructor.
data Trail = Trail'
  { -- | Specifies whether log file validation is enabled.
    Trail -> Maybe Bool
logFileValidationEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the ARN of the trail. The following is the format of a trail
    -- ARN.
    --
    -- @arn:aws:cloudtrail:us-east-2:123456789012:trail\/MyTrail@
    Trail -> 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>.
    -- The maximum length is 200 characters.
    Trail -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether a trail has insight types specified in an
    -- @InsightSelector@ list.
    Trail -> Maybe Bool
hasInsightSelectors :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send
    -- notifications when log files are delivered. The following is the format
    -- of a topic ARN.
    --
    -- @arn:aws:sns:us-east-2:123456789012:MyTopic@
    Trail -> Maybe Text
snsTopicARN :: Prelude.Maybe Prelude.Text,
    -- | This field is no longer in use. Use SnsTopicARN.
    Trail -> Maybe Text
snsTopicName :: Prelude.Maybe Prelude.Text,
    -- | Specifies an Amazon Resource Name (ARN), a unique identifier that
    -- represents the log group to which CloudTrail logs will be delivered.
    Trail -> 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@
    Trail -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The region in which the trail was created.
    Trail -> Maybe Text
homeRegion :: Prelude.Maybe Prelude.Text,
    -- | Name of the trail set by calling CreateTrail. The maximum length is 128
    -- characters.
    Trail -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Set to __True__ to include Amazon Web Services API calls from Amazon Web
    -- Services global services such as IAM. Otherwise, __False__.
    Trail -> Maybe Bool
includeGlobalServiceEvents :: Prelude.Maybe Prelude.Bool,
    -- | Specifies if the trail has custom event selectors.
    Trail -> Maybe Bool
hasCustomEventSelectors :: Prelude.Maybe Prelude.Bool,
    -- | Specifies whether the trail is an organization trail.
    Trail -> 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.
    Trail -> Maybe Text
cloudWatchLogsRoleArn :: Prelude.Maybe Prelude.Text,
    -- | Name of the Amazon S3 bucket into which CloudTrail delivers your trail
    -- files. See
    -- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/create_trail_naming_policy.html Amazon S3 Bucket Naming Requirements>.
    Trail -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the trail exists only in one region or exists in all
    -- regions.
    Trail -> Maybe Bool
isMultiRegionTrail :: Prelude.Maybe Prelude.Bool
  }
  deriving (Trail -> Trail -> Bool
(Trail -> Trail -> Bool) -> (Trail -> Trail -> Bool) -> Eq Trail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Trail -> Trail -> Bool
$c/= :: Trail -> Trail -> Bool
== :: Trail -> Trail -> Bool
$c== :: Trail -> Trail -> Bool
Prelude.Eq, ReadPrec [Trail]
ReadPrec Trail
Int -> ReadS Trail
ReadS [Trail]
(Int -> ReadS Trail)
-> ReadS [Trail]
-> ReadPrec Trail
-> ReadPrec [Trail]
-> Read Trail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Trail]
$creadListPrec :: ReadPrec [Trail]
readPrec :: ReadPrec Trail
$creadPrec :: ReadPrec Trail
readList :: ReadS [Trail]
$creadList :: ReadS [Trail]
readsPrec :: Int -> ReadS Trail
$creadsPrec :: Int -> ReadS Trail
Prelude.Read, Int -> Trail -> ShowS
[Trail] -> ShowS
Trail -> String
(Int -> Trail -> ShowS)
-> (Trail -> String) -> ([Trail] -> ShowS) -> Show Trail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Trail] -> ShowS
$cshowList :: [Trail] -> ShowS
show :: Trail -> String
$cshow :: Trail -> String
showsPrec :: Int -> Trail -> ShowS
$cshowsPrec :: Int -> Trail -> ShowS
Prelude.Show, (forall x. Trail -> Rep Trail x)
-> (forall x. Rep Trail x -> Trail) -> Generic Trail
forall x. Rep Trail x -> Trail
forall x. Trail -> Rep Trail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Trail x -> Trail
$cfrom :: forall x. Trail -> Rep Trail x
Prelude.Generic)

-- |
-- Create a value of 'Trail' 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', 'trail_logFileValidationEnabled' - Specifies whether log file validation is enabled.
--
-- 'trailARN', 'trail_trailARN' - Specifies the ARN of the trail. The following is the format of a trail
-- ARN.
--
-- @arn:aws:cloudtrail:us-east-2:123456789012:trail\/MyTrail@
--
-- 's3KeyPrefix', 'trail_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.
--
-- 'hasInsightSelectors', 'trail_hasInsightSelectors' - Specifies whether a trail has insight types specified in an
-- @InsightSelector@ list.
--
-- 'snsTopicARN', 'trail_snsTopicARN' - Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send
-- notifications when log files are delivered. The following is the format
-- of a topic ARN.
--
-- @arn:aws:sns:us-east-2:123456789012:MyTopic@
--
-- 'snsTopicName', 'trail_snsTopicName' - This field is no longer in use. Use SnsTopicARN.
--
-- 'cloudWatchLogsLogGroupArn', 'trail_cloudWatchLogsLogGroupArn' - Specifies an Amazon Resource Name (ARN), a unique identifier that
-- represents the log group to which CloudTrail logs will be delivered.
--
-- 'kmsKeyId', 'trail_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@
--
-- 'homeRegion', 'trail_homeRegion' - The region in which the trail was created.
--
-- 'name', 'trail_name' - Name of the trail set by calling CreateTrail. The maximum length is 128
-- characters.
--
-- 'includeGlobalServiceEvents', 'trail_includeGlobalServiceEvents' - Set to __True__ to include Amazon Web Services API calls from Amazon Web
-- Services global services such as IAM. Otherwise, __False__.
--
-- 'hasCustomEventSelectors', 'trail_hasCustomEventSelectors' - Specifies if the trail has custom event selectors.
--
-- 'isOrganizationTrail', 'trail_isOrganizationTrail' - Specifies whether the trail is an organization trail.
--
-- 'cloudWatchLogsRoleArn', 'trail_cloudWatchLogsRoleArn' - Specifies the role for the CloudWatch Logs endpoint to assume to write
-- to a user\'s log group.
--
-- 's3BucketName', 'trail_s3BucketName' - Name of the Amazon S3 bucket into which CloudTrail delivers your trail
-- files. See
-- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/create_trail_naming_policy.html Amazon S3 Bucket Naming Requirements>.
--
-- 'isMultiRegionTrail', 'trail_isMultiRegionTrail' - Specifies whether the trail exists only in one region or exists in all
-- regions.
newTrail ::
  Trail
newTrail :: Trail
newTrail =
  Trail' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Trail
Trail'
    { $sel:logFileValidationEnabled:Trail' :: Maybe Bool
logFileValidationEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:trailARN:Trail' :: Maybe Text
trailARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3KeyPrefix:Trail' :: Maybe Text
s3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hasInsightSelectors:Trail' :: Maybe Bool
hasInsightSelectors = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicARN:Trail' :: Maybe Text
snsTopicARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicName:Trail' :: Maybe Text
snsTopicName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsLogGroupArn:Trail' :: Maybe Text
cloudWatchLogsLogGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:Trail' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:homeRegion:Trail' :: Maybe Text
homeRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Trail' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:includeGlobalServiceEvents:Trail' :: Maybe Bool
includeGlobalServiceEvents = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:hasCustomEventSelectors:Trail' :: Maybe Bool
hasCustomEventSelectors = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:isOrganizationTrail:Trail' :: Maybe Bool
isOrganizationTrail = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsRoleArn:Trail' :: Maybe Text
cloudWatchLogsRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketName:Trail' :: Maybe Text
s3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isMultiRegionTrail:Trail' :: Maybe Bool
isMultiRegionTrail = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | 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.
trail_s3KeyPrefix :: Lens.Lens' Trail (Prelude.Maybe Prelude.Text)
trail_s3KeyPrefix :: (Maybe Text -> f (Maybe Text)) -> Trail -> f Trail
trail_s3KeyPrefix = (Trail -> Maybe Text)
-> (Trail -> Maybe Text -> Trail)
-> Lens Trail Trail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trail' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:Trail' :: Trail -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: Trail
s@Trail' {} Maybe Text
a -> Trail
s {$sel:s3KeyPrefix:Trail' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: Trail)

-- | Specifies whether a trail has insight types specified in an
-- @InsightSelector@ list.
trail_hasInsightSelectors :: Lens.Lens' Trail (Prelude.Maybe Prelude.Bool)
trail_hasInsightSelectors :: (Maybe Bool -> f (Maybe Bool)) -> Trail -> f Trail
trail_hasInsightSelectors = (Trail -> Maybe Bool)
-> (Trail -> Maybe Bool -> Trail)
-> Lens Trail Trail (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trail' {Maybe Bool
hasInsightSelectors :: Maybe Bool
$sel:hasInsightSelectors:Trail' :: Trail -> Maybe Bool
hasInsightSelectors} -> Maybe Bool
hasInsightSelectors) (\s :: Trail
s@Trail' {} Maybe Bool
a -> Trail
s {$sel:hasInsightSelectors:Trail' :: Maybe Bool
hasInsightSelectors = Maybe Bool
a} :: Trail)

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

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

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

-- | 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@
trail_kmsKeyId :: Lens.Lens' Trail (Prelude.Maybe Prelude.Text)
trail_kmsKeyId :: (Maybe Text -> f (Maybe Text)) -> Trail -> f Trail
trail_kmsKeyId = (Trail -> Maybe Text)
-> (Trail -> Maybe Text -> Trail)
-> Lens Trail Trail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trail' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:Trail' :: Trail -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: Trail
s@Trail' {} Maybe Text
a -> Trail
s {$sel:kmsKeyId:Trail' :: Maybe Text
kmsKeyId = Maybe Text
a} :: Trail)

-- | The region in which the trail was created.
trail_homeRegion :: Lens.Lens' Trail (Prelude.Maybe Prelude.Text)
trail_homeRegion :: (Maybe Text -> f (Maybe Text)) -> Trail -> f Trail
trail_homeRegion = (Trail -> Maybe Text)
-> (Trail -> Maybe Text -> Trail)
-> Lens Trail Trail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trail' {Maybe Text
homeRegion :: Maybe Text
$sel:homeRegion:Trail' :: Trail -> Maybe Text
homeRegion} -> Maybe Text
homeRegion) (\s :: Trail
s@Trail' {} Maybe Text
a -> Trail
s {$sel:homeRegion:Trail' :: Maybe Text
homeRegion = Maybe Text
a} :: Trail)

-- | Name of the trail set by calling CreateTrail. The maximum length is 128
-- characters.
trail_name :: Lens.Lens' Trail (Prelude.Maybe Prelude.Text)
trail_name :: (Maybe Text -> f (Maybe Text)) -> Trail -> f Trail
trail_name = (Trail -> Maybe Text)
-> (Trail -> Maybe Text -> Trail)
-> Lens Trail Trail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trail' {Maybe Text
name :: Maybe Text
$sel:name:Trail' :: Trail -> Maybe Text
name} -> Maybe Text
name) (\s :: Trail
s@Trail' {} Maybe Text
a -> Trail
s {$sel:name:Trail' :: Maybe Text
name = Maybe Text
a} :: Trail)

-- | Set to __True__ to include Amazon Web Services API calls from Amazon Web
-- Services global services such as IAM. Otherwise, __False__.
trail_includeGlobalServiceEvents :: Lens.Lens' Trail (Prelude.Maybe Prelude.Bool)
trail_includeGlobalServiceEvents :: (Maybe Bool -> f (Maybe Bool)) -> Trail -> f Trail
trail_includeGlobalServiceEvents = (Trail -> Maybe Bool)
-> (Trail -> Maybe Bool -> Trail)
-> Lens Trail Trail (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trail' {Maybe Bool
includeGlobalServiceEvents :: Maybe Bool
$sel:includeGlobalServiceEvents:Trail' :: Trail -> Maybe Bool
includeGlobalServiceEvents} -> Maybe Bool
includeGlobalServiceEvents) (\s :: Trail
s@Trail' {} Maybe Bool
a -> Trail
s {$sel:includeGlobalServiceEvents:Trail' :: Maybe Bool
includeGlobalServiceEvents = Maybe Bool
a} :: Trail)

-- | Specifies if the trail has custom event selectors.
trail_hasCustomEventSelectors :: Lens.Lens' Trail (Prelude.Maybe Prelude.Bool)
trail_hasCustomEventSelectors :: (Maybe Bool -> f (Maybe Bool)) -> Trail -> f Trail
trail_hasCustomEventSelectors = (Trail -> Maybe Bool)
-> (Trail -> Maybe Bool -> Trail)
-> Lens Trail Trail (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trail' {Maybe Bool
hasCustomEventSelectors :: Maybe Bool
$sel:hasCustomEventSelectors:Trail' :: Trail -> Maybe Bool
hasCustomEventSelectors} -> Maybe Bool
hasCustomEventSelectors) (\s :: Trail
s@Trail' {} Maybe Bool
a -> Trail
s {$sel:hasCustomEventSelectors:Trail' :: Maybe Bool
hasCustomEventSelectors = Maybe Bool
a} :: Trail)

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

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

-- | Name of the Amazon S3 bucket into which CloudTrail delivers your trail
-- files. See
-- <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/create_trail_naming_policy.html Amazon S3 Bucket Naming Requirements>.
trail_s3BucketName :: Lens.Lens' Trail (Prelude.Maybe Prelude.Text)
trail_s3BucketName :: (Maybe Text -> f (Maybe Text)) -> Trail -> f Trail
trail_s3BucketName = (Trail -> Maybe Text)
-> (Trail -> Maybe Text -> Trail)
-> Lens Trail Trail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trail' {Maybe Text
s3BucketName :: Maybe Text
$sel:s3BucketName:Trail' :: Trail -> Maybe Text
s3BucketName} -> Maybe Text
s3BucketName) (\s :: Trail
s@Trail' {} Maybe Text
a -> Trail
s {$sel:s3BucketName:Trail' :: Maybe Text
s3BucketName = Maybe Text
a} :: Trail)

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

instance Core.FromJSON Trail where
  parseJSON :: Value -> Parser Trail
parseJSON =
    String -> (Object -> Parser Trail) -> Value -> Parser Trail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Trail"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Trail
Trail'
            (Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Trail)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Trail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LogFileValidationEnabled")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Trail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TrailARN")
            Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Trail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3KeyPrefix")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Trail)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HasInsightSelectors")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Trail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SnsTopicARN")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Trail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SnsTopicName")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Trail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CloudWatchLogsLogGroupArn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Trail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KmsKeyId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Trail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HomeRegion")
            Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Trail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Trail)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Bool -> Maybe Text -> Maybe Text -> Maybe Bool -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IncludeGlobalServiceEvents")
            Parser
  (Maybe Bool
   -> Maybe Bool -> Maybe Text -> Maybe Text -> Maybe Bool -> Trail)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool -> Maybe Text -> Maybe Text -> Maybe Bool -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HasCustomEventSelectors")
            Parser
  (Maybe Bool -> Maybe Text -> Maybe Text -> Maybe Bool -> Trail)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Text -> Maybe Bool -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IsOrganizationTrail")
            Parser (Maybe Text -> Maybe Text -> Maybe Bool -> Trail)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Bool -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CloudWatchLogsRoleArn")
            Parser (Maybe Text -> Maybe Bool -> Trail)
-> Parser (Maybe Text) -> Parser (Maybe Bool -> Trail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3BucketName")
            Parser (Maybe Bool -> Trail) -> Parser (Maybe Bool) -> Parser Trail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IsMultiRegionTrail")
      )

instance Prelude.Hashable Trail

instance Prelude.NFData Trail