{-# 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.S3.Types.OutputSerialization where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.CSVOutput
import Amazonka.S3.Types.JSONOutput
data OutputSerialization = OutputSerialization'
{
OutputSerialization -> Maybe JSONOutput
json :: Prelude.Maybe JSONOutput,
OutputSerialization -> Maybe CSVOutput
csv :: Prelude.Maybe CSVOutput
}
deriving (OutputSerialization -> OutputSerialization -> Bool
(OutputSerialization -> OutputSerialization -> Bool)
-> (OutputSerialization -> OutputSerialization -> Bool)
-> Eq OutputSerialization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputSerialization -> OutputSerialization -> Bool
$c/= :: OutputSerialization -> OutputSerialization -> Bool
== :: OutputSerialization -> OutputSerialization -> Bool
$c== :: OutputSerialization -> OutputSerialization -> Bool
Prelude.Eq, ReadPrec [OutputSerialization]
ReadPrec OutputSerialization
Int -> ReadS OutputSerialization
ReadS [OutputSerialization]
(Int -> ReadS OutputSerialization)
-> ReadS [OutputSerialization]
-> ReadPrec OutputSerialization
-> ReadPrec [OutputSerialization]
-> Read OutputSerialization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputSerialization]
$creadListPrec :: ReadPrec [OutputSerialization]
readPrec :: ReadPrec OutputSerialization
$creadPrec :: ReadPrec OutputSerialization
readList :: ReadS [OutputSerialization]
$creadList :: ReadS [OutputSerialization]
readsPrec :: Int -> ReadS OutputSerialization
$creadsPrec :: Int -> ReadS OutputSerialization
Prelude.Read, Int -> OutputSerialization -> ShowS
[OutputSerialization] -> ShowS
OutputSerialization -> String
(Int -> OutputSerialization -> ShowS)
-> (OutputSerialization -> String)
-> ([OutputSerialization] -> ShowS)
-> Show OutputSerialization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputSerialization] -> ShowS
$cshowList :: [OutputSerialization] -> ShowS
show :: OutputSerialization -> String
$cshow :: OutputSerialization -> String
showsPrec :: Int -> OutputSerialization -> ShowS
$cshowsPrec :: Int -> OutputSerialization -> ShowS
Prelude.Show, (forall x. OutputSerialization -> Rep OutputSerialization x)
-> (forall x. Rep OutputSerialization x -> OutputSerialization)
-> Generic OutputSerialization
forall x. Rep OutputSerialization x -> OutputSerialization
forall x. OutputSerialization -> Rep OutputSerialization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputSerialization x -> OutputSerialization
$cfrom :: forall x. OutputSerialization -> Rep OutputSerialization x
Prelude.Generic)
newOutputSerialization ::
OutputSerialization
newOutputSerialization :: OutputSerialization
newOutputSerialization =
OutputSerialization' :: Maybe JSONOutput -> Maybe CSVOutput -> OutputSerialization
OutputSerialization'
{ $sel:json:OutputSerialization' :: Maybe JSONOutput
json = Maybe JSONOutput
forall a. Maybe a
Prelude.Nothing,
$sel:csv:OutputSerialization' :: Maybe CSVOutput
csv = Maybe CSVOutput
forall a. Maybe a
Prelude.Nothing
}
outputSerialization_json :: Lens.Lens' OutputSerialization (Prelude.Maybe JSONOutput)
outputSerialization_json :: (Maybe JSONOutput -> f (Maybe JSONOutput))
-> OutputSerialization -> f OutputSerialization
outputSerialization_json = (OutputSerialization -> Maybe JSONOutput)
-> (OutputSerialization -> Maybe JSONOutput -> OutputSerialization)
-> Lens
OutputSerialization
OutputSerialization
(Maybe JSONOutput)
(Maybe JSONOutput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputSerialization' {Maybe JSONOutput
json :: Maybe JSONOutput
$sel:json:OutputSerialization' :: OutputSerialization -> Maybe JSONOutput
json} -> Maybe JSONOutput
json) (\s :: OutputSerialization
s@OutputSerialization' {} Maybe JSONOutput
a -> OutputSerialization
s {$sel:json:OutputSerialization' :: Maybe JSONOutput
json = Maybe JSONOutput
a} :: OutputSerialization)
outputSerialization_csv :: Lens.Lens' OutputSerialization (Prelude.Maybe CSVOutput)
outputSerialization_csv :: (Maybe CSVOutput -> f (Maybe CSVOutput))
-> OutputSerialization -> f OutputSerialization
outputSerialization_csv = (OutputSerialization -> Maybe CSVOutput)
-> (OutputSerialization -> Maybe CSVOutput -> OutputSerialization)
-> Lens
OutputSerialization
OutputSerialization
(Maybe CSVOutput)
(Maybe CSVOutput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputSerialization' {Maybe CSVOutput
csv :: Maybe CSVOutput
$sel:csv:OutputSerialization' :: OutputSerialization -> Maybe CSVOutput
csv} -> Maybe CSVOutput
csv) (\s :: OutputSerialization
s@OutputSerialization' {} Maybe CSVOutput
a -> OutputSerialization
s {$sel:csv:OutputSerialization' :: Maybe CSVOutput
csv = Maybe CSVOutput
a} :: OutputSerialization)
instance Prelude.Hashable OutputSerialization
instance Prelude.NFData OutputSerialization
instance Core.ToXML OutputSerialization where
toXML :: OutputSerialization -> XML
toXML OutputSerialization' {Maybe JSONOutput
Maybe CSVOutput
csv :: Maybe CSVOutput
json :: Maybe JSONOutput
$sel:csv:OutputSerialization' :: OutputSerialization -> Maybe CSVOutput
$sel:json:OutputSerialization' :: OutputSerialization -> Maybe JSONOutput
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[Name
"JSON" Name -> Maybe JSONOutput -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe JSONOutput
json, Name
"CSV" Name -> Maybe CSVOutput -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe CSVOutput
csv]