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