{-# 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 Amazonka.DataPipeline.Types.Field
import qualified Amazonka.Lens as Lens
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
(PipelineObject -> PipelineObject -> Bool)
-> (PipelineObject -> PipelineObject -> Bool) -> Eq PipelineObject
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]
(Int -> ReadS PipelineObject)
-> ReadS [PipelineObject]
-> ReadPrec PipelineObject
-> ReadPrec [PipelineObject]
-> Read 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
(Int -> PipelineObject -> ShowS)
-> (PipelineObject -> String)
-> ([PipelineObject] -> ShowS)
-> Show PipelineObject
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. PipelineObject -> Rep PipelineObject x)
-> (forall x. Rep PipelineObject x -> PipelineObject)
-> Generic PipelineObject
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' :: Text -> Text -> [Field] -> PipelineObject
PipelineObject'
{ $sel:id:PipelineObject' :: Text
id = Text
pId_,
$sel:name:PipelineObject' :: Text
name = Text
pName_,
$sel:fields:PipelineObject' :: [Field]
fields = [Field]
forall a. Monoid a => a
Prelude.mempty
}
pipelineObject_id :: Lens.Lens' PipelineObject Prelude.Text
pipelineObject_id :: (Text -> f Text) -> PipelineObject -> f PipelineObject
pipelineObject_id = (PipelineObject -> Text)
-> (PipelineObject -> Text -> PipelineObject)
-> Lens PipelineObject PipelineObject Text Text
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 :: (Text -> f Text) -> PipelineObject -> f PipelineObject
pipelineObject_name = (PipelineObject -> Text)
-> (PipelineObject -> Text -> PipelineObject)
-> Lens PipelineObject PipelineObject Text Text
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 :: ([Field] -> f [Field]) -> PipelineObject -> f PipelineObject
pipelineObject_fields = (PipelineObject -> [Field])
-> (PipelineObject -> [Field] -> PipelineObject)
-> Lens PipelineObject PipelineObject [Field] [Field]
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) (([Field] -> f [Field]) -> PipelineObject -> f PipelineObject)
-> (([Field] -> f [Field]) -> [Field] -> f [Field])
-> ([Field] -> f [Field])
-> PipelineObject
-> f PipelineObject
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Field] -> f [Field]) -> [Field] -> f [Field]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON PipelineObject where
parseJSON :: Value -> Parser PipelineObject
parseJSON =
String
-> (Object -> Parser PipelineObject)
-> Value
-> Parser PipelineObject
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PipelineObject"
( \Object
x ->
Text -> Text -> [Field] -> PipelineObject
PipelineObject'
(Text -> Text -> [Field] -> PipelineObject)
-> Parser Text -> Parser (Text -> [Field] -> PipelineObject)
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 (Text -> [Field] -> PipelineObject)
-> Parser Text -> Parser ([Field] -> PipelineObject)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
Parser ([Field] -> PipelineObject)
-> Parser [Field] -> Parser PipelineObject
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [Field])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fields" Parser (Maybe [Field]) -> [Field] -> Parser [Field]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Field]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable PipelineObject
instance Prelude.NFData PipelineObject
instance Core.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
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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"fields" Text -> [Field] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Field]
fields)
]
)