{-# 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.DataPipeline.Types.ParameterObject where
import qualified Amazonka.Core as Core
import Amazonka.DataPipeline.Types.ParameterAttribute
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ParameterObject = ParameterObject'
{
ParameterObject -> Text
id :: Prelude.Text,
ParameterObject -> [ParameterAttribute]
attributes :: [ParameterAttribute]
}
deriving (ParameterObject -> ParameterObject -> Bool
(ParameterObject -> ParameterObject -> Bool)
-> (ParameterObject -> ParameterObject -> Bool)
-> Eq ParameterObject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterObject -> ParameterObject -> Bool
$c/= :: ParameterObject -> ParameterObject -> Bool
== :: ParameterObject -> ParameterObject -> Bool
$c== :: ParameterObject -> ParameterObject -> Bool
Prelude.Eq, ReadPrec [ParameterObject]
ReadPrec ParameterObject
Int -> ReadS ParameterObject
ReadS [ParameterObject]
(Int -> ReadS ParameterObject)
-> ReadS [ParameterObject]
-> ReadPrec ParameterObject
-> ReadPrec [ParameterObject]
-> Read ParameterObject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParameterObject]
$creadListPrec :: ReadPrec [ParameterObject]
readPrec :: ReadPrec ParameterObject
$creadPrec :: ReadPrec ParameterObject
readList :: ReadS [ParameterObject]
$creadList :: ReadS [ParameterObject]
readsPrec :: Int -> ReadS ParameterObject
$creadsPrec :: Int -> ReadS ParameterObject
Prelude.Read, Int -> ParameterObject -> ShowS
[ParameterObject] -> ShowS
ParameterObject -> String
(Int -> ParameterObject -> ShowS)
-> (ParameterObject -> String)
-> ([ParameterObject] -> ShowS)
-> Show ParameterObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterObject] -> ShowS
$cshowList :: [ParameterObject] -> ShowS
show :: ParameterObject -> String
$cshow :: ParameterObject -> String
showsPrec :: Int -> ParameterObject -> ShowS
$cshowsPrec :: Int -> ParameterObject -> ShowS
Prelude.Show, (forall x. ParameterObject -> Rep ParameterObject x)
-> (forall x. Rep ParameterObject x -> ParameterObject)
-> Generic ParameterObject
forall x. Rep ParameterObject x -> ParameterObject
forall x. ParameterObject -> Rep ParameterObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParameterObject x -> ParameterObject
$cfrom :: forall x. ParameterObject -> Rep ParameterObject x
Prelude.Generic)
newParameterObject ::
Prelude.Text ->
ParameterObject
newParameterObject :: Text -> ParameterObject
newParameterObject Text
pId_ =
ParameterObject' :: Text -> [ParameterAttribute] -> ParameterObject
ParameterObject'
{ $sel:id:ParameterObject' :: Text
id = Text
pId_,
$sel:attributes:ParameterObject' :: [ParameterAttribute]
attributes = [ParameterAttribute]
forall a. Monoid a => a
Prelude.mempty
}
parameterObject_id :: Lens.Lens' ParameterObject Prelude.Text
parameterObject_id :: (Text -> f Text) -> ParameterObject -> f ParameterObject
parameterObject_id = (ParameterObject -> Text)
-> (ParameterObject -> Text -> ParameterObject)
-> Lens ParameterObject ParameterObject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterObject' {Text
id :: Text
$sel:id:ParameterObject' :: ParameterObject -> Text
id} -> Text
id) (\s :: ParameterObject
s@ParameterObject' {} Text
a -> ParameterObject
s {$sel:id:ParameterObject' :: Text
id = Text
a} :: ParameterObject)
parameterObject_attributes :: Lens.Lens' ParameterObject [ParameterAttribute]
parameterObject_attributes :: ([ParameterAttribute] -> f [ParameterAttribute])
-> ParameterObject -> f ParameterObject
parameterObject_attributes = (ParameterObject -> [ParameterAttribute])
-> (ParameterObject -> [ParameterAttribute] -> ParameterObject)
-> Lens
ParameterObject
ParameterObject
[ParameterAttribute]
[ParameterAttribute]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterObject' {[ParameterAttribute]
attributes :: [ParameterAttribute]
$sel:attributes:ParameterObject' :: ParameterObject -> [ParameterAttribute]
attributes} -> [ParameterAttribute]
attributes) (\s :: ParameterObject
s@ParameterObject' {} [ParameterAttribute]
a -> ParameterObject
s {$sel:attributes:ParameterObject' :: [ParameterAttribute]
attributes = [ParameterAttribute]
a} :: ParameterObject) (([ParameterAttribute] -> f [ParameterAttribute])
-> ParameterObject -> f ParameterObject)
-> (([ParameterAttribute] -> f [ParameterAttribute])
-> [ParameterAttribute] -> f [ParameterAttribute])
-> ([ParameterAttribute] -> f [ParameterAttribute])
-> ParameterObject
-> f ParameterObject
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ParameterAttribute] -> f [ParameterAttribute])
-> [ParameterAttribute] -> f [ParameterAttribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON ParameterObject where
parseJSON :: Value -> Parser ParameterObject
parseJSON =
String
-> (Object -> Parser ParameterObject)
-> Value
-> Parser ParameterObject
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ParameterObject"
( \Object
x ->
Text -> [ParameterAttribute] -> ParameterObject
ParameterObject'
(Text -> [ParameterAttribute] -> ParameterObject)
-> Parser Text -> Parser ([ParameterAttribute] -> ParameterObject)
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
"id")
Parser ([ParameterAttribute] -> ParameterObject)
-> Parser [ParameterAttribute] -> Parser ParameterObject
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [ParameterAttribute])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"attributes" Parser (Maybe [ParameterAttribute])
-> [ParameterAttribute] -> Parser [ParameterAttribute]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [ParameterAttribute]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ParameterObject
instance Prelude.NFData ParameterObject
instance Core.ToJSON ParameterObject where
toJSON :: ParameterObject -> Value
toJSON ParameterObject' {[ParameterAttribute]
Text
attributes :: [ParameterAttribute]
id :: Text
$sel:attributes:ParameterObject' :: ParameterObject -> [ParameterAttribute]
$sel:id:ParameterObject' :: ParameterObject -> 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
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"attributes" Text -> [ParameterAttribute] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [ParameterAttribute]
attributes)
]
)