{-# 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.UpdateTrail
-- 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)
--
-- Updates trail settings that control what events you are logging, and how
-- to handle log files. Changes to a trail do not require stopping the
-- CloudTrail service. Use this action to designate an existing bucket for
-- log delivery. If the existing bucket has previously been a target for
-- CloudTrail log files, an IAM policy exists for the bucket. @UpdateTrail@
-- must be called from the region in which the trail was created;
-- otherwise, an @InvalidHomeRegionException@ is thrown.
module Amazonka.CloudTrail.UpdateTrail
  ( -- * Creating a Request
    UpdateTrail (..),
    newUpdateTrail,

    -- * Request Lenses
    updateTrail_s3KeyPrefix,
    updateTrail_snsTopicName,
    updateTrail_enableLogFileValidation,
    updateTrail_cloudWatchLogsLogGroupArn,
    updateTrail_kmsKeyId,
    updateTrail_includeGlobalServiceEvents,
    updateTrail_isOrganizationTrail,
    updateTrail_cloudWatchLogsRoleArn,
    updateTrail_s3BucketName,
    updateTrail_isMultiRegionTrail,
    updateTrail_name,

    -- * Destructuring the Response
    UpdateTrailResponse (..),
    newUpdateTrailResponse,

    -- * Response Lenses
    updateTrailResponse_logFileValidationEnabled,
    updateTrailResponse_trailARN,
    updateTrailResponse_s3KeyPrefix,
    updateTrailResponse_snsTopicARN,
    updateTrailResponse_snsTopicName,
    updateTrailResponse_cloudWatchLogsLogGroupArn,
    updateTrailResponse_kmsKeyId,
    updateTrailResponse_name,
    updateTrailResponse_includeGlobalServiceEvents,
    updateTrailResponse_isOrganizationTrail,
    updateTrailResponse_cloudWatchLogsRoleArn,
    updateTrailResponse_s3BucketName,
    updateTrailResponse_isMultiRegionTrail,
    updateTrailResponse_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 settings to update for the trail.
--
-- /See:/ 'newUpdateTrail' smart constructor.
data UpdateTrail = UpdateTrail'
  { -- | 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.
    UpdateTrail -> 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.
    UpdateTrail -> Maybe Text
snsTopicName :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether log file 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.
    UpdateTrail -> 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 are
    -- delivered. Not required unless you specify @CloudWatchLogsRoleArn@.
    UpdateTrail -> 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
    UpdateTrail -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the trail is publishing events from global services
    -- such as IAM to the log files.
    UpdateTrail -> Maybe Bool
includeGlobalServiceEvents :: Prelude.Maybe Prelude.Bool,
    -- | Specifies whether the trail is applied to 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. If the trail is
    -- not an organization trail and this is set to @true@, the trail will be
    -- created in all Amazon Web Services accounts that belong to the
    -- organization. If the trail is an organization trail and this is set to
    -- @false@, the trail will remain in the current Amazon Web Services
    -- account but be deleted from all member accounts in the organization.
    UpdateTrail -> 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.
    UpdateTrail -> Maybe Text
cloudWatchLogsRoleArn :: Prelude.Maybe 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>.
    UpdateTrail -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the trail applies only to the current region or to all
    -- regions. The default is false. If the trail exists only in the current
    -- region and this value is set to true, shadow trails (replications of the
    -- trail) will be created in the other regions. If the trail exists in all
    -- regions and this value is set to false, the trail will remain in the
    -- region where it was created, and its shadow trails in other regions will
    -- be deleted. As a best practice, consider using trails that log events in
    -- all regions.
    UpdateTrail -> Maybe Bool
isMultiRegionTrail :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the name of the trail or trail ARN. If @Name@ is a trail name,
    -- the string 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)
    --
    -- If @Name@ is a trail ARN, it must be in the following format.
    --
    -- @arn:aws:cloudtrail:us-east-2:123456789012:trail\/MyTrail@
    UpdateTrail -> Text
name :: Prelude.Text
  }
  deriving (UpdateTrail -> UpdateTrail -> Bool
(UpdateTrail -> UpdateTrail -> Bool)
-> (UpdateTrail -> UpdateTrail -> Bool) -> Eq UpdateTrail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTrail -> UpdateTrail -> Bool
$c/= :: UpdateTrail -> UpdateTrail -> Bool
== :: UpdateTrail -> UpdateTrail -> Bool
$c== :: UpdateTrail -> UpdateTrail -> Bool
Prelude.Eq, ReadPrec [UpdateTrail]
ReadPrec UpdateTrail
Int -> ReadS UpdateTrail
ReadS [UpdateTrail]
(Int -> ReadS UpdateTrail)
-> ReadS [UpdateTrail]
-> ReadPrec UpdateTrail
-> ReadPrec [UpdateTrail]
-> Read UpdateTrail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTrail]
$creadListPrec :: ReadPrec [UpdateTrail]
readPrec :: ReadPrec UpdateTrail
$creadPrec :: ReadPrec UpdateTrail
readList :: ReadS [UpdateTrail]
$creadList :: ReadS [UpdateTrail]
readsPrec :: Int -> ReadS UpdateTrail
$creadsPrec :: Int -> ReadS UpdateTrail
Prelude.Read, Int -> UpdateTrail -> ShowS
[UpdateTrail] -> ShowS
UpdateTrail -> String
(Int -> UpdateTrail -> ShowS)
-> (UpdateTrail -> String)
-> ([UpdateTrail] -> ShowS)
-> Show UpdateTrail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTrail] -> ShowS
$cshowList :: [UpdateTrail] -> ShowS
show :: UpdateTrail -> String
$cshow :: UpdateTrail -> String
showsPrec :: Int -> UpdateTrail -> ShowS
$cshowsPrec :: Int -> UpdateTrail -> ShowS
Prelude.Show, (forall x. UpdateTrail -> Rep UpdateTrail x)
-> (forall x. Rep UpdateTrail x -> UpdateTrail)
-> Generic UpdateTrail
forall x. Rep UpdateTrail x -> UpdateTrail
forall x. UpdateTrail -> Rep UpdateTrail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTrail x -> UpdateTrail
$cfrom :: forall x. UpdateTrail -> Rep UpdateTrail x
Prelude.Generic)

-- |
-- Create a value of 'UpdateTrail' 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', 'updateTrail_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', 'updateTrail_snsTopicName' - Specifies the name of the Amazon SNS topic defined for notification of
-- log file delivery. The maximum length is 256 characters.
--
-- 'enableLogFileValidation', 'updateTrail_enableLogFileValidation' - Specifies whether log file 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', 'updateTrail_cloudWatchLogsLogGroupArn' - Specifies a log group name using an Amazon Resource Name (ARN), a unique
-- identifier that represents the log group to which CloudTrail logs are
-- delivered. Not required unless you specify @CloudWatchLogsRoleArn@.
--
-- 'kmsKeyId', 'updateTrail_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', 'updateTrail_includeGlobalServiceEvents' - Specifies whether the trail is publishing events from global services
-- such as IAM to the log files.
--
-- 'isOrganizationTrail', 'updateTrail_isOrganizationTrail' - Specifies whether the trail is applied to 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. If the trail is
-- not an organization trail and this is set to @true@, the trail will be
-- created in all Amazon Web Services accounts that belong to the
-- organization. If the trail is an organization trail and this is set to
-- @false@, the trail will remain in the current Amazon Web Services
-- account but be deleted from all member accounts in the organization.
--
-- 'cloudWatchLogsRoleArn', 'updateTrail_cloudWatchLogsRoleArn' - Specifies the role for the CloudWatch Logs endpoint to assume to write
-- to a user\'s log group.
--
-- 's3BucketName', 'updateTrail_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>.
--
-- 'isMultiRegionTrail', 'updateTrail_isMultiRegionTrail' - Specifies whether the trail applies only to the current region or to all
-- regions. The default is false. If the trail exists only in the current
-- region and this value is set to true, shadow trails (replications of the
-- trail) will be created in the other regions. If the trail exists in all
-- regions and this value is set to false, the trail will remain in the
-- region where it was created, and its shadow trails in other regions will
-- be deleted. As a best practice, consider using trails that log events in
-- all regions.
--
-- 'name', 'updateTrail_name' - Specifies the name of the trail or trail ARN. If @Name@ is a trail name,
-- the string 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)
--
-- If @Name@ is a trail ARN, it must be in the following format.
--
-- @arn:aws:cloudtrail:us-east-2:123456789012:trail\/MyTrail@
newUpdateTrail ::
  -- | 'name'
  Prelude.Text ->
  UpdateTrail
newUpdateTrail :: Text -> UpdateTrail
newUpdateTrail Text
pName_ =
  UpdateTrail' :: Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Text
-> UpdateTrail
UpdateTrail'
    { $sel:s3KeyPrefix:UpdateTrail' :: Maybe Text
s3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicName:UpdateTrail' :: Maybe Text
snsTopicName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enableLogFileValidation:UpdateTrail' :: Maybe Bool
enableLogFileValidation = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsLogGroupArn:UpdateTrail' :: Maybe Text
cloudWatchLogsLogGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:UpdateTrail' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:includeGlobalServiceEvents:UpdateTrail' :: Maybe Bool
includeGlobalServiceEvents = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:isOrganizationTrail:UpdateTrail' :: Maybe Bool
isOrganizationTrail = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsRoleArn:UpdateTrail' :: Maybe Text
cloudWatchLogsRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketName:UpdateTrail' :: Maybe Text
s3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isMultiRegionTrail:UpdateTrail' :: Maybe Bool
isMultiRegionTrail = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateTrail' :: Text
name = Text
pName_
    }

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

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

-- | Specifies whether log file 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.
updateTrail_enableLogFileValidation :: Lens.Lens' UpdateTrail (Prelude.Maybe Prelude.Bool)
updateTrail_enableLogFileValidation :: (Maybe Bool -> f (Maybe Bool)) -> UpdateTrail -> f UpdateTrail
updateTrail_enableLogFileValidation = (UpdateTrail -> Maybe Bool)
-> (UpdateTrail -> Maybe Bool -> UpdateTrail)
-> Lens UpdateTrail UpdateTrail (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrail' {Maybe Bool
enableLogFileValidation :: Maybe Bool
$sel:enableLogFileValidation:UpdateTrail' :: UpdateTrail -> Maybe Bool
enableLogFileValidation} -> Maybe Bool
enableLogFileValidation) (\s :: UpdateTrail
s@UpdateTrail' {} Maybe Bool
a -> UpdateTrail
s {$sel:enableLogFileValidation:UpdateTrail' :: Maybe Bool
enableLogFileValidation = Maybe Bool
a} :: UpdateTrail)

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

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

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

-- | Specifies whether the trail is applied to 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. If the trail is
-- not an organization trail and this is set to @true@, the trail will be
-- created in all Amazon Web Services accounts that belong to the
-- organization. If the trail is an organization trail and this is set to
-- @false@, the trail will remain in the current Amazon Web Services
-- account but be deleted from all member accounts in the organization.
updateTrail_isOrganizationTrail :: Lens.Lens' UpdateTrail (Prelude.Maybe Prelude.Bool)
updateTrail_isOrganizationTrail :: (Maybe Bool -> f (Maybe Bool)) -> UpdateTrail -> f UpdateTrail
updateTrail_isOrganizationTrail = (UpdateTrail -> Maybe Bool)
-> (UpdateTrail -> Maybe Bool -> UpdateTrail)
-> Lens UpdateTrail UpdateTrail (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrail' {Maybe Bool
isOrganizationTrail :: Maybe Bool
$sel:isOrganizationTrail:UpdateTrail' :: UpdateTrail -> Maybe Bool
isOrganizationTrail} -> Maybe Bool
isOrganizationTrail) (\s :: UpdateTrail
s@UpdateTrail' {} Maybe Bool
a -> UpdateTrail
s {$sel:isOrganizationTrail:UpdateTrail' :: Maybe Bool
isOrganizationTrail = Maybe Bool
a} :: UpdateTrail)

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

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

-- | Specifies whether the trail applies only to the current region or to all
-- regions. The default is false. If the trail exists only in the current
-- region and this value is set to true, shadow trails (replications of the
-- trail) will be created in the other regions. If the trail exists in all
-- regions and this value is set to false, the trail will remain in the
-- region where it was created, and its shadow trails in other regions will
-- be deleted. As a best practice, consider using trails that log events in
-- all regions.
updateTrail_isMultiRegionTrail :: Lens.Lens' UpdateTrail (Prelude.Maybe Prelude.Bool)
updateTrail_isMultiRegionTrail :: (Maybe Bool -> f (Maybe Bool)) -> UpdateTrail -> f UpdateTrail
updateTrail_isMultiRegionTrail = (UpdateTrail -> Maybe Bool)
-> (UpdateTrail -> Maybe Bool -> UpdateTrail)
-> Lens UpdateTrail UpdateTrail (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrail' {Maybe Bool
isMultiRegionTrail :: Maybe Bool
$sel:isMultiRegionTrail:UpdateTrail' :: UpdateTrail -> Maybe Bool
isMultiRegionTrail} -> Maybe Bool
isMultiRegionTrail) (\s :: UpdateTrail
s@UpdateTrail' {} Maybe Bool
a -> UpdateTrail
s {$sel:isMultiRegionTrail:UpdateTrail' :: Maybe Bool
isMultiRegionTrail = Maybe Bool
a} :: UpdateTrail)

-- | Specifies the name of the trail or trail ARN. If @Name@ is a trail name,
-- the string 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)
--
-- If @Name@ is a trail ARN, it must be in the following format.
--
-- @arn:aws:cloudtrail:us-east-2:123456789012:trail\/MyTrail@
updateTrail_name :: Lens.Lens' UpdateTrail Prelude.Text
updateTrail_name :: (Text -> f Text) -> UpdateTrail -> f UpdateTrail
updateTrail_name = (UpdateTrail -> Text)
-> (UpdateTrail -> Text -> UpdateTrail)
-> Lens UpdateTrail UpdateTrail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrail' {Text
name :: Text
$sel:name:UpdateTrail' :: UpdateTrail -> Text
name} -> Text
name) (\s :: UpdateTrail
s@UpdateTrail' {} Text
a -> UpdateTrail
s {$sel:name:UpdateTrail' :: Text
name = Text
a} :: UpdateTrail)

instance Core.AWSRequest UpdateTrail where
  type AWSResponse UpdateTrail = UpdateTrailResponse
  request :: UpdateTrail -> Request UpdateTrail
request = Service -> UpdateTrail -> Request UpdateTrail
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateTrail
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTrail)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateTrail))
-> Logger
-> Service
-> Proxy UpdateTrail
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTrail)))
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
-> UpdateTrailResponse
UpdateTrailResponse'
            (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
 -> UpdateTrailResponse)
-> 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
      -> UpdateTrailResponse)
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
   -> UpdateTrailResponse)
-> 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
      -> UpdateTrailResponse)
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
   -> UpdateTrailResponse)
-> 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
      -> UpdateTrailResponse)
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
   -> UpdateTrailResponse)
-> 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
      -> UpdateTrailResponse)
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
   -> UpdateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> UpdateTrailResponse)
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
   -> UpdateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> UpdateTrailResponse)
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
   -> UpdateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> UpdateTrailResponse)
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
   -> UpdateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> UpdateTrailResponse)
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
   -> UpdateTrailResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Int
      -> UpdateTrailResponse)
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
   -> UpdateTrailResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Bool -> Int -> UpdateTrailResponse)
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 -> UpdateTrailResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Bool -> Int -> UpdateTrailResponse)
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 -> UpdateTrailResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> Int -> UpdateTrailResponse)
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 -> UpdateTrailResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> UpdateTrailResponse)
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 -> UpdateTrailResponse)
-> Either String Int -> Either String UpdateTrailResponse
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 UpdateTrail

instance Prelude.NFData UpdateTrail

instance Core.ToHeaders UpdateTrail where
  toHeaders :: UpdateTrail -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateTrail -> 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.UpdateTrail" ::
                          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 UpdateTrail where
  toJSON :: UpdateTrail -> Value
toJSON UpdateTrail' {Maybe Bool
Maybe Text
Text
name :: Text
isMultiRegionTrail :: Maybe Bool
s3BucketName :: Maybe Text
cloudWatchLogsRoleArn :: Maybe Text
isOrganizationTrail :: Maybe Bool
includeGlobalServiceEvents :: Maybe Bool
kmsKeyId :: Maybe Text
cloudWatchLogsLogGroupArn :: Maybe Text
enableLogFileValidation :: Maybe Bool
snsTopicName :: Maybe Text
s3KeyPrefix :: Maybe Text
$sel:name:UpdateTrail' :: UpdateTrail -> Text
$sel:isMultiRegionTrail:UpdateTrail' :: UpdateTrail -> Maybe Bool
$sel:s3BucketName:UpdateTrail' :: UpdateTrail -> Maybe Text
$sel:cloudWatchLogsRoleArn:UpdateTrail' :: UpdateTrail -> Maybe Text
$sel:isOrganizationTrail:UpdateTrail' :: UpdateTrail -> Maybe Bool
$sel:includeGlobalServiceEvents:UpdateTrail' :: UpdateTrail -> Maybe Bool
$sel:kmsKeyId:UpdateTrail' :: UpdateTrail -> Maybe Text
$sel:cloudWatchLogsLogGroupArn:UpdateTrail' :: UpdateTrail -> Maybe Text
$sel:enableLogFileValidation:UpdateTrail' :: UpdateTrail -> Maybe Bool
$sel:snsTopicName:UpdateTrail' :: UpdateTrail -> Maybe Text
$sel:s3KeyPrefix:UpdateTrail' :: UpdateTrail -> 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
"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
"S3BucketName" 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
s3BucketName,
            (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)
          ]
      )

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

instance Core.ToQuery UpdateTrail where
  toQuery :: UpdateTrail -> QueryString
toQuery = QueryString -> UpdateTrail -> 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:/ 'newUpdateTrailResponse' smart constructor.
data UpdateTrailResponse = UpdateTrailResponse'
  { -- | Specifies whether log file integrity validation is enabled.
    UpdateTrailResponse -> Maybe Bool
logFileValidationEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the ARN of the trail that was updated. The following is the
    -- format of a trail ARN.
    --
    -- @arn:aws:cloudtrail:us-east-2:123456789012:trail\/MyTrail@
    UpdateTrailResponse -> 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 IAM Log Files>.
    UpdateTrailResponse -> 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 following is the format
    -- of a topic ARN.
    --
    -- @arn:aws:sns:us-east-2:123456789012:MyTopic@
    UpdateTrailResponse -> Maybe Text
snsTopicARN :: Prelude.Maybe Prelude.Text,
    -- | This field is no longer in use. Use UpdateTrailResponse$SnsTopicARN.
    UpdateTrailResponse -> Maybe Text
snsTopicName :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Amazon Resource Name (ARN) of the log group to which
    -- CloudTrail logs are delivered.
    UpdateTrailResponse -> 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@
    UpdateTrailResponse -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the name of the trail.
    UpdateTrailResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the trail is publishing events from global services
    -- such as IAM to the log files.
    UpdateTrailResponse -> Maybe Bool
includeGlobalServiceEvents :: Prelude.Maybe Prelude.Bool,
    -- | Specifies whether the trail is an organization trail.
    UpdateTrailResponse -> 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.
    UpdateTrailResponse -> Maybe Text
cloudWatchLogsRoleArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies the name of the Amazon S3 bucket designated for publishing log
    -- files.
    UpdateTrailResponse -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the trail exists in one region or in all regions.
    UpdateTrailResponse -> Maybe Bool
isMultiRegionTrail :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    UpdateTrailResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateTrailResponse -> UpdateTrailResponse -> Bool
(UpdateTrailResponse -> UpdateTrailResponse -> Bool)
-> (UpdateTrailResponse -> UpdateTrailResponse -> Bool)
-> Eq UpdateTrailResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTrailResponse -> UpdateTrailResponse -> Bool
$c/= :: UpdateTrailResponse -> UpdateTrailResponse -> Bool
== :: UpdateTrailResponse -> UpdateTrailResponse -> Bool
$c== :: UpdateTrailResponse -> UpdateTrailResponse -> Bool
Prelude.Eq, ReadPrec [UpdateTrailResponse]
ReadPrec UpdateTrailResponse
Int -> ReadS UpdateTrailResponse
ReadS [UpdateTrailResponse]
(Int -> ReadS UpdateTrailResponse)
-> ReadS [UpdateTrailResponse]
-> ReadPrec UpdateTrailResponse
-> ReadPrec [UpdateTrailResponse]
-> Read UpdateTrailResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTrailResponse]
$creadListPrec :: ReadPrec [UpdateTrailResponse]
readPrec :: ReadPrec UpdateTrailResponse
$creadPrec :: ReadPrec UpdateTrailResponse
readList :: ReadS [UpdateTrailResponse]
$creadList :: ReadS [UpdateTrailResponse]
readsPrec :: Int -> ReadS UpdateTrailResponse
$creadsPrec :: Int -> ReadS UpdateTrailResponse
Prelude.Read, Int -> UpdateTrailResponse -> ShowS
[UpdateTrailResponse] -> ShowS
UpdateTrailResponse -> String
(Int -> UpdateTrailResponse -> ShowS)
-> (UpdateTrailResponse -> String)
-> ([UpdateTrailResponse] -> ShowS)
-> Show UpdateTrailResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTrailResponse] -> ShowS
$cshowList :: [UpdateTrailResponse] -> ShowS
show :: UpdateTrailResponse -> String
$cshow :: UpdateTrailResponse -> String
showsPrec :: Int -> UpdateTrailResponse -> ShowS
$cshowsPrec :: Int -> UpdateTrailResponse -> ShowS
Prelude.Show, (forall x. UpdateTrailResponse -> Rep UpdateTrailResponse x)
-> (forall x. Rep UpdateTrailResponse x -> UpdateTrailResponse)
-> Generic UpdateTrailResponse
forall x. Rep UpdateTrailResponse x -> UpdateTrailResponse
forall x. UpdateTrailResponse -> Rep UpdateTrailResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTrailResponse x -> UpdateTrailResponse
$cfrom :: forall x. UpdateTrailResponse -> Rep UpdateTrailResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateTrailResponse' 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', 'updateTrailResponse_logFileValidationEnabled' - Specifies whether log file integrity validation is enabled.
--
-- 'trailARN', 'updateTrailResponse_trailARN' - Specifies the ARN of the trail that was updated. The following is the
-- format of a trail ARN.
--
-- @arn:aws:cloudtrail:us-east-2:123456789012:trail\/MyTrail@
--
-- 's3KeyPrefix', 'updateTrailResponse_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 IAM Log Files>.
--
-- 'snsTopicARN', 'updateTrailResponse_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', 'updateTrailResponse_snsTopicName' - This field is no longer in use. Use UpdateTrailResponse$SnsTopicARN.
--
-- 'cloudWatchLogsLogGroupArn', 'updateTrailResponse_cloudWatchLogsLogGroupArn' - Specifies the Amazon Resource Name (ARN) of the log group to which
-- CloudTrail logs are delivered.
--
-- 'kmsKeyId', 'updateTrailResponse_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', 'updateTrailResponse_name' - Specifies the name of the trail.
--
-- 'includeGlobalServiceEvents', 'updateTrailResponse_includeGlobalServiceEvents' - Specifies whether the trail is publishing events from global services
-- such as IAM to the log files.
--
-- 'isOrganizationTrail', 'updateTrailResponse_isOrganizationTrail' - Specifies whether the trail is an organization trail.
--
-- 'cloudWatchLogsRoleArn', 'updateTrailResponse_cloudWatchLogsRoleArn' - Specifies the role for the CloudWatch Logs endpoint to assume to write
-- to a user\'s log group.
--
-- 's3BucketName', 'updateTrailResponse_s3BucketName' - Specifies the name of the Amazon S3 bucket designated for publishing log
-- files.
--
-- 'isMultiRegionTrail', 'updateTrailResponse_isMultiRegionTrail' - Specifies whether the trail exists in one region or in all regions.
--
-- 'httpStatus', 'updateTrailResponse_httpStatus' - The response's http status code.
newUpdateTrailResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateTrailResponse
newUpdateTrailResponse :: Int -> UpdateTrailResponse
newUpdateTrailResponse Int
pHttpStatus_ =
  UpdateTrailResponse' :: 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
-> UpdateTrailResponse
UpdateTrailResponse'
    { $sel:logFileValidationEnabled:UpdateTrailResponse' :: Maybe Bool
logFileValidationEnabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:trailARN:UpdateTrailResponse' :: Maybe Text
trailARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3KeyPrefix:UpdateTrailResponse' :: Maybe Text
s3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicARN:UpdateTrailResponse' :: Maybe Text
snsTopicARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicName:UpdateTrailResponse' :: Maybe Text
snsTopicName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsLogGroupArn:UpdateTrailResponse' :: Maybe Text
cloudWatchLogsLogGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:UpdateTrailResponse' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateTrailResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:includeGlobalServiceEvents:UpdateTrailResponse' :: Maybe Bool
includeGlobalServiceEvents = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:isOrganizationTrail:UpdateTrailResponse' :: Maybe Bool
isOrganizationTrail = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsRoleArn:UpdateTrailResponse' :: Maybe Text
cloudWatchLogsRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketName:UpdateTrailResponse' :: Maybe Text
s3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isMultiRegionTrail:UpdateTrailResponse' :: Maybe Bool
isMultiRegionTrail = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateTrailResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

instance Prelude.NFData UpdateTrailResponse