{-# 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.Glacier.Types.OutputSerialization where
import qualified Amazonka.Core as Core
import Amazonka.Glacier.Types.CSVOutput
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data OutputSerialization = OutputSerialization'
{
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 CSVOutput -> OutputSerialization
OutputSerialization' {$sel:csv:OutputSerialization' :: Maybe CSVOutput
csv = Maybe CSVOutput
forall a. Maybe a
Prelude.Nothing}
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 Core.FromJSON OutputSerialization where
parseJSON :: Value -> Parser OutputSerialization
parseJSON =
String
-> (Object -> Parser OutputSerialization)
-> Value
-> Parser OutputSerialization
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"OutputSerialization"
( \Object
x ->
Maybe CSVOutput -> OutputSerialization
OutputSerialization' (Maybe CSVOutput -> OutputSerialization)
-> Parser (Maybe CSVOutput) -> Parser OutputSerialization
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CSVOutput)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"csv")
)
instance Prelude.Hashable OutputSerialization
instance Prelude.NFData OutputSerialization
instance Core.ToJSON OutputSerialization where
toJSON :: OutputSerialization -> Value
toJSON OutputSerialization' {Maybe CSVOutput
csv :: Maybe CSVOutput
$sel:csv:OutputSerialization' :: OutputSerialization -> Maybe CSVOutput
..} =
[Pair] -> Value
Core.object
([Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes [(Text
"csv" Text -> CSVOutput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CSVOutput -> Pair) -> Maybe CSVOutput -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CSVOutput
csv])