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