{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Batch.Types.NodePropertiesSummary
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Batch.Types.NodePropertiesSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object representing the properties of a node that\'s associated with
-- a multi-node parallel job.
--
-- /See:/ 'newNodePropertiesSummary' smart constructor.
data NodePropertiesSummary = NodePropertiesSummary'
  { -- | The number of nodes associated with a multi-node parallel job.
    NodePropertiesSummary -> Maybe Int
numNodes :: Prelude.Maybe Prelude.Int,
    -- | The node index for the node. Node index numbering begins at zero. This
    -- index is also available on the node with the @AWS_BATCH_JOB_NODE_INDEX@
    -- environment variable.
    NodePropertiesSummary -> Maybe Int
nodeIndex :: Prelude.Maybe Prelude.Int,
    -- | Specifies whether the current node is the main node for a multi-node
    -- parallel job.
    NodePropertiesSummary -> Maybe Bool
isMainNode :: Prelude.Maybe Prelude.Bool
  }
  deriving (NodePropertiesSummary -> NodePropertiesSummary -> Bool
(NodePropertiesSummary -> NodePropertiesSummary -> Bool)
-> (NodePropertiesSummary -> NodePropertiesSummary -> Bool)
-> Eq NodePropertiesSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodePropertiesSummary -> NodePropertiesSummary -> Bool
$c/= :: NodePropertiesSummary -> NodePropertiesSummary -> Bool
== :: NodePropertiesSummary -> NodePropertiesSummary -> Bool
$c== :: NodePropertiesSummary -> NodePropertiesSummary -> Bool
Prelude.Eq, ReadPrec [NodePropertiesSummary]
ReadPrec NodePropertiesSummary
Int -> ReadS NodePropertiesSummary
ReadS [NodePropertiesSummary]
(Int -> ReadS NodePropertiesSummary)
-> ReadS [NodePropertiesSummary]
-> ReadPrec NodePropertiesSummary
-> ReadPrec [NodePropertiesSummary]
-> Read NodePropertiesSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodePropertiesSummary]
$creadListPrec :: ReadPrec [NodePropertiesSummary]
readPrec :: ReadPrec NodePropertiesSummary
$creadPrec :: ReadPrec NodePropertiesSummary
readList :: ReadS [NodePropertiesSummary]
$creadList :: ReadS [NodePropertiesSummary]
readsPrec :: Int -> ReadS NodePropertiesSummary
$creadsPrec :: Int -> ReadS NodePropertiesSummary
Prelude.Read, Int -> NodePropertiesSummary -> ShowS
[NodePropertiesSummary] -> ShowS
NodePropertiesSummary -> String
(Int -> NodePropertiesSummary -> ShowS)
-> (NodePropertiesSummary -> String)
-> ([NodePropertiesSummary] -> ShowS)
-> Show NodePropertiesSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodePropertiesSummary] -> ShowS
$cshowList :: [NodePropertiesSummary] -> ShowS
show :: NodePropertiesSummary -> String
$cshow :: NodePropertiesSummary -> String
showsPrec :: Int -> NodePropertiesSummary -> ShowS
$cshowsPrec :: Int -> NodePropertiesSummary -> ShowS
Prelude.Show, (forall x. NodePropertiesSummary -> Rep NodePropertiesSummary x)
-> (forall x. Rep NodePropertiesSummary x -> NodePropertiesSummary)
-> Generic NodePropertiesSummary
forall x. Rep NodePropertiesSummary x -> NodePropertiesSummary
forall x. NodePropertiesSummary -> Rep NodePropertiesSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodePropertiesSummary x -> NodePropertiesSummary
$cfrom :: forall x. NodePropertiesSummary -> Rep NodePropertiesSummary x
Prelude.Generic)

-- |
-- Create a value of 'NodePropertiesSummary' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'numNodes', 'nodePropertiesSummary_numNodes' - The number of nodes associated with a multi-node parallel job.
--
-- 'nodeIndex', 'nodePropertiesSummary_nodeIndex' - The node index for the node. Node index numbering begins at zero. This
-- index is also available on the node with the @AWS_BATCH_JOB_NODE_INDEX@
-- environment variable.
--
-- 'isMainNode', 'nodePropertiesSummary_isMainNode' - Specifies whether the current node is the main node for a multi-node
-- parallel job.
newNodePropertiesSummary ::
  NodePropertiesSummary
newNodePropertiesSummary :: NodePropertiesSummary
newNodePropertiesSummary =
  NodePropertiesSummary' :: Maybe Int -> Maybe Int -> Maybe Bool -> NodePropertiesSummary
NodePropertiesSummary'
    { $sel:numNodes:NodePropertiesSummary' :: Maybe Int
numNodes = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeIndex:NodePropertiesSummary' :: Maybe Int
nodeIndex = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:isMainNode:NodePropertiesSummary' :: Maybe Bool
isMainNode = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of nodes associated with a multi-node parallel job.
nodePropertiesSummary_numNodes :: Lens.Lens' NodePropertiesSummary (Prelude.Maybe Prelude.Int)
nodePropertiesSummary_numNodes :: (Maybe Int -> f (Maybe Int))
-> NodePropertiesSummary -> f NodePropertiesSummary
nodePropertiesSummary_numNodes = (NodePropertiesSummary -> Maybe Int)
-> (NodePropertiesSummary -> Maybe Int -> NodePropertiesSummary)
-> Lens
     NodePropertiesSummary NodePropertiesSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodePropertiesSummary' {Maybe Int
numNodes :: Maybe Int
$sel:numNodes:NodePropertiesSummary' :: NodePropertiesSummary -> Maybe Int
numNodes} -> Maybe Int
numNodes) (\s :: NodePropertiesSummary
s@NodePropertiesSummary' {} Maybe Int
a -> NodePropertiesSummary
s {$sel:numNodes:NodePropertiesSummary' :: Maybe Int
numNodes = Maybe Int
a} :: NodePropertiesSummary)

-- | The node index for the node. Node index numbering begins at zero. This
-- index is also available on the node with the @AWS_BATCH_JOB_NODE_INDEX@
-- environment variable.
nodePropertiesSummary_nodeIndex :: Lens.Lens' NodePropertiesSummary (Prelude.Maybe Prelude.Int)
nodePropertiesSummary_nodeIndex :: (Maybe Int -> f (Maybe Int))
-> NodePropertiesSummary -> f NodePropertiesSummary
nodePropertiesSummary_nodeIndex = (NodePropertiesSummary -> Maybe Int)
-> (NodePropertiesSummary -> Maybe Int -> NodePropertiesSummary)
-> Lens
     NodePropertiesSummary NodePropertiesSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodePropertiesSummary' {Maybe Int
nodeIndex :: Maybe Int
$sel:nodeIndex:NodePropertiesSummary' :: NodePropertiesSummary -> Maybe Int
nodeIndex} -> Maybe Int
nodeIndex) (\s :: NodePropertiesSummary
s@NodePropertiesSummary' {} Maybe Int
a -> NodePropertiesSummary
s {$sel:nodeIndex:NodePropertiesSummary' :: Maybe Int
nodeIndex = Maybe Int
a} :: NodePropertiesSummary)

-- | Specifies whether the current node is the main node for a multi-node
-- parallel job.
nodePropertiesSummary_isMainNode :: Lens.Lens' NodePropertiesSummary (Prelude.Maybe Prelude.Bool)
nodePropertiesSummary_isMainNode :: (Maybe Bool -> f (Maybe Bool))
-> NodePropertiesSummary -> f NodePropertiesSummary
nodePropertiesSummary_isMainNode = (NodePropertiesSummary -> Maybe Bool)
-> (NodePropertiesSummary -> Maybe Bool -> NodePropertiesSummary)
-> Lens
     NodePropertiesSummary
     NodePropertiesSummary
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodePropertiesSummary' {Maybe Bool
isMainNode :: Maybe Bool
$sel:isMainNode:NodePropertiesSummary' :: NodePropertiesSummary -> Maybe Bool
isMainNode} -> Maybe Bool
isMainNode) (\s :: NodePropertiesSummary
s@NodePropertiesSummary' {} Maybe Bool
a -> NodePropertiesSummary
s {$sel:isMainNode:NodePropertiesSummary' :: Maybe Bool
isMainNode = Maybe Bool
a} :: NodePropertiesSummary)

instance Core.FromJSON NodePropertiesSummary where
  parseJSON :: Value -> Parser NodePropertiesSummary
parseJSON =
    String
-> (Object -> Parser NodePropertiesSummary)
-> Value
-> Parser NodePropertiesSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodePropertiesSummary"
      ( \Object
x ->
          Maybe Int -> Maybe Int -> Maybe Bool -> NodePropertiesSummary
NodePropertiesSummary'
            (Maybe Int -> Maybe Int -> Maybe Bool -> NodePropertiesSummary)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Bool -> NodePropertiesSummary)
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
"numNodes")
            Parser (Maybe Int -> Maybe Bool -> NodePropertiesSummary)
-> Parser (Maybe Int)
-> Parser (Maybe Bool -> NodePropertiesSummary)
forall (f :: * -> *) a b. Applicative f => 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
"nodeIndex")
            Parser (Maybe Bool -> NodePropertiesSummary)
-> Parser (Maybe Bool) -> Parser NodePropertiesSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"isMainNode")
      )

instance Prelude.Hashable NodePropertiesSummary

instance Prelude.NFData NodePropertiesSummary