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

import Amazonka.Batch.Types.EksAttemptContainerDetail
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 details of a job attempt for a job attempt
-- by an Amazon EKS container.
--
-- /See:/ 'newEksAttemptDetail' smart constructor.
data EksAttemptDetail = EksAttemptDetail'
  { -- | The details for the final status of the containers for this job attempt.
    EksAttemptDetail -> Maybe [EksAttemptContainerDetail]
containers :: Prelude.Maybe [EksAttemptContainerDetail],
    -- | The name of the node for this job attempt.
    EksAttemptDetail -> Maybe Text
nodeName :: Prelude.Maybe Prelude.Text,
    -- | The name of the pod for this job attempt.
    EksAttemptDetail -> Maybe Text
podName :: Prelude.Maybe Prelude.Text,
    -- | The Unix timestamp (in milliseconds) for when the attempt was started
    -- (when the attempt transitioned from the @STARTING@ state to the
    -- @RUNNING@ state).
    EksAttemptDetail -> Maybe Integer
startedAt :: Prelude.Maybe Prelude.Integer,
    -- | A short, human-readable string to provide additional details for the
    -- current status of the job attempt.
    EksAttemptDetail -> Maybe Text
statusReason :: Prelude.Maybe Prelude.Text,
    -- | The Unix timestamp (in milliseconds) for when the attempt was stopped.
    -- This happens when the attempt transitioned from the @RUNNING@ state to a
    -- terminal state, such as @SUCCEEDED@ or @FAILED@.
    EksAttemptDetail -> Maybe Integer
stoppedAt :: Prelude.Maybe Prelude.Integer
  }
  deriving (EksAttemptDetail -> EksAttemptDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EksAttemptDetail -> EksAttemptDetail -> Bool
$c/= :: EksAttemptDetail -> EksAttemptDetail -> Bool
== :: EksAttemptDetail -> EksAttemptDetail -> Bool
$c== :: EksAttemptDetail -> EksAttemptDetail -> Bool
Prelude.Eq, ReadPrec [EksAttemptDetail]
ReadPrec EksAttemptDetail
Int -> ReadS EksAttemptDetail
ReadS [EksAttemptDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EksAttemptDetail]
$creadListPrec :: ReadPrec [EksAttemptDetail]
readPrec :: ReadPrec EksAttemptDetail
$creadPrec :: ReadPrec EksAttemptDetail
readList :: ReadS [EksAttemptDetail]
$creadList :: ReadS [EksAttemptDetail]
readsPrec :: Int -> ReadS EksAttemptDetail
$creadsPrec :: Int -> ReadS EksAttemptDetail
Prelude.Read, Int -> EksAttemptDetail -> ShowS
[EksAttemptDetail] -> ShowS
EksAttemptDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EksAttemptDetail] -> ShowS
$cshowList :: [EksAttemptDetail] -> ShowS
show :: EksAttemptDetail -> String
$cshow :: EksAttemptDetail -> String
showsPrec :: Int -> EksAttemptDetail -> ShowS
$cshowsPrec :: Int -> EksAttemptDetail -> ShowS
Prelude.Show, forall x. Rep EksAttemptDetail x -> EksAttemptDetail
forall x. EksAttemptDetail -> Rep EksAttemptDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EksAttemptDetail x -> EksAttemptDetail
$cfrom :: forall x. EksAttemptDetail -> Rep EksAttemptDetail x
Prelude.Generic)

-- |
-- Create a value of 'EksAttemptDetail' 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:
--
-- 'containers', 'eksAttemptDetail_containers' - The details for the final status of the containers for this job attempt.
--
-- 'nodeName', 'eksAttemptDetail_nodeName' - The name of the node for this job attempt.
--
-- 'podName', 'eksAttemptDetail_podName' - The name of the pod for this job attempt.
--
-- 'startedAt', 'eksAttemptDetail_startedAt' - The Unix timestamp (in milliseconds) for when the attempt was started
-- (when the attempt transitioned from the @STARTING@ state to the
-- @RUNNING@ state).
--
-- 'statusReason', 'eksAttemptDetail_statusReason' - A short, human-readable string to provide additional details for the
-- current status of the job attempt.
--
-- 'stoppedAt', 'eksAttemptDetail_stoppedAt' - The Unix timestamp (in milliseconds) for when the attempt was stopped.
-- This happens when the attempt transitioned from the @RUNNING@ state to a
-- terminal state, such as @SUCCEEDED@ or @FAILED@.
newEksAttemptDetail ::
  EksAttemptDetail
newEksAttemptDetail :: EksAttemptDetail
newEksAttemptDetail =
  EksAttemptDetail'
    { $sel:containers:EksAttemptDetail' :: Maybe [EksAttemptContainerDetail]
containers = forall a. Maybe a
Prelude.Nothing,
      $sel:nodeName:EksAttemptDetail' :: Maybe Text
nodeName = forall a. Maybe a
Prelude.Nothing,
      $sel:podName:EksAttemptDetail' :: Maybe Text
podName = forall a. Maybe a
Prelude.Nothing,
      $sel:startedAt:EksAttemptDetail' :: Maybe Integer
startedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:statusReason:EksAttemptDetail' :: Maybe Text
statusReason = forall a. Maybe a
Prelude.Nothing,
      $sel:stoppedAt:EksAttemptDetail' :: Maybe Integer
stoppedAt = forall a. Maybe a
Prelude.Nothing
    }

-- | The details for the final status of the containers for this job attempt.
eksAttemptDetail_containers :: Lens.Lens' EksAttemptDetail (Prelude.Maybe [EksAttemptContainerDetail])
eksAttemptDetail_containers :: Lens' EksAttemptDetail (Maybe [EksAttemptContainerDetail])
eksAttemptDetail_containers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksAttemptDetail' {Maybe [EksAttemptContainerDetail]
containers :: Maybe [EksAttemptContainerDetail]
$sel:containers:EksAttemptDetail' :: EksAttemptDetail -> Maybe [EksAttemptContainerDetail]
containers} -> Maybe [EksAttemptContainerDetail]
containers) (\s :: EksAttemptDetail
s@EksAttemptDetail' {} Maybe [EksAttemptContainerDetail]
a -> EksAttemptDetail
s {$sel:containers:EksAttemptDetail' :: Maybe [EksAttemptContainerDetail]
containers = Maybe [EksAttemptContainerDetail]
a} :: EksAttemptDetail) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the node for this job attempt.
eksAttemptDetail_nodeName :: Lens.Lens' EksAttemptDetail (Prelude.Maybe Prelude.Text)
eksAttemptDetail_nodeName :: Lens' EksAttemptDetail (Maybe Text)
eksAttemptDetail_nodeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksAttemptDetail' {Maybe Text
nodeName :: Maybe Text
$sel:nodeName:EksAttemptDetail' :: EksAttemptDetail -> Maybe Text
nodeName} -> Maybe Text
nodeName) (\s :: EksAttemptDetail
s@EksAttemptDetail' {} Maybe Text
a -> EksAttemptDetail
s {$sel:nodeName:EksAttemptDetail' :: Maybe Text
nodeName = Maybe Text
a} :: EksAttemptDetail)

-- | The name of the pod for this job attempt.
eksAttemptDetail_podName :: Lens.Lens' EksAttemptDetail (Prelude.Maybe Prelude.Text)
eksAttemptDetail_podName :: Lens' EksAttemptDetail (Maybe Text)
eksAttemptDetail_podName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksAttemptDetail' {Maybe Text
podName :: Maybe Text
$sel:podName:EksAttemptDetail' :: EksAttemptDetail -> Maybe Text
podName} -> Maybe Text
podName) (\s :: EksAttemptDetail
s@EksAttemptDetail' {} Maybe Text
a -> EksAttemptDetail
s {$sel:podName:EksAttemptDetail' :: Maybe Text
podName = Maybe Text
a} :: EksAttemptDetail)

-- | The Unix timestamp (in milliseconds) for when the attempt was started
-- (when the attempt transitioned from the @STARTING@ state to the
-- @RUNNING@ state).
eksAttemptDetail_startedAt :: Lens.Lens' EksAttemptDetail (Prelude.Maybe Prelude.Integer)
eksAttemptDetail_startedAt :: Lens' EksAttemptDetail (Maybe Integer)
eksAttemptDetail_startedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksAttemptDetail' {Maybe Integer
startedAt :: Maybe Integer
$sel:startedAt:EksAttemptDetail' :: EksAttemptDetail -> Maybe Integer
startedAt} -> Maybe Integer
startedAt) (\s :: EksAttemptDetail
s@EksAttemptDetail' {} Maybe Integer
a -> EksAttemptDetail
s {$sel:startedAt:EksAttemptDetail' :: Maybe Integer
startedAt = Maybe Integer
a} :: EksAttemptDetail)

-- | A short, human-readable string to provide additional details for the
-- current status of the job attempt.
eksAttemptDetail_statusReason :: Lens.Lens' EksAttemptDetail (Prelude.Maybe Prelude.Text)
eksAttemptDetail_statusReason :: Lens' EksAttemptDetail (Maybe Text)
eksAttemptDetail_statusReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksAttemptDetail' {Maybe Text
statusReason :: Maybe Text
$sel:statusReason:EksAttemptDetail' :: EksAttemptDetail -> Maybe Text
statusReason} -> Maybe Text
statusReason) (\s :: EksAttemptDetail
s@EksAttemptDetail' {} Maybe Text
a -> EksAttemptDetail
s {$sel:statusReason:EksAttemptDetail' :: Maybe Text
statusReason = Maybe Text
a} :: EksAttemptDetail)

-- | The Unix timestamp (in milliseconds) for when the attempt was stopped.
-- This happens when the attempt transitioned from the @RUNNING@ state to a
-- terminal state, such as @SUCCEEDED@ or @FAILED@.
eksAttemptDetail_stoppedAt :: Lens.Lens' EksAttemptDetail (Prelude.Maybe Prelude.Integer)
eksAttemptDetail_stoppedAt :: Lens' EksAttemptDetail (Maybe Integer)
eksAttemptDetail_stoppedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksAttemptDetail' {Maybe Integer
stoppedAt :: Maybe Integer
$sel:stoppedAt:EksAttemptDetail' :: EksAttemptDetail -> Maybe Integer
stoppedAt} -> Maybe Integer
stoppedAt) (\s :: EksAttemptDetail
s@EksAttemptDetail' {} Maybe Integer
a -> EksAttemptDetail
s {$sel:stoppedAt:EksAttemptDetail' :: Maybe Integer
stoppedAt = Maybe Integer
a} :: EksAttemptDetail)

instance Data.FromJSON EksAttemptDetail where
  parseJSON :: Value -> Parser EksAttemptDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EksAttemptDetail"
      ( \Object
x ->
          Maybe [EksAttemptContainerDetail]
-> Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Integer
-> EksAttemptDetail
EksAttemptDetail'
            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
"containers" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"nodeName")
            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
"podName")
            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
"startedAt")
            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
"statusReason")
            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
"stoppedAt")
      )

instance Prelude.Hashable EksAttemptDetail where
  hashWithSalt :: Int -> EksAttemptDetail -> Int
hashWithSalt Int
_salt EksAttemptDetail' {Maybe Integer
Maybe [EksAttemptContainerDetail]
Maybe Text
stoppedAt :: Maybe Integer
statusReason :: Maybe Text
startedAt :: Maybe Integer
podName :: Maybe Text
nodeName :: Maybe Text
containers :: Maybe [EksAttemptContainerDetail]
$sel:stoppedAt:EksAttemptDetail' :: EksAttemptDetail -> Maybe Integer
$sel:statusReason:EksAttemptDetail' :: EksAttemptDetail -> Maybe Text
$sel:startedAt:EksAttemptDetail' :: EksAttemptDetail -> Maybe Integer
$sel:podName:EksAttemptDetail' :: EksAttemptDetail -> Maybe Text
$sel:nodeName:EksAttemptDetail' :: EksAttemptDetail -> Maybe Text
$sel:containers:EksAttemptDetail' :: EksAttemptDetail -> Maybe [EksAttemptContainerDetail]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EksAttemptContainerDetail]
containers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nodeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
podName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
startedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
stoppedAt

instance Prelude.NFData EksAttemptDetail where
  rnf :: EksAttemptDetail -> ()
rnf EksAttemptDetail' {Maybe Integer
Maybe [EksAttemptContainerDetail]
Maybe Text
stoppedAt :: Maybe Integer
statusReason :: Maybe Text
startedAt :: Maybe Integer
podName :: Maybe Text
nodeName :: Maybe Text
containers :: Maybe [EksAttemptContainerDetail]
$sel:stoppedAt:EksAttemptDetail' :: EksAttemptDetail -> Maybe Integer
$sel:statusReason:EksAttemptDetail' :: EksAttemptDetail -> Maybe Text
$sel:startedAt:EksAttemptDetail' :: EksAttemptDetail -> Maybe Integer
$sel:podName:EksAttemptDetail' :: EksAttemptDetail -> Maybe Text
$sel:nodeName:EksAttemptDetail' :: EksAttemptDetail -> Maybe Text
$sel:containers:EksAttemptDetail' :: EksAttemptDetail -> Maybe [EksAttemptContainerDetail]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [EksAttemptContainerDetail]
containers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nodeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
podName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
startedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
stoppedAt