{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Batch.Types.NodePropertiesSummary where

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

-- | An object that represents the properties of a node that\'s associated
-- with a multi-node parallel job.
--
-- /See:/ 'newNodePropertiesSummary' smart constructor.
data NodePropertiesSummary = NodePropertiesSummary'
  { -- | Specifies whether the current node is the main node for a multi-node
    -- parallel job.
    NodePropertiesSummary -> Maybe Bool
isMainNode :: Prelude.Maybe Prelude.Bool,
    -- | 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,
    -- | The number of nodes that are associated with a multi-node parallel job.
    NodePropertiesSummary -> Maybe Int
numNodes :: Prelude.Maybe Prelude.Int
  }
  deriving (NodePropertiesSummary -> NodePropertiesSummary -> Bool
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]
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
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. 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:
--
-- 'isMainNode', 'nodePropertiesSummary_isMainNode' - Specifies whether the current node is the main node for 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.
--
-- 'numNodes', 'nodePropertiesSummary_numNodes' - The number of nodes that are associated with a multi-node parallel job.
newNodePropertiesSummary ::
  NodePropertiesSummary
newNodePropertiesSummary :: NodePropertiesSummary
newNodePropertiesSummary =
  NodePropertiesSummary'
    { $sel:isMainNode:NodePropertiesSummary' :: Maybe Bool
isMainNode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nodeIndex:NodePropertiesSummary' :: Maybe Int
nodeIndex = forall a. Maybe a
Prelude.Nothing,
      $sel:numNodes:NodePropertiesSummary' :: Maybe Int
numNodes = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' NodePropertiesSummary (Maybe Bool)
nodePropertiesSummary_isMainNode = 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)

-- | 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 :: Lens' NodePropertiesSummary (Maybe Int)
nodePropertiesSummary_nodeIndex = 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)

-- | The number of nodes that are associated with a multi-node parallel job.
nodePropertiesSummary_numNodes :: Lens.Lens' NodePropertiesSummary (Prelude.Maybe Prelude.Int)
nodePropertiesSummary_numNodes :: Lens' NodePropertiesSummary (Maybe Int)
nodePropertiesSummary_numNodes = 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)

instance Data.FromJSON NodePropertiesSummary where
  parseJSON :: Value -> Parser NodePropertiesSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NodePropertiesSummary"
      ( \Object
x ->
          Maybe Bool -> Maybe Int -> Maybe Int -> NodePropertiesSummary
NodePropertiesSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"isMainNode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"nodeIndex")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"numNodes")
      )

instance Prelude.Hashable NodePropertiesSummary where
  hashWithSalt :: Int -> NodePropertiesSummary -> Int
hashWithSalt Int
_salt NodePropertiesSummary' {Maybe Bool
Maybe Int
numNodes :: Maybe Int
nodeIndex :: Maybe Int
isMainNode :: Maybe Bool
$sel:numNodes:NodePropertiesSummary' :: NodePropertiesSummary -> Maybe Int
$sel:nodeIndex:NodePropertiesSummary' :: NodePropertiesSummary -> Maybe Int
$sel:isMainNode:NodePropertiesSummary' :: NodePropertiesSummary -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isMainNode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
nodeIndex
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
numNodes

instance Prelude.NFData NodePropertiesSummary where
  rnf :: NodePropertiesSummary -> ()
rnf NodePropertiesSummary' {Maybe Bool
Maybe Int
numNodes :: Maybe Int
nodeIndex :: Maybe Int
isMainNode :: Maybe Bool
$sel:numNodes:NodePropertiesSummary' :: NodePropertiesSummary -> Maybe Int
$sel:nodeIndex:NodePropertiesSummary' :: NodePropertiesSummary -> Maybe Int
$sel:isMainNode:NodePropertiesSummary' :: NodePropertiesSummary -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isMainNode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
nodeIndex
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
numNodes