{-# 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.ArrayPropertiesSummary
-- 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.ArrayPropertiesSummary where

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

-- | An object representing the array properties of a job.
--
-- /See:/ 'newArrayPropertiesSummary' smart constructor.
data ArrayPropertiesSummary = ArrayPropertiesSummary'
  { -- | The size of the array job. This parameter is returned for parent array
    -- jobs.
    ArrayPropertiesSummary -> Maybe Int
size :: Prelude.Maybe Prelude.Int,
    -- | The job index within the array that\'s associated with this job. This
    -- parameter is returned for children of array jobs.
    ArrayPropertiesSummary -> Maybe Int
index :: Prelude.Maybe Prelude.Int
  }
  deriving (ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool
(ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool)
-> (ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool)
-> Eq ArrayPropertiesSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool
$c/= :: ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool
== :: ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool
$c== :: ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool
Prelude.Eq, ReadPrec [ArrayPropertiesSummary]
ReadPrec ArrayPropertiesSummary
Int -> ReadS ArrayPropertiesSummary
ReadS [ArrayPropertiesSummary]
(Int -> ReadS ArrayPropertiesSummary)
-> ReadS [ArrayPropertiesSummary]
-> ReadPrec ArrayPropertiesSummary
-> ReadPrec [ArrayPropertiesSummary]
-> Read ArrayPropertiesSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArrayPropertiesSummary]
$creadListPrec :: ReadPrec [ArrayPropertiesSummary]
readPrec :: ReadPrec ArrayPropertiesSummary
$creadPrec :: ReadPrec ArrayPropertiesSummary
readList :: ReadS [ArrayPropertiesSummary]
$creadList :: ReadS [ArrayPropertiesSummary]
readsPrec :: Int -> ReadS ArrayPropertiesSummary
$creadsPrec :: Int -> ReadS ArrayPropertiesSummary
Prelude.Read, Int -> ArrayPropertiesSummary -> ShowS
[ArrayPropertiesSummary] -> ShowS
ArrayPropertiesSummary -> String
(Int -> ArrayPropertiesSummary -> ShowS)
-> (ArrayPropertiesSummary -> String)
-> ([ArrayPropertiesSummary] -> ShowS)
-> Show ArrayPropertiesSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArrayPropertiesSummary] -> ShowS
$cshowList :: [ArrayPropertiesSummary] -> ShowS
show :: ArrayPropertiesSummary -> String
$cshow :: ArrayPropertiesSummary -> String
showsPrec :: Int -> ArrayPropertiesSummary -> ShowS
$cshowsPrec :: Int -> ArrayPropertiesSummary -> ShowS
Prelude.Show, (forall x. ArrayPropertiesSummary -> Rep ArrayPropertiesSummary x)
-> (forall x.
    Rep ArrayPropertiesSummary x -> ArrayPropertiesSummary)
-> Generic ArrayPropertiesSummary
forall x. Rep ArrayPropertiesSummary x -> ArrayPropertiesSummary
forall x. ArrayPropertiesSummary -> Rep ArrayPropertiesSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArrayPropertiesSummary x -> ArrayPropertiesSummary
$cfrom :: forall x. ArrayPropertiesSummary -> Rep ArrayPropertiesSummary x
Prelude.Generic)

-- |
-- Create a value of 'ArrayPropertiesSummary' 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:
--
-- 'size', 'arrayPropertiesSummary_size' - The size of the array job. This parameter is returned for parent array
-- jobs.
--
-- 'index', 'arrayPropertiesSummary_index' - The job index within the array that\'s associated with this job. This
-- parameter is returned for children of array jobs.
newArrayPropertiesSummary ::
  ArrayPropertiesSummary
newArrayPropertiesSummary :: ArrayPropertiesSummary
newArrayPropertiesSummary =
  ArrayPropertiesSummary' :: Maybe Int -> Maybe Int -> ArrayPropertiesSummary
ArrayPropertiesSummary'
    { $sel:size:ArrayPropertiesSummary' :: Maybe Int
size = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:index:ArrayPropertiesSummary' :: Maybe Int
index = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The size of the array job. This parameter is returned for parent array
-- jobs.
arrayPropertiesSummary_size :: Lens.Lens' ArrayPropertiesSummary (Prelude.Maybe Prelude.Int)
arrayPropertiesSummary_size :: (Maybe Int -> f (Maybe Int))
-> ArrayPropertiesSummary -> f ArrayPropertiesSummary
arrayPropertiesSummary_size = (ArrayPropertiesSummary -> Maybe Int)
-> (ArrayPropertiesSummary -> Maybe Int -> ArrayPropertiesSummary)
-> Lens
     ArrayPropertiesSummary
     ArrayPropertiesSummary
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArrayPropertiesSummary' {Maybe Int
size :: Maybe Int
$sel:size:ArrayPropertiesSummary' :: ArrayPropertiesSummary -> Maybe Int
size} -> Maybe Int
size) (\s :: ArrayPropertiesSummary
s@ArrayPropertiesSummary' {} Maybe Int
a -> ArrayPropertiesSummary
s {$sel:size:ArrayPropertiesSummary' :: Maybe Int
size = Maybe Int
a} :: ArrayPropertiesSummary)

-- | The job index within the array that\'s associated with this job. This
-- parameter is returned for children of array jobs.
arrayPropertiesSummary_index :: Lens.Lens' ArrayPropertiesSummary (Prelude.Maybe Prelude.Int)
arrayPropertiesSummary_index :: (Maybe Int -> f (Maybe Int))
-> ArrayPropertiesSummary -> f ArrayPropertiesSummary
arrayPropertiesSummary_index = (ArrayPropertiesSummary -> Maybe Int)
-> (ArrayPropertiesSummary -> Maybe Int -> ArrayPropertiesSummary)
-> Lens
     ArrayPropertiesSummary
     ArrayPropertiesSummary
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArrayPropertiesSummary' {Maybe Int
index :: Maybe Int
$sel:index:ArrayPropertiesSummary' :: ArrayPropertiesSummary -> Maybe Int
index} -> Maybe Int
index) (\s :: ArrayPropertiesSummary
s@ArrayPropertiesSummary' {} Maybe Int
a -> ArrayPropertiesSummary
s {$sel:index:ArrayPropertiesSummary' :: Maybe Int
index = Maybe Int
a} :: ArrayPropertiesSummary)

instance Core.FromJSON ArrayPropertiesSummary where
  parseJSON :: Value -> Parser ArrayPropertiesSummary
parseJSON =
    String
-> (Object -> Parser ArrayPropertiesSummary)
-> Value
-> Parser ArrayPropertiesSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ArrayPropertiesSummary"
      ( \Object
x ->
          Maybe Int -> Maybe Int -> ArrayPropertiesSummary
ArrayPropertiesSummary'
            (Maybe Int -> Maybe Int -> ArrayPropertiesSummary)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> ArrayPropertiesSummary)
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
"size") Parser (Maybe Int -> ArrayPropertiesSummary)
-> Parser (Maybe Int) -> Parser ArrayPropertiesSummary
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
"index")
      )

instance Prelude.Hashable ArrayPropertiesSummary

instance Prelude.NFData ArrayPropertiesSummary