{-# 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 #-}
module Amazonka.Forecast.Types.EncryptionConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EncryptionConfig = EncryptionConfig'
{
EncryptionConfig -> Text
roleArn :: Prelude.Text,
EncryptionConfig -> Text
kmsKeyArn :: Prelude.Text
}
deriving (EncryptionConfig -> EncryptionConfig -> Bool
(EncryptionConfig -> EncryptionConfig -> Bool)
-> (EncryptionConfig -> EncryptionConfig -> Bool)
-> Eq EncryptionConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EncryptionConfig -> EncryptionConfig -> Bool
$c/= :: EncryptionConfig -> EncryptionConfig -> Bool
== :: EncryptionConfig -> EncryptionConfig -> Bool
$c== :: EncryptionConfig -> EncryptionConfig -> Bool
Prelude.Eq, ReadPrec [EncryptionConfig]
ReadPrec EncryptionConfig
Int -> ReadS EncryptionConfig
ReadS [EncryptionConfig]
(Int -> ReadS EncryptionConfig)
-> ReadS [EncryptionConfig]
-> ReadPrec EncryptionConfig
-> ReadPrec [EncryptionConfig]
-> Read EncryptionConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EncryptionConfig]
$creadListPrec :: ReadPrec [EncryptionConfig]
readPrec :: ReadPrec EncryptionConfig
$creadPrec :: ReadPrec EncryptionConfig
readList :: ReadS [EncryptionConfig]
$creadList :: ReadS [EncryptionConfig]
readsPrec :: Int -> ReadS EncryptionConfig
$creadsPrec :: Int -> ReadS EncryptionConfig
Prelude.Read, Int -> EncryptionConfig -> ShowS
[EncryptionConfig] -> ShowS
EncryptionConfig -> String
(Int -> EncryptionConfig -> ShowS)
-> (EncryptionConfig -> String)
-> ([EncryptionConfig] -> ShowS)
-> Show EncryptionConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EncryptionConfig] -> ShowS
$cshowList :: [EncryptionConfig] -> ShowS
show :: EncryptionConfig -> String
$cshow :: EncryptionConfig -> String
showsPrec :: Int -> EncryptionConfig -> ShowS
$cshowsPrec :: Int -> EncryptionConfig -> ShowS
Prelude.Show, (forall x. EncryptionConfig -> Rep EncryptionConfig x)
-> (forall x. Rep EncryptionConfig x -> EncryptionConfig)
-> Generic EncryptionConfig
forall x. Rep EncryptionConfig x -> EncryptionConfig
forall x. EncryptionConfig -> Rep EncryptionConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EncryptionConfig x -> EncryptionConfig
$cfrom :: forall x. EncryptionConfig -> Rep EncryptionConfig x
Prelude.Generic)
newEncryptionConfig ::
Prelude.Text ->
Prelude.Text ->
EncryptionConfig
newEncryptionConfig :: Text -> Text -> EncryptionConfig
newEncryptionConfig Text
pRoleArn_ Text
pKMSKeyArn_ =
EncryptionConfig' :: Text -> Text -> EncryptionConfig
EncryptionConfig'
{ $sel:roleArn:EncryptionConfig' :: Text
roleArn = Text
pRoleArn_,
$sel:kmsKeyArn:EncryptionConfig' :: Text
kmsKeyArn = Text
pKMSKeyArn_
}
encryptionConfig_roleArn :: Lens.Lens' EncryptionConfig Prelude.Text
encryptionConfig_roleArn :: (Text -> f Text) -> EncryptionConfig -> f EncryptionConfig
encryptionConfig_roleArn = (EncryptionConfig -> Text)
-> (EncryptionConfig -> Text -> EncryptionConfig)
-> Lens EncryptionConfig EncryptionConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionConfig' {Text
roleArn :: Text
$sel:roleArn:EncryptionConfig' :: EncryptionConfig -> Text
roleArn} -> Text
roleArn) (\s :: EncryptionConfig
s@EncryptionConfig' {} Text
a -> EncryptionConfig
s {$sel:roleArn:EncryptionConfig' :: Text
roleArn = Text
a} :: EncryptionConfig)
encryptionConfig_kmsKeyArn :: Lens.Lens' EncryptionConfig Prelude.Text
encryptionConfig_kmsKeyArn :: (Text -> f Text) -> EncryptionConfig -> f EncryptionConfig
encryptionConfig_kmsKeyArn = (EncryptionConfig -> Text)
-> (EncryptionConfig -> Text -> EncryptionConfig)
-> Lens EncryptionConfig EncryptionConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionConfig' {Text
kmsKeyArn :: Text
$sel:kmsKeyArn:EncryptionConfig' :: EncryptionConfig -> Text
kmsKeyArn} -> Text
kmsKeyArn) (\s :: EncryptionConfig
s@EncryptionConfig' {} Text
a -> EncryptionConfig
s {$sel:kmsKeyArn:EncryptionConfig' :: Text
kmsKeyArn = Text
a} :: EncryptionConfig)
instance Core.FromJSON EncryptionConfig where
parseJSON :: Value -> Parser EncryptionConfig
parseJSON =
String
-> (Object -> Parser EncryptionConfig)
-> Value
-> Parser EncryptionConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EncryptionConfig"
( \Object
x ->
Text -> Text -> EncryptionConfig
EncryptionConfig'
(Text -> Text -> EncryptionConfig)
-> Parser Text -> Parser (Text -> EncryptionConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RoleArn")
Parser (Text -> EncryptionConfig)
-> Parser Text -> Parser EncryptionConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"KMSKeyArn")
)
instance Prelude.Hashable EncryptionConfig
instance Prelude.NFData EncryptionConfig
instance Core.ToJSON EncryptionConfig where
toJSON :: EncryptionConfig -> Value
toJSON EncryptionConfig' {Text
kmsKeyArn :: Text
roleArn :: Text
$sel:kmsKeyArn:EncryptionConfig' :: EncryptionConfig -> Text
$sel:roleArn:EncryptionConfig' :: EncryptionConfig -> Text
..} =
[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
"RoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"KMSKeyArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
kmsKeyArn)
]
)