{-# 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.LexV2Models.Types.EncryptionSetting
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LexV2Models.Types.EncryptionSetting where

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

-- | The object representing the passwords that were used to encrypt the data
-- related to the bot recommendation, as well as the KMS key ARN used to
-- encrypt the associated metadata.
--
-- /See:/ 'newEncryptionSetting' smart constructor.
data EncryptionSetting = EncryptionSetting'
  { -- | The password used to encrypt the associated transcript file.
    EncryptionSetting -> Maybe (Sensitive Text)
associatedTranscriptsPassword :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The password used to encrypt the recommended bot recommendation file.
    EncryptionSetting -> Maybe (Sensitive Text)
botLocaleExportPassword :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The KMS key ARN used to encrypt the metadata associated with the bot
    -- recommendation.
    EncryptionSetting -> Maybe Text
kmsKeyArn :: Prelude.Maybe Prelude.Text
  }
  deriving (EncryptionSetting -> EncryptionSetting -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EncryptionSetting -> EncryptionSetting -> Bool
$c/= :: EncryptionSetting -> EncryptionSetting -> Bool
== :: EncryptionSetting -> EncryptionSetting -> Bool
$c== :: EncryptionSetting -> EncryptionSetting -> Bool
Prelude.Eq, Int -> EncryptionSetting -> ShowS
[EncryptionSetting] -> ShowS
EncryptionSetting -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EncryptionSetting] -> ShowS
$cshowList :: [EncryptionSetting] -> ShowS
show :: EncryptionSetting -> String
$cshow :: EncryptionSetting -> String
showsPrec :: Int -> EncryptionSetting -> ShowS
$cshowsPrec :: Int -> EncryptionSetting -> ShowS
Prelude.Show, forall x. Rep EncryptionSetting x -> EncryptionSetting
forall x. EncryptionSetting -> Rep EncryptionSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EncryptionSetting x -> EncryptionSetting
$cfrom :: forall x. EncryptionSetting -> Rep EncryptionSetting x
Prelude.Generic)

-- |
-- Create a value of 'EncryptionSetting' 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:
--
-- 'associatedTranscriptsPassword', 'encryptionSetting_associatedTranscriptsPassword' - The password used to encrypt the associated transcript file.
--
-- 'botLocaleExportPassword', 'encryptionSetting_botLocaleExportPassword' - The password used to encrypt the recommended bot recommendation file.
--
-- 'kmsKeyArn', 'encryptionSetting_kmsKeyArn' - The KMS key ARN used to encrypt the metadata associated with the bot
-- recommendation.
newEncryptionSetting ::
  EncryptionSetting
newEncryptionSetting :: EncryptionSetting
newEncryptionSetting =
  EncryptionSetting'
    { $sel:associatedTranscriptsPassword:EncryptionSetting' :: Maybe (Sensitive Text)
associatedTranscriptsPassword =
        forall a. Maybe a
Prelude.Nothing,
      $sel:botLocaleExportPassword:EncryptionSetting' :: Maybe (Sensitive Text)
botLocaleExportPassword = forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyArn:EncryptionSetting' :: Maybe Text
kmsKeyArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The password used to encrypt the associated transcript file.
encryptionSetting_associatedTranscriptsPassword :: Lens.Lens' EncryptionSetting (Prelude.Maybe Prelude.Text)
encryptionSetting_associatedTranscriptsPassword :: Lens' EncryptionSetting (Maybe Text)
encryptionSetting_associatedTranscriptsPassword = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionSetting' {Maybe (Sensitive Text)
associatedTranscriptsPassword :: Maybe (Sensitive Text)
$sel:associatedTranscriptsPassword:EncryptionSetting' :: EncryptionSetting -> Maybe (Sensitive Text)
associatedTranscriptsPassword} -> Maybe (Sensitive Text)
associatedTranscriptsPassword) (\s :: EncryptionSetting
s@EncryptionSetting' {} Maybe (Sensitive Text)
a -> EncryptionSetting
s {$sel:associatedTranscriptsPassword:EncryptionSetting' :: Maybe (Sensitive Text)
associatedTranscriptsPassword = Maybe (Sensitive Text)
a} :: EncryptionSetting) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The password used to encrypt the recommended bot recommendation file.
encryptionSetting_botLocaleExportPassword :: Lens.Lens' EncryptionSetting (Prelude.Maybe Prelude.Text)
encryptionSetting_botLocaleExportPassword :: Lens' EncryptionSetting (Maybe Text)
encryptionSetting_botLocaleExportPassword = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionSetting' {Maybe (Sensitive Text)
botLocaleExportPassword :: Maybe (Sensitive Text)
$sel:botLocaleExportPassword:EncryptionSetting' :: EncryptionSetting -> Maybe (Sensitive Text)
botLocaleExportPassword} -> Maybe (Sensitive Text)
botLocaleExportPassword) (\s :: EncryptionSetting
s@EncryptionSetting' {} Maybe (Sensitive Text)
a -> EncryptionSetting
s {$sel:botLocaleExportPassword:EncryptionSetting' :: Maybe (Sensitive Text)
botLocaleExportPassword = Maybe (Sensitive Text)
a} :: EncryptionSetting) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The KMS key ARN used to encrypt the metadata associated with the bot
-- recommendation.
encryptionSetting_kmsKeyArn :: Lens.Lens' EncryptionSetting (Prelude.Maybe Prelude.Text)
encryptionSetting_kmsKeyArn :: Lens' EncryptionSetting (Maybe Text)
encryptionSetting_kmsKeyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionSetting' {Maybe Text
kmsKeyArn :: Maybe Text
$sel:kmsKeyArn:EncryptionSetting' :: EncryptionSetting -> Maybe Text
kmsKeyArn} -> Maybe Text
kmsKeyArn) (\s :: EncryptionSetting
s@EncryptionSetting' {} Maybe Text
a -> EncryptionSetting
s {$sel:kmsKeyArn:EncryptionSetting' :: Maybe Text
kmsKeyArn = Maybe Text
a} :: EncryptionSetting)

instance Data.FromJSON EncryptionSetting where
  parseJSON :: Value -> Parser EncryptionSetting
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EncryptionSetting"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe (Sensitive Text) -> Maybe Text -> EncryptionSetting
EncryptionSetting'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"associatedTranscriptsPassword")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"botLocaleExportPassword")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"kmsKeyArn")
      )

instance Prelude.Hashable EncryptionSetting where
  hashWithSalt :: Int -> EncryptionSetting -> Int
hashWithSalt Int
_salt EncryptionSetting' {Maybe Text
Maybe (Sensitive Text)
kmsKeyArn :: Maybe Text
botLocaleExportPassword :: Maybe (Sensitive Text)
associatedTranscriptsPassword :: Maybe (Sensitive Text)
$sel:kmsKeyArn:EncryptionSetting' :: EncryptionSetting -> Maybe Text
$sel:botLocaleExportPassword:EncryptionSetting' :: EncryptionSetting -> Maybe (Sensitive Text)
$sel:associatedTranscriptsPassword:EncryptionSetting' :: EncryptionSetting -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
associatedTranscriptsPassword
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
botLocaleExportPassword
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyArn

instance Prelude.NFData EncryptionSetting where
  rnf :: EncryptionSetting -> ()
rnf EncryptionSetting' {Maybe Text
Maybe (Sensitive Text)
kmsKeyArn :: Maybe Text
botLocaleExportPassword :: Maybe (Sensitive Text)
associatedTranscriptsPassword :: Maybe (Sensitive Text)
$sel:kmsKeyArn:EncryptionSetting' :: EncryptionSetting -> Maybe Text
$sel:botLocaleExportPassword:EncryptionSetting' :: EncryptionSetting -> Maybe (Sensitive Text)
$sel:associatedTranscriptsPassword:EncryptionSetting' :: EncryptionSetting -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
associatedTranscriptsPassword
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
botLocaleExportPassword
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyArn

instance Data.ToJSON EncryptionSetting where
  toJSON :: EncryptionSetting -> Value
toJSON EncryptionSetting' {Maybe Text
Maybe (Sensitive Text)
kmsKeyArn :: Maybe Text
botLocaleExportPassword :: Maybe (Sensitive Text)
associatedTranscriptsPassword :: Maybe (Sensitive Text)
$sel:kmsKeyArn:EncryptionSetting' :: EncryptionSetting -> Maybe Text
$sel:botLocaleExportPassword:EncryptionSetting' :: EncryptionSetting -> Maybe (Sensitive Text)
$sel:associatedTranscriptsPassword:EncryptionSetting' :: EncryptionSetting -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"associatedTranscriptsPassword" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
associatedTranscriptsPassword,
            (Key
"botLocaleExportPassword" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
botLocaleExportPassword,
            (Key
"kmsKeyArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyArn
          ]
      )