{-# 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.Glue.Types.CodeGenNode where
import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.CodeGenNodeArg
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CodeGenNode = CodeGenNode'
{
CodeGenNode -> Maybe Int
lineNumber :: Prelude.Maybe Prelude.Int,
CodeGenNode -> Text
id :: Prelude.Text,
CodeGenNode -> Text
nodeType :: Prelude.Text,
CodeGenNode -> [CodeGenNodeArg]
args :: [CodeGenNodeArg]
}
deriving (CodeGenNode -> CodeGenNode -> Bool
(CodeGenNode -> CodeGenNode -> Bool)
-> (CodeGenNode -> CodeGenNode -> Bool) -> Eq CodeGenNode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeGenNode -> CodeGenNode -> Bool
$c/= :: CodeGenNode -> CodeGenNode -> Bool
== :: CodeGenNode -> CodeGenNode -> Bool
$c== :: CodeGenNode -> CodeGenNode -> Bool
Prelude.Eq, ReadPrec [CodeGenNode]
ReadPrec CodeGenNode
Int -> ReadS CodeGenNode
ReadS [CodeGenNode]
(Int -> ReadS CodeGenNode)
-> ReadS [CodeGenNode]
-> ReadPrec CodeGenNode
-> ReadPrec [CodeGenNode]
-> Read CodeGenNode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeGenNode]
$creadListPrec :: ReadPrec [CodeGenNode]
readPrec :: ReadPrec CodeGenNode
$creadPrec :: ReadPrec CodeGenNode
readList :: ReadS [CodeGenNode]
$creadList :: ReadS [CodeGenNode]
readsPrec :: Int -> ReadS CodeGenNode
$creadsPrec :: Int -> ReadS CodeGenNode
Prelude.Read, Int -> CodeGenNode -> ShowS
[CodeGenNode] -> ShowS
CodeGenNode -> String
(Int -> CodeGenNode -> ShowS)
-> (CodeGenNode -> String)
-> ([CodeGenNode] -> ShowS)
-> Show CodeGenNode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeGenNode] -> ShowS
$cshowList :: [CodeGenNode] -> ShowS
show :: CodeGenNode -> String
$cshow :: CodeGenNode -> String
showsPrec :: Int -> CodeGenNode -> ShowS
$cshowsPrec :: Int -> CodeGenNode -> ShowS
Prelude.Show, (forall x. CodeGenNode -> Rep CodeGenNode x)
-> (forall x. Rep CodeGenNode x -> CodeGenNode)
-> Generic CodeGenNode
forall x. Rep CodeGenNode x -> CodeGenNode
forall x. CodeGenNode -> Rep CodeGenNode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeGenNode x -> CodeGenNode
$cfrom :: forall x. CodeGenNode -> Rep CodeGenNode x
Prelude.Generic)
newCodeGenNode ::
Prelude.Text ->
Prelude.Text ->
CodeGenNode
newCodeGenNode :: Text -> Text -> CodeGenNode
newCodeGenNode Text
pId_ Text
pNodeType_ =
CodeGenNode' :: Maybe Int -> Text -> Text -> [CodeGenNodeArg] -> CodeGenNode
CodeGenNode'
{ $sel:lineNumber:CodeGenNode' :: Maybe Int
lineNumber = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:id:CodeGenNode' :: Text
id = Text
pId_,
$sel:nodeType:CodeGenNode' :: Text
nodeType = Text
pNodeType_,
$sel:args:CodeGenNode' :: [CodeGenNodeArg]
args = [CodeGenNodeArg]
forall a. Monoid a => a
Prelude.mempty
}
codeGenNode_lineNumber :: Lens.Lens' CodeGenNode (Prelude.Maybe Prelude.Int)
codeGenNode_lineNumber :: (Maybe Int -> f (Maybe Int)) -> CodeGenNode -> f CodeGenNode
codeGenNode_lineNumber = (CodeGenNode -> Maybe Int)
-> (CodeGenNode -> Maybe Int -> CodeGenNode)
-> Lens CodeGenNode CodeGenNode (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeGenNode' {Maybe Int
lineNumber :: Maybe Int
$sel:lineNumber:CodeGenNode' :: CodeGenNode -> Maybe Int
lineNumber} -> Maybe Int
lineNumber) (\s :: CodeGenNode
s@CodeGenNode' {} Maybe Int
a -> CodeGenNode
s {$sel:lineNumber:CodeGenNode' :: Maybe Int
lineNumber = Maybe Int
a} :: CodeGenNode)
codeGenNode_id :: Lens.Lens' CodeGenNode Prelude.Text
codeGenNode_id :: (Text -> f Text) -> CodeGenNode -> f CodeGenNode
codeGenNode_id = (CodeGenNode -> Text)
-> (CodeGenNode -> Text -> CodeGenNode)
-> Lens CodeGenNode CodeGenNode Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeGenNode' {Text
id :: Text
$sel:id:CodeGenNode' :: CodeGenNode -> Text
id} -> Text
id) (\s :: CodeGenNode
s@CodeGenNode' {} Text
a -> CodeGenNode
s {$sel:id:CodeGenNode' :: Text
id = Text
a} :: CodeGenNode)
codeGenNode_nodeType :: Lens.Lens' CodeGenNode Prelude.Text
codeGenNode_nodeType :: (Text -> f Text) -> CodeGenNode -> f CodeGenNode
codeGenNode_nodeType = (CodeGenNode -> Text)
-> (CodeGenNode -> Text -> CodeGenNode)
-> Lens CodeGenNode CodeGenNode Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeGenNode' {Text
nodeType :: Text
$sel:nodeType:CodeGenNode' :: CodeGenNode -> Text
nodeType} -> Text
nodeType) (\s :: CodeGenNode
s@CodeGenNode' {} Text
a -> CodeGenNode
s {$sel:nodeType:CodeGenNode' :: Text
nodeType = Text
a} :: CodeGenNode)
codeGenNode_args :: Lens.Lens' CodeGenNode [CodeGenNodeArg]
codeGenNode_args :: ([CodeGenNodeArg] -> f [CodeGenNodeArg])
-> CodeGenNode -> f CodeGenNode
codeGenNode_args = (CodeGenNode -> [CodeGenNodeArg])
-> (CodeGenNode -> [CodeGenNodeArg] -> CodeGenNode)
-> Lens CodeGenNode CodeGenNode [CodeGenNodeArg] [CodeGenNodeArg]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeGenNode' {[CodeGenNodeArg]
args :: [CodeGenNodeArg]
$sel:args:CodeGenNode' :: CodeGenNode -> [CodeGenNodeArg]
args} -> [CodeGenNodeArg]
args) (\s :: CodeGenNode
s@CodeGenNode' {} [CodeGenNodeArg]
a -> CodeGenNode
s {$sel:args:CodeGenNode' :: [CodeGenNodeArg]
args = [CodeGenNodeArg]
a} :: CodeGenNode) (([CodeGenNodeArg] -> f [CodeGenNodeArg])
-> CodeGenNode -> f CodeGenNode)
-> (([CodeGenNodeArg] -> f [CodeGenNodeArg])
-> [CodeGenNodeArg] -> f [CodeGenNodeArg])
-> ([CodeGenNodeArg] -> f [CodeGenNodeArg])
-> CodeGenNode
-> f CodeGenNode
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([CodeGenNodeArg] -> f [CodeGenNodeArg])
-> [CodeGenNodeArg] -> f [CodeGenNodeArg]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON CodeGenNode where
parseJSON :: Value -> Parser CodeGenNode
parseJSON =
String
-> (Object -> Parser CodeGenNode) -> Value -> Parser CodeGenNode
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CodeGenNode"
( \Object
x ->
Maybe Int -> Text -> Text -> [CodeGenNodeArg] -> CodeGenNode
CodeGenNode'
(Maybe Int -> Text -> Text -> [CodeGenNodeArg] -> CodeGenNode)
-> Parser (Maybe Int)
-> Parser (Text -> Text -> [CodeGenNodeArg] -> CodeGenNode)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LineNumber")
Parser (Text -> Text -> [CodeGenNodeArg] -> CodeGenNode)
-> Parser Text -> Parser (Text -> [CodeGenNodeArg] -> CodeGenNode)
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
"Id")
Parser (Text -> [CodeGenNodeArg] -> CodeGenNode)
-> Parser Text -> Parser ([CodeGenNodeArg] -> CodeGenNode)
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
"NodeType")
Parser ([CodeGenNodeArg] -> CodeGenNode)
-> Parser [CodeGenNodeArg] -> Parser CodeGenNode
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [CodeGenNodeArg])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Args" Parser (Maybe [CodeGenNodeArg])
-> [CodeGenNodeArg] -> Parser [CodeGenNodeArg]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [CodeGenNodeArg]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable CodeGenNode
instance Prelude.NFData CodeGenNode
instance Core.ToJSON CodeGenNode where
toJSON :: CodeGenNode -> Value
toJSON CodeGenNode' {[CodeGenNodeArg]
Maybe Int
Text
args :: [CodeGenNodeArg]
nodeType :: Text
id :: Text
lineNumber :: Maybe Int
$sel:args:CodeGenNode' :: CodeGenNode -> [CodeGenNodeArg]
$sel:nodeType:CodeGenNode' :: CodeGenNode -> Text
$sel:id:CodeGenNode' :: CodeGenNode -> Text
$sel:lineNumber:CodeGenNode' :: CodeGenNode -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"LineNumber" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
lineNumber,
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
"NodeType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
nodeType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Args" Text -> [CodeGenNodeArg] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [CodeGenNodeArg]
args)
]
)