{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataPipeline.Types.ParameterAttribute
import qualified Amazonka.Prelude as Prelude
data ParameterObject = ParameterObject'
{
ParameterObject -> Text
id :: Prelude.Text,
ParameterObject -> [ParameterAttribute]
attributes :: [ParameterAttribute]
}
deriving (ParameterObject -> ParameterObject -> Bool
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]
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
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. 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'
{ $sel:id:ParameterObject' :: Text
id = Text
pId_,
$sel:attributes:ParameterObject' :: [ParameterAttribute]
attributes = forall a. Monoid a => a
Prelude.mempty
}
parameterObject_id :: Lens.Lens' ParameterObject Prelude.Text
parameterObject_id :: Lens' ParameterObject Text
parameterObject_id = 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 :: Lens' ParameterObject [ParameterAttribute]
parameterObject_attributes = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON ParameterObject where
parseJSON :: Value -> Parser ParameterObject
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ParameterObject"
( \Object
x ->
Text -> [ParameterAttribute] -> ParameterObject
ParameterObject'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"id")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"attributes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ParameterObject where
hashWithSalt :: Int -> ParameterObject -> Int
hashWithSalt Int
_salt ParameterObject' {[ParameterAttribute]
Text
attributes :: [ParameterAttribute]
id :: Text
$sel:attributes:ParameterObject' :: ParameterObject -> [ParameterAttribute]
$sel:id:ParameterObject' :: ParameterObject -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [ParameterAttribute]
attributes
instance Prelude.NFData ParameterObject where
rnf :: ParameterObject -> ()
rnf ParameterObject' {[ParameterAttribute]
Text
attributes :: [ParameterAttribute]
id :: Text
$sel:attributes:ParameterObject' :: ParameterObject -> [ParameterAttribute]
$sel:id:ParameterObject' :: ParameterObject -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
id seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ParameterAttribute]
attributes
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id),
forall a. a -> Maybe a
Prelude.Just (Key
"attributes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [ParameterAttribute]
attributes)
]
)