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