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