{-# 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.Glue.Types.WorkflowRunStatistics
-- 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.Glue.Types.WorkflowRunStatistics where

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

-- | Workflow run statistics provides statistics about the workflow run.
--
-- /See:/ 'newWorkflowRunStatistics' smart constructor.
data WorkflowRunStatistics = WorkflowRunStatistics'
  { -- | Total number Actions in running state.
    WorkflowRunStatistics -> Maybe Int
runningActions :: Prelude.Maybe Prelude.Int,
    -- | Total number of Actions that have stopped.
    WorkflowRunStatistics -> Maybe Int
stoppedActions :: Prelude.Maybe Prelude.Int,
    -- | Total number of Actions in the workflow run.
    WorkflowRunStatistics -> Maybe Int
totalActions :: Prelude.Maybe Prelude.Int,
    -- | Total number of Actions that have failed.
    WorkflowRunStatistics -> Maybe Int
failedActions :: Prelude.Maybe Prelude.Int,
    -- | Total number of Actions that timed out.
    WorkflowRunStatistics -> Maybe Int
timeoutActions :: Prelude.Maybe Prelude.Int,
    -- | Total number of Actions that have succeeded.
    WorkflowRunStatistics -> Maybe Int
succeededActions :: Prelude.Maybe Prelude.Int
  }
  deriving (WorkflowRunStatistics -> WorkflowRunStatistics -> Bool
(WorkflowRunStatistics -> WorkflowRunStatistics -> Bool)
-> (WorkflowRunStatistics -> WorkflowRunStatistics -> Bool)
-> Eq WorkflowRunStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowRunStatistics -> WorkflowRunStatistics -> Bool
$c/= :: WorkflowRunStatistics -> WorkflowRunStatistics -> Bool
== :: WorkflowRunStatistics -> WorkflowRunStatistics -> Bool
$c== :: WorkflowRunStatistics -> WorkflowRunStatistics -> Bool
Prelude.Eq, ReadPrec [WorkflowRunStatistics]
ReadPrec WorkflowRunStatistics
Int -> ReadS WorkflowRunStatistics
ReadS [WorkflowRunStatistics]
(Int -> ReadS WorkflowRunStatistics)
-> ReadS [WorkflowRunStatistics]
-> ReadPrec WorkflowRunStatistics
-> ReadPrec [WorkflowRunStatistics]
-> Read WorkflowRunStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowRunStatistics]
$creadListPrec :: ReadPrec [WorkflowRunStatistics]
readPrec :: ReadPrec WorkflowRunStatistics
$creadPrec :: ReadPrec WorkflowRunStatistics
readList :: ReadS [WorkflowRunStatistics]
$creadList :: ReadS [WorkflowRunStatistics]
readsPrec :: Int -> ReadS WorkflowRunStatistics
$creadsPrec :: Int -> ReadS WorkflowRunStatistics
Prelude.Read, Int -> WorkflowRunStatistics -> ShowS
[WorkflowRunStatistics] -> ShowS
WorkflowRunStatistics -> String
(Int -> WorkflowRunStatistics -> ShowS)
-> (WorkflowRunStatistics -> String)
-> ([WorkflowRunStatistics] -> ShowS)
-> Show WorkflowRunStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowRunStatistics] -> ShowS
$cshowList :: [WorkflowRunStatistics] -> ShowS
show :: WorkflowRunStatistics -> String
$cshow :: WorkflowRunStatistics -> String
showsPrec :: Int -> WorkflowRunStatistics -> ShowS
$cshowsPrec :: Int -> WorkflowRunStatistics -> ShowS
Prelude.Show, (forall x. WorkflowRunStatistics -> Rep WorkflowRunStatistics x)
-> (forall x. Rep WorkflowRunStatistics x -> WorkflowRunStatistics)
-> Generic WorkflowRunStatistics
forall x. Rep WorkflowRunStatistics x -> WorkflowRunStatistics
forall x. WorkflowRunStatistics -> Rep WorkflowRunStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkflowRunStatistics x -> WorkflowRunStatistics
$cfrom :: forall x. WorkflowRunStatistics -> Rep WorkflowRunStatistics x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowRunStatistics' 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:
--
-- 'runningActions', 'workflowRunStatistics_runningActions' - Total number Actions in running state.
--
-- 'stoppedActions', 'workflowRunStatistics_stoppedActions' - Total number of Actions that have stopped.
--
-- 'totalActions', 'workflowRunStatistics_totalActions' - Total number of Actions in the workflow run.
--
-- 'failedActions', 'workflowRunStatistics_failedActions' - Total number of Actions that have failed.
--
-- 'timeoutActions', 'workflowRunStatistics_timeoutActions' - Total number of Actions that timed out.
--
-- 'succeededActions', 'workflowRunStatistics_succeededActions' - Total number of Actions that have succeeded.
newWorkflowRunStatistics ::
  WorkflowRunStatistics
newWorkflowRunStatistics :: WorkflowRunStatistics
newWorkflowRunStatistics =
  WorkflowRunStatistics' :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> WorkflowRunStatistics
WorkflowRunStatistics'
    { $sel:runningActions:WorkflowRunStatistics' :: Maybe Int
runningActions =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:stoppedActions:WorkflowRunStatistics' :: Maybe Int
stoppedActions = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:totalActions:WorkflowRunStatistics' :: Maybe Int
totalActions = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:failedActions:WorkflowRunStatistics' :: Maybe Int
failedActions = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:timeoutActions:WorkflowRunStatistics' :: Maybe Int
timeoutActions = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:succeededActions:WorkflowRunStatistics' :: Maybe Int
succeededActions = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Total number Actions in running state.
workflowRunStatistics_runningActions :: Lens.Lens' WorkflowRunStatistics (Prelude.Maybe Prelude.Int)
workflowRunStatistics_runningActions :: (Maybe Int -> f (Maybe Int))
-> WorkflowRunStatistics -> f WorkflowRunStatistics
workflowRunStatistics_runningActions = (WorkflowRunStatistics -> Maybe Int)
-> (WorkflowRunStatistics -> Maybe Int -> WorkflowRunStatistics)
-> Lens
     WorkflowRunStatistics WorkflowRunStatistics (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowRunStatistics' {Maybe Int
runningActions :: Maybe Int
$sel:runningActions:WorkflowRunStatistics' :: WorkflowRunStatistics -> Maybe Int
runningActions} -> Maybe Int
runningActions) (\s :: WorkflowRunStatistics
s@WorkflowRunStatistics' {} Maybe Int
a -> WorkflowRunStatistics
s {$sel:runningActions:WorkflowRunStatistics' :: Maybe Int
runningActions = Maybe Int
a} :: WorkflowRunStatistics)

-- | Total number of Actions that have stopped.
workflowRunStatistics_stoppedActions :: Lens.Lens' WorkflowRunStatistics (Prelude.Maybe Prelude.Int)
workflowRunStatistics_stoppedActions :: (Maybe Int -> f (Maybe Int))
-> WorkflowRunStatistics -> f WorkflowRunStatistics
workflowRunStatistics_stoppedActions = (WorkflowRunStatistics -> Maybe Int)
-> (WorkflowRunStatistics -> Maybe Int -> WorkflowRunStatistics)
-> Lens
     WorkflowRunStatistics WorkflowRunStatistics (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowRunStatistics' {Maybe Int
stoppedActions :: Maybe Int
$sel:stoppedActions:WorkflowRunStatistics' :: WorkflowRunStatistics -> Maybe Int
stoppedActions} -> Maybe Int
stoppedActions) (\s :: WorkflowRunStatistics
s@WorkflowRunStatistics' {} Maybe Int
a -> WorkflowRunStatistics
s {$sel:stoppedActions:WorkflowRunStatistics' :: Maybe Int
stoppedActions = Maybe Int
a} :: WorkflowRunStatistics)

-- | Total number of Actions in the workflow run.
workflowRunStatistics_totalActions :: Lens.Lens' WorkflowRunStatistics (Prelude.Maybe Prelude.Int)
workflowRunStatistics_totalActions :: (Maybe Int -> f (Maybe Int))
-> WorkflowRunStatistics -> f WorkflowRunStatistics
workflowRunStatistics_totalActions = (WorkflowRunStatistics -> Maybe Int)
-> (WorkflowRunStatistics -> Maybe Int -> WorkflowRunStatistics)
-> Lens
     WorkflowRunStatistics WorkflowRunStatistics (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowRunStatistics' {Maybe Int
totalActions :: Maybe Int
$sel:totalActions:WorkflowRunStatistics' :: WorkflowRunStatistics -> Maybe Int
totalActions} -> Maybe Int
totalActions) (\s :: WorkflowRunStatistics
s@WorkflowRunStatistics' {} Maybe Int
a -> WorkflowRunStatistics
s {$sel:totalActions:WorkflowRunStatistics' :: Maybe Int
totalActions = Maybe Int
a} :: WorkflowRunStatistics)

-- | Total number of Actions that have failed.
workflowRunStatistics_failedActions :: Lens.Lens' WorkflowRunStatistics (Prelude.Maybe Prelude.Int)
workflowRunStatistics_failedActions :: (Maybe Int -> f (Maybe Int))
-> WorkflowRunStatistics -> f WorkflowRunStatistics
workflowRunStatistics_failedActions = (WorkflowRunStatistics -> Maybe Int)
-> (WorkflowRunStatistics -> Maybe Int -> WorkflowRunStatistics)
-> Lens
     WorkflowRunStatistics WorkflowRunStatistics (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowRunStatistics' {Maybe Int
failedActions :: Maybe Int
$sel:failedActions:WorkflowRunStatistics' :: WorkflowRunStatistics -> Maybe Int
failedActions} -> Maybe Int
failedActions) (\s :: WorkflowRunStatistics
s@WorkflowRunStatistics' {} Maybe Int
a -> WorkflowRunStatistics
s {$sel:failedActions:WorkflowRunStatistics' :: Maybe Int
failedActions = Maybe Int
a} :: WorkflowRunStatistics)

-- | Total number of Actions that timed out.
workflowRunStatistics_timeoutActions :: Lens.Lens' WorkflowRunStatistics (Prelude.Maybe Prelude.Int)
workflowRunStatistics_timeoutActions :: (Maybe Int -> f (Maybe Int))
-> WorkflowRunStatistics -> f WorkflowRunStatistics
workflowRunStatistics_timeoutActions = (WorkflowRunStatistics -> Maybe Int)
-> (WorkflowRunStatistics -> Maybe Int -> WorkflowRunStatistics)
-> Lens
     WorkflowRunStatistics WorkflowRunStatistics (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowRunStatistics' {Maybe Int
timeoutActions :: Maybe Int
$sel:timeoutActions:WorkflowRunStatistics' :: WorkflowRunStatistics -> Maybe Int
timeoutActions} -> Maybe Int
timeoutActions) (\s :: WorkflowRunStatistics
s@WorkflowRunStatistics' {} Maybe Int
a -> WorkflowRunStatistics
s {$sel:timeoutActions:WorkflowRunStatistics' :: Maybe Int
timeoutActions = Maybe Int
a} :: WorkflowRunStatistics)

-- | Total number of Actions that have succeeded.
workflowRunStatistics_succeededActions :: Lens.Lens' WorkflowRunStatistics (Prelude.Maybe Prelude.Int)
workflowRunStatistics_succeededActions :: (Maybe Int -> f (Maybe Int))
-> WorkflowRunStatistics -> f WorkflowRunStatistics
workflowRunStatistics_succeededActions = (WorkflowRunStatistics -> Maybe Int)
-> (WorkflowRunStatistics -> Maybe Int -> WorkflowRunStatistics)
-> Lens
     WorkflowRunStatistics WorkflowRunStatistics (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowRunStatistics' {Maybe Int
succeededActions :: Maybe Int
$sel:succeededActions:WorkflowRunStatistics' :: WorkflowRunStatistics -> Maybe Int
succeededActions} -> Maybe Int
succeededActions) (\s :: WorkflowRunStatistics
s@WorkflowRunStatistics' {} Maybe Int
a -> WorkflowRunStatistics
s {$sel:succeededActions:WorkflowRunStatistics' :: Maybe Int
succeededActions = Maybe Int
a} :: WorkflowRunStatistics)

instance Core.FromJSON WorkflowRunStatistics where
  parseJSON :: Value -> Parser WorkflowRunStatistics
parseJSON =
    String
-> (Object -> Parser WorkflowRunStatistics)
-> Value
-> Parser WorkflowRunStatistics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkflowRunStatistics"
      ( \Object
x ->
          Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> WorkflowRunStatistics
WorkflowRunStatistics'
            (Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> WorkflowRunStatistics)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> WorkflowRunStatistics)
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
"RunningActions")
            Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> WorkflowRunStatistics)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int -> Maybe Int -> Maybe Int -> WorkflowRunStatistics)
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
"StoppedActions")
            Parser
  (Maybe Int
   -> Maybe Int -> Maybe Int -> Maybe Int -> WorkflowRunStatistics)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int -> Maybe Int -> Maybe Int -> WorkflowRunStatistics)
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
"TotalActions")
            Parser
  (Maybe Int -> Maybe Int -> Maybe Int -> WorkflowRunStatistics)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Int -> WorkflowRunStatistics)
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
"FailedActions")
            Parser (Maybe Int -> Maybe Int -> WorkflowRunStatistics)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> WorkflowRunStatistics)
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
"TimeoutActions")
            Parser (Maybe Int -> WorkflowRunStatistics)
-> Parser (Maybe Int) -> Parser WorkflowRunStatistics
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
"SucceededActions")
      )

instance Prelude.Hashable WorkflowRunStatistics

instance Prelude.NFData WorkflowRunStatistics