{-# 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.PipelineObject 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.Field
import qualified Amazonka.Prelude as Prelude
data PipelineObject = PipelineObject'
{
PipelineObject -> Text
id :: Prelude.Text,
PipelineObject -> Text
name :: Prelude.Text,
PipelineObject -> [Field]
fields :: [Field]
}
deriving (PipelineObject -> PipelineObject -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineObject -> PipelineObject -> Bool
$c/= :: PipelineObject -> PipelineObject -> Bool
== :: PipelineObject -> PipelineObject -> Bool
$c== :: PipelineObject -> PipelineObject -> Bool
Prelude.Eq, ReadPrec [PipelineObject]
ReadPrec PipelineObject
Int -> ReadS PipelineObject
ReadS [PipelineObject]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipelineObject]
$creadListPrec :: ReadPrec [PipelineObject]
readPrec :: ReadPrec PipelineObject
$creadPrec :: ReadPrec PipelineObject
readList :: ReadS [PipelineObject]
$creadList :: ReadS [PipelineObject]
readsPrec :: Int -> ReadS PipelineObject
$creadsPrec :: Int -> ReadS PipelineObject
Prelude.Read, Int -> PipelineObject -> ShowS
[PipelineObject] -> ShowS
PipelineObject -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipelineObject] -> ShowS
$cshowList :: [PipelineObject] -> ShowS
show :: PipelineObject -> String
$cshow :: PipelineObject -> String
showsPrec :: Int -> PipelineObject -> ShowS
$cshowsPrec :: Int -> PipelineObject -> ShowS
Prelude.Show, forall x. Rep PipelineObject x -> PipelineObject
forall x. PipelineObject -> Rep PipelineObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PipelineObject x -> PipelineObject
$cfrom :: forall x. PipelineObject -> Rep PipelineObject x
Prelude.Generic)
newPipelineObject ::
Prelude.Text ->
Prelude.Text ->
PipelineObject
newPipelineObject :: Text -> Text -> PipelineObject
newPipelineObject Text
pId_ Text
pName_ =
PipelineObject'
{ $sel:id:PipelineObject' :: Text
id = Text
pId_,
$sel:name:PipelineObject' :: Text
name = Text
pName_,
$sel:fields:PipelineObject' :: [Field]
fields = forall a. Monoid a => a
Prelude.mempty
}
pipelineObject_id :: Lens.Lens' PipelineObject Prelude.Text
pipelineObject_id :: Lens' PipelineObject Text
pipelineObject_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineObject' {Text
id :: Text
$sel:id:PipelineObject' :: PipelineObject -> Text
id} -> Text
id) (\s :: PipelineObject
s@PipelineObject' {} Text
a -> PipelineObject
s {$sel:id:PipelineObject' :: Text
id = Text
a} :: PipelineObject)
pipelineObject_name :: Lens.Lens' PipelineObject Prelude.Text
pipelineObject_name :: Lens' PipelineObject Text
pipelineObject_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineObject' {Text
name :: Text
$sel:name:PipelineObject' :: PipelineObject -> Text
name} -> Text
name) (\s :: PipelineObject
s@PipelineObject' {} Text
a -> PipelineObject
s {$sel:name:PipelineObject' :: Text
name = Text
a} :: PipelineObject)
pipelineObject_fields :: Lens.Lens' PipelineObject [Field]
pipelineObject_fields :: Lens' PipelineObject [Field]
pipelineObject_fields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineObject' {[Field]
fields :: [Field]
$sel:fields:PipelineObject' :: PipelineObject -> [Field]
fields} -> [Field]
fields) (\s :: PipelineObject
s@PipelineObject' {} [Field]
a -> PipelineObject
s {$sel:fields:PipelineObject' :: [Field]
fields = [Field]
a} :: PipelineObject) 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 PipelineObject where
parseJSON :: Value -> Parser PipelineObject
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PipelineObject"
( \Object
x ->
Text -> Text -> [Field] -> PipelineObject
PipelineObject'
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 a
Data..: Key
"name")
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
"fields" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable PipelineObject where
hashWithSalt :: Int -> PipelineObject -> Int
hashWithSalt Int
_salt PipelineObject' {[Field]
Text
fields :: [Field]
name :: Text
id :: Text
$sel:fields:PipelineObject' :: PipelineObject -> [Field]
$sel:name:PipelineObject' :: PipelineObject -> Text
$sel:id:PipelineObject' :: PipelineObject -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Field]
fields
instance Prelude.NFData PipelineObject where
rnf :: PipelineObject -> ()
rnf PipelineObject' {[Field]
Text
fields :: [Field]
name :: Text
id :: Text
$sel:fields:PipelineObject' :: PipelineObject -> [Field]
$sel:name:PipelineObject' :: PipelineObject -> Text
$sel:id:PipelineObject' :: PipelineObject -> 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 Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Field]
fields
instance Data.ToJSON PipelineObject where
toJSON :: PipelineObject -> Value
toJSON PipelineObject' {[Field]
Text
fields :: [Field]
name :: Text
id :: Text
$sel:fields:PipelineObject' :: PipelineObject -> [Field]
$sel:name:PipelineObject' :: PipelineObject -> Text
$sel:id:PipelineObject' :: PipelineObject -> 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
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"fields" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Field]
fields)
]
)