{-# 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.LexModels.Types.ConversationLogsRequest
-- 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.LexModels.Types.ConversationLogsRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types.LogSettingsRequest
import qualified Amazonka.Prelude as Prelude

-- | Provides the settings needed for conversation logs.
--
-- /See:/ 'newConversationLogsRequest' smart constructor.
data ConversationLogsRequest = ConversationLogsRequest'
  { -- | The settings for your conversation logs. You can log the conversation
    -- text, conversation audio, or both.
    ConversationLogsRequest -> [LogSettingsRequest]
logSettings :: [LogSettingsRequest],
    -- | The Amazon Resource Name (ARN) of an IAM role with permission to write
    -- to your CloudWatch Logs for text logs and your S3 bucket for audio logs.
    -- If audio encryption is enabled, this role also provides access
    -- permission for the AWS KMS key used for encrypting audio logs. For more
    -- information, see
    -- <https://docs.aws.amazon.com/lex/latest/dg/conversation-logs-role-and-policy.html Creating an IAM Role and Policy for Conversation Logs>.
    ConversationLogsRequest -> Text
iamRoleArn :: Prelude.Text
  }
  deriving (ConversationLogsRequest -> ConversationLogsRequest -> Bool
(ConversationLogsRequest -> ConversationLogsRequest -> Bool)
-> (ConversationLogsRequest -> ConversationLogsRequest -> Bool)
-> Eq ConversationLogsRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConversationLogsRequest -> ConversationLogsRequest -> Bool
$c/= :: ConversationLogsRequest -> ConversationLogsRequest -> Bool
== :: ConversationLogsRequest -> ConversationLogsRequest -> Bool
$c== :: ConversationLogsRequest -> ConversationLogsRequest -> Bool
Prelude.Eq, ReadPrec [ConversationLogsRequest]
ReadPrec ConversationLogsRequest
Int -> ReadS ConversationLogsRequest
ReadS [ConversationLogsRequest]
(Int -> ReadS ConversationLogsRequest)
-> ReadS [ConversationLogsRequest]
-> ReadPrec ConversationLogsRequest
-> ReadPrec [ConversationLogsRequest]
-> Read ConversationLogsRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConversationLogsRequest]
$creadListPrec :: ReadPrec [ConversationLogsRequest]
readPrec :: ReadPrec ConversationLogsRequest
$creadPrec :: ReadPrec ConversationLogsRequest
readList :: ReadS [ConversationLogsRequest]
$creadList :: ReadS [ConversationLogsRequest]
readsPrec :: Int -> ReadS ConversationLogsRequest
$creadsPrec :: Int -> ReadS ConversationLogsRequest
Prelude.Read, Int -> ConversationLogsRequest -> ShowS
[ConversationLogsRequest] -> ShowS
ConversationLogsRequest -> String
(Int -> ConversationLogsRequest -> ShowS)
-> (ConversationLogsRequest -> String)
-> ([ConversationLogsRequest] -> ShowS)
-> Show ConversationLogsRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConversationLogsRequest] -> ShowS
$cshowList :: [ConversationLogsRequest] -> ShowS
show :: ConversationLogsRequest -> String
$cshow :: ConversationLogsRequest -> String
showsPrec :: Int -> ConversationLogsRequest -> ShowS
$cshowsPrec :: Int -> ConversationLogsRequest -> ShowS
Prelude.Show, (forall x.
 ConversationLogsRequest -> Rep ConversationLogsRequest x)
-> (forall x.
    Rep ConversationLogsRequest x -> ConversationLogsRequest)
-> Generic ConversationLogsRequest
forall x. Rep ConversationLogsRequest x -> ConversationLogsRequest
forall x. ConversationLogsRequest -> Rep ConversationLogsRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConversationLogsRequest x -> ConversationLogsRequest
$cfrom :: forall x. ConversationLogsRequest -> Rep ConversationLogsRequest x
Prelude.Generic)

-- |
-- Create a value of 'ConversationLogsRequest' 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:
--
-- 'logSettings', 'conversationLogsRequest_logSettings' - The settings for your conversation logs. You can log the conversation
-- text, conversation audio, or both.
--
-- 'iamRoleArn', 'conversationLogsRequest_iamRoleArn' - The Amazon Resource Name (ARN) of an IAM role with permission to write
-- to your CloudWatch Logs for text logs and your S3 bucket for audio logs.
-- If audio encryption is enabled, this role also provides access
-- permission for the AWS KMS key used for encrypting audio logs. For more
-- information, see
-- <https://docs.aws.amazon.com/lex/latest/dg/conversation-logs-role-and-policy.html Creating an IAM Role and Policy for Conversation Logs>.
newConversationLogsRequest ::
  -- | 'iamRoleArn'
  Prelude.Text ->
  ConversationLogsRequest
newConversationLogsRequest :: Text -> ConversationLogsRequest
newConversationLogsRequest Text
pIamRoleArn_ =
  ConversationLogsRequest' :: [LogSettingsRequest] -> Text -> ConversationLogsRequest
ConversationLogsRequest'
    { $sel:logSettings:ConversationLogsRequest' :: [LogSettingsRequest]
logSettings =
        [LogSettingsRequest]
forall a. Monoid a => a
Prelude.mempty,
      $sel:iamRoleArn:ConversationLogsRequest' :: Text
iamRoleArn = Text
pIamRoleArn_
    }

-- | The settings for your conversation logs. You can log the conversation
-- text, conversation audio, or both.
conversationLogsRequest_logSettings :: Lens.Lens' ConversationLogsRequest [LogSettingsRequest]
conversationLogsRequest_logSettings :: ([LogSettingsRequest] -> f [LogSettingsRequest])
-> ConversationLogsRequest -> f ConversationLogsRequest
conversationLogsRequest_logSettings = (ConversationLogsRequest -> [LogSettingsRequest])
-> (ConversationLogsRequest
    -> [LogSettingsRequest] -> ConversationLogsRequest)
-> Lens
     ConversationLogsRequest
     ConversationLogsRequest
     [LogSettingsRequest]
     [LogSettingsRequest]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConversationLogsRequest' {[LogSettingsRequest]
logSettings :: [LogSettingsRequest]
$sel:logSettings:ConversationLogsRequest' :: ConversationLogsRequest -> [LogSettingsRequest]
logSettings} -> [LogSettingsRequest]
logSettings) (\s :: ConversationLogsRequest
s@ConversationLogsRequest' {} [LogSettingsRequest]
a -> ConversationLogsRequest
s {$sel:logSettings:ConversationLogsRequest' :: [LogSettingsRequest]
logSettings = [LogSettingsRequest]
a} :: ConversationLogsRequest) (([LogSettingsRequest] -> f [LogSettingsRequest])
 -> ConversationLogsRequest -> f ConversationLogsRequest)
-> (([LogSettingsRequest] -> f [LogSettingsRequest])
    -> [LogSettingsRequest] -> f [LogSettingsRequest])
-> ([LogSettingsRequest] -> f [LogSettingsRequest])
-> ConversationLogsRequest
-> f ConversationLogsRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([LogSettingsRequest] -> f [LogSettingsRequest])
-> [LogSettingsRequest] -> f [LogSettingsRequest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of an IAM role with permission to write
-- to your CloudWatch Logs for text logs and your S3 bucket for audio logs.
-- If audio encryption is enabled, this role also provides access
-- permission for the AWS KMS key used for encrypting audio logs. For more
-- information, see
-- <https://docs.aws.amazon.com/lex/latest/dg/conversation-logs-role-and-policy.html Creating an IAM Role and Policy for Conversation Logs>.
conversationLogsRequest_iamRoleArn :: Lens.Lens' ConversationLogsRequest Prelude.Text
conversationLogsRequest_iamRoleArn :: (Text -> f Text)
-> ConversationLogsRequest -> f ConversationLogsRequest
conversationLogsRequest_iamRoleArn = (ConversationLogsRequest -> Text)
-> (ConversationLogsRequest -> Text -> ConversationLogsRequest)
-> Lens ConversationLogsRequest ConversationLogsRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConversationLogsRequest' {Text
iamRoleArn :: Text
$sel:iamRoleArn:ConversationLogsRequest' :: ConversationLogsRequest -> Text
iamRoleArn} -> Text
iamRoleArn) (\s :: ConversationLogsRequest
s@ConversationLogsRequest' {} Text
a -> ConversationLogsRequest
s {$sel:iamRoleArn:ConversationLogsRequest' :: Text
iamRoleArn = Text
a} :: ConversationLogsRequest)

instance Prelude.Hashable ConversationLogsRequest

instance Prelude.NFData ConversationLogsRequest

instance Core.ToJSON ConversationLogsRequest where
  toJSON :: ConversationLogsRequest -> Value
toJSON ConversationLogsRequest' {[LogSettingsRequest]
Text
iamRoleArn :: Text
logSettings :: [LogSettingsRequest]
$sel:iamRoleArn:ConversationLogsRequest' :: ConversationLogsRequest -> Text
$sel:logSettings:ConversationLogsRequest' :: ConversationLogsRequest -> [LogSettingsRequest]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"logSettings" Text -> [LogSettingsRequest] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [LogSettingsRequest]
logSettings),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"iamRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
iamRoleArn)
          ]
      )