{-# 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.NodeRangeProperty where
import Amazonka.Batch.Types.ContainerProperties
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data NodeRangeProperty = NodeRangeProperty'
{
NodeRangeProperty -> Maybe ContainerProperties
container :: Prelude.Maybe ContainerProperties,
NodeRangeProperty -> Text
targetNodes :: Prelude.Text
}
deriving (NodeRangeProperty -> NodeRangeProperty -> Bool
(NodeRangeProperty -> NodeRangeProperty -> Bool)
-> (NodeRangeProperty -> NodeRangeProperty -> Bool)
-> Eq NodeRangeProperty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeRangeProperty -> NodeRangeProperty -> Bool
$c/= :: NodeRangeProperty -> NodeRangeProperty -> Bool
== :: NodeRangeProperty -> NodeRangeProperty -> Bool
$c== :: NodeRangeProperty -> NodeRangeProperty -> Bool
Prelude.Eq, ReadPrec [NodeRangeProperty]
ReadPrec NodeRangeProperty
Int -> ReadS NodeRangeProperty
ReadS [NodeRangeProperty]
(Int -> ReadS NodeRangeProperty)
-> ReadS [NodeRangeProperty]
-> ReadPrec NodeRangeProperty
-> ReadPrec [NodeRangeProperty]
-> Read NodeRangeProperty
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeRangeProperty]
$creadListPrec :: ReadPrec [NodeRangeProperty]
readPrec :: ReadPrec NodeRangeProperty
$creadPrec :: ReadPrec NodeRangeProperty
readList :: ReadS [NodeRangeProperty]
$creadList :: ReadS [NodeRangeProperty]
readsPrec :: Int -> ReadS NodeRangeProperty
$creadsPrec :: Int -> ReadS NodeRangeProperty
Prelude.Read, Int -> NodeRangeProperty -> ShowS
[NodeRangeProperty] -> ShowS
NodeRangeProperty -> String
(Int -> NodeRangeProperty -> ShowS)
-> (NodeRangeProperty -> String)
-> ([NodeRangeProperty] -> ShowS)
-> Show NodeRangeProperty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeRangeProperty] -> ShowS
$cshowList :: [NodeRangeProperty] -> ShowS
show :: NodeRangeProperty -> String
$cshow :: NodeRangeProperty -> String
showsPrec :: Int -> NodeRangeProperty -> ShowS
$cshowsPrec :: Int -> NodeRangeProperty -> ShowS
Prelude.Show, (forall x. NodeRangeProperty -> Rep NodeRangeProperty x)
-> (forall x. Rep NodeRangeProperty x -> NodeRangeProperty)
-> Generic NodeRangeProperty
forall x. Rep NodeRangeProperty x -> NodeRangeProperty
forall x. NodeRangeProperty -> Rep NodeRangeProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeRangeProperty x -> NodeRangeProperty
$cfrom :: forall x. NodeRangeProperty -> Rep NodeRangeProperty x
Prelude.Generic)
newNodeRangeProperty ::
Prelude.Text ->
NodeRangeProperty
newNodeRangeProperty :: Text -> NodeRangeProperty
newNodeRangeProperty Text
pTargetNodes_ =
NodeRangeProperty' :: Maybe ContainerProperties -> Text -> NodeRangeProperty
NodeRangeProperty'
{ $sel:container:NodeRangeProperty' :: Maybe ContainerProperties
container = Maybe ContainerProperties
forall a. Maybe a
Prelude.Nothing,
$sel:targetNodes:NodeRangeProperty' :: Text
targetNodes = Text
pTargetNodes_
}
nodeRangeProperty_container :: Lens.Lens' NodeRangeProperty (Prelude.Maybe ContainerProperties)
nodeRangeProperty_container :: (Maybe ContainerProperties -> f (Maybe ContainerProperties))
-> NodeRangeProperty -> f NodeRangeProperty
nodeRangeProperty_container = (NodeRangeProperty -> Maybe ContainerProperties)
-> (NodeRangeProperty
-> Maybe ContainerProperties -> NodeRangeProperty)
-> Lens
NodeRangeProperty
NodeRangeProperty
(Maybe ContainerProperties)
(Maybe ContainerProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeRangeProperty' {Maybe ContainerProperties
container :: Maybe ContainerProperties
$sel:container:NodeRangeProperty' :: NodeRangeProperty -> Maybe ContainerProperties
container} -> Maybe ContainerProperties
container) (\s :: NodeRangeProperty
s@NodeRangeProperty' {} Maybe ContainerProperties
a -> NodeRangeProperty
s {$sel:container:NodeRangeProperty' :: Maybe ContainerProperties
container = Maybe ContainerProperties
a} :: NodeRangeProperty)
nodeRangeProperty_targetNodes :: Lens.Lens' NodeRangeProperty Prelude.Text
nodeRangeProperty_targetNodes :: (Text -> f Text) -> NodeRangeProperty -> f NodeRangeProperty
nodeRangeProperty_targetNodes = (NodeRangeProperty -> Text)
-> (NodeRangeProperty -> Text -> NodeRangeProperty)
-> Lens NodeRangeProperty NodeRangeProperty Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeRangeProperty' {Text
targetNodes :: Text
$sel:targetNodes:NodeRangeProperty' :: NodeRangeProperty -> Text
targetNodes} -> Text
targetNodes) (\s :: NodeRangeProperty
s@NodeRangeProperty' {} Text
a -> NodeRangeProperty
s {$sel:targetNodes:NodeRangeProperty' :: Text
targetNodes = Text
a} :: NodeRangeProperty)
instance Core.FromJSON NodeRangeProperty where
parseJSON :: Value -> Parser NodeRangeProperty
parseJSON =
String
-> (Object -> Parser NodeRangeProperty)
-> Value
-> Parser NodeRangeProperty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"NodeRangeProperty"
( \Object
x ->
Maybe ContainerProperties -> Text -> NodeRangeProperty
NodeRangeProperty'
(Maybe ContainerProperties -> Text -> NodeRangeProperty)
-> Parser (Maybe ContainerProperties)
-> Parser (Text -> NodeRangeProperty)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ContainerProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"container")
Parser (Text -> NodeRangeProperty)
-> Parser Text -> Parser NodeRangeProperty
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
"targetNodes")
)
instance Prelude.Hashable NodeRangeProperty
instance Prelude.NFData NodeRangeProperty
instance Core.ToJSON NodeRangeProperty where
toJSON :: NodeRangeProperty -> Value
toJSON NodeRangeProperty' {Maybe ContainerProperties
Text
targetNodes :: Text
container :: Maybe ContainerProperties
$sel:targetNodes:NodeRangeProperty' :: NodeRangeProperty -> Text
$sel:container:NodeRangeProperty' :: NodeRangeProperty -> Maybe ContainerProperties
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"container" Text -> ContainerProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ContainerProperties -> Pair)
-> Maybe ContainerProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContainerProperties
container,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"targetNodes" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetNodes)
]
)