{-# 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.SSM.Types.ProgressCounters
-- 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.SSM.Types.ProgressCounters where

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

-- | An aggregate of step execution statuses displayed in the Amazon Web
-- Services Systems Manager console for a multi-Region and multi-account
-- Automation execution.
--
-- /See:/ 'newProgressCounters' smart constructor.
data ProgressCounters = ProgressCounters'
  { -- | The total number of steps that failed to run in all specified Amazon Web
    -- Services Regions and Amazon Web Services accounts for the current
    -- Automation execution.
    ProgressCounters -> Maybe Int
failedSteps :: Prelude.Maybe Prelude.Int,
    -- | The total number of steps that the system cancelled in all specified
    -- Amazon Web Services Regions and Amazon Web Services accounts for the
    -- current Automation execution.
    ProgressCounters -> Maybe Int
cancelledSteps :: Prelude.Maybe Prelude.Int,
    -- | The total number of steps that successfully completed in all specified
    -- Amazon Web Services Regions and Amazon Web Services accounts for the
    -- current Automation execution.
    ProgressCounters -> Maybe Int
successSteps :: Prelude.Maybe Prelude.Int,
    -- | The total number of steps run in all specified Amazon Web Services
    -- Regions and Amazon Web Services accounts for the current Automation
    -- execution.
    ProgressCounters -> Maybe Int
totalSteps :: Prelude.Maybe Prelude.Int,
    -- | The total number of steps that timed out in all specified Amazon Web
    -- Services Regions and Amazon Web Services accounts for the current
    -- Automation execution.
    ProgressCounters -> Maybe Int
timedOutSteps :: Prelude.Maybe Prelude.Int
  }
  deriving (ProgressCounters -> ProgressCounters -> Bool
(ProgressCounters -> ProgressCounters -> Bool)
-> (ProgressCounters -> ProgressCounters -> Bool)
-> Eq ProgressCounters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProgressCounters -> ProgressCounters -> Bool
$c/= :: ProgressCounters -> ProgressCounters -> Bool
== :: ProgressCounters -> ProgressCounters -> Bool
$c== :: ProgressCounters -> ProgressCounters -> Bool
Prelude.Eq, ReadPrec [ProgressCounters]
ReadPrec ProgressCounters
Int -> ReadS ProgressCounters
ReadS [ProgressCounters]
(Int -> ReadS ProgressCounters)
-> ReadS [ProgressCounters]
-> ReadPrec ProgressCounters
-> ReadPrec [ProgressCounters]
-> Read ProgressCounters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProgressCounters]
$creadListPrec :: ReadPrec [ProgressCounters]
readPrec :: ReadPrec ProgressCounters
$creadPrec :: ReadPrec ProgressCounters
readList :: ReadS [ProgressCounters]
$creadList :: ReadS [ProgressCounters]
readsPrec :: Int -> ReadS ProgressCounters
$creadsPrec :: Int -> ReadS ProgressCounters
Prelude.Read, Int -> ProgressCounters -> ShowS
[ProgressCounters] -> ShowS
ProgressCounters -> String
(Int -> ProgressCounters -> ShowS)
-> (ProgressCounters -> String)
-> ([ProgressCounters] -> ShowS)
-> Show ProgressCounters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProgressCounters] -> ShowS
$cshowList :: [ProgressCounters] -> ShowS
show :: ProgressCounters -> String
$cshow :: ProgressCounters -> String
showsPrec :: Int -> ProgressCounters -> ShowS
$cshowsPrec :: Int -> ProgressCounters -> ShowS
Prelude.Show, (forall x. ProgressCounters -> Rep ProgressCounters x)
-> (forall x. Rep ProgressCounters x -> ProgressCounters)
-> Generic ProgressCounters
forall x. Rep ProgressCounters x -> ProgressCounters
forall x. ProgressCounters -> Rep ProgressCounters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProgressCounters x -> ProgressCounters
$cfrom :: forall x. ProgressCounters -> Rep ProgressCounters x
Prelude.Generic)

-- |
-- Create a value of 'ProgressCounters' 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:
--
-- 'failedSteps', 'progressCounters_failedSteps' - The total number of steps that failed to run in all specified Amazon Web
-- Services Regions and Amazon Web Services accounts for the current
-- Automation execution.
--
-- 'cancelledSteps', 'progressCounters_cancelledSteps' - The total number of steps that the system cancelled in all specified
-- Amazon Web Services Regions and Amazon Web Services accounts for the
-- current Automation execution.
--
-- 'successSteps', 'progressCounters_successSteps' - The total number of steps that successfully completed in all specified
-- Amazon Web Services Regions and Amazon Web Services accounts for the
-- current Automation execution.
--
-- 'totalSteps', 'progressCounters_totalSteps' - The total number of steps run in all specified Amazon Web Services
-- Regions and Amazon Web Services accounts for the current Automation
-- execution.
--
-- 'timedOutSteps', 'progressCounters_timedOutSteps' - The total number of steps that timed out in all specified Amazon Web
-- Services Regions and Amazon Web Services accounts for the current
-- Automation execution.
newProgressCounters ::
  ProgressCounters
newProgressCounters :: ProgressCounters
newProgressCounters =
  ProgressCounters' :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> ProgressCounters
ProgressCounters'
    { $sel:failedSteps:ProgressCounters' :: Maybe Int
failedSteps = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:cancelledSteps:ProgressCounters' :: Maybe Int
cancelledSteps = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:successSteps:ProgressCounters' :: Maybe Int
successSteps = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:totalSteps:ProgressCounters' :: Maybe Int
totalSteps = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:timedOutSteps:ProgressCounters' :: Maybe Int
timedOutSteps = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The total number of steps that failed to run in all specified Amazon Web
-- Services Regions and Amazon Web Services accounts for the current
-- Automation execution.
progressCounters_failedSteps :: Lens.Lens' ProgressCounters (Prelude.Maybe Prelude.Int)
progressCounters_failedSteps :: (Maybe Int -> f (Maybe Int))
-> ProgressCounters -> f ProgressCounters
progressCounters_failedSteps = (ProgressCounters -> Maybe Int)
-> (ProgressCounters -> Maybe Int -> ProgressCounters)
-> Lens ProgressCounters ProgressCounters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressCounters' {Maybe Int
failedSteps :: Maybe Int
$sel:failedSteps:ProgressCounters' :: ProgressCounters -> Maybe Int
failedSteps} -> Maybe Int
failedSteps) (\s :: ProgressCounters
s@ProgressCounters' {} Maybe Int
a -> ProgressCounters
s {$sel:failedSteps:ProgressCounters' :: Maybe Int
failedSteps = Maybe Int
a} :: ProgressCounters)

-- | The total number of steps that the system cancelled in all specified
-- Amazon Web Services Regions and Amazon Web Services accounts for the
-- current Automation execution.
progressCounters_cancelledSteps :: Lens.Lens' ProgressCounters (Prelude.Maybe Prelude.Int)
progressCounters_cancelledSteps :: (Maybe Int -> f (Maybe Int))
-> ProgressCounters -> f ProgressCounters
progressCounters_cancelledSteps = (ProgressCounters -> Maybe Int)
-> (ProgressCounters -> Maybe Int -> ProgressCounters)
-> Lens ProgressCounters ProgressCounters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressCounters' {Maybe Int
cancelledSteps :: Maybe Int
$sel:cancelledSteps:ProgressCounters' :: ProgressCounters -> Maybe Int
cancelledSteps} -> Maybe Int
cancelledSteps) (\s :: ProgressCounters
s@ProgressCounters' {} Maybe Int
a -> ProgressCounters
s {$sel:cancelledSteps:ProgressCounters' :: Maybe Int
cancelledSteps = Maybe Int
a} :: ProgressCounters)

-- | The total number of steps that successfully completed in all specified
-- Amazon Web Services Regions and Amazon Web Services accounts for the
-- current Automation execution.
progressCounters_successSteps :: Lens.Lens' ProgressCounters (Prelude.Maybe Prelude.Int)
progressCounters_successSteps :: (Maybe Int -> f (Maybe Int))
-> ProgressCounters -> f ProgressCounters
progressCounters_successSteps = (ProgressCounters -> Maybe Int)
-> (ProgressCounters -> Maybe Int -> ProgressCounters)
-> Lens ProgressCounters ProgressCounters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressCounters' {Maybe Int
successSteps :: Maybe Int
$sel:successSteps:ProgressCounters' :: ProgressCounters -> Maybe Int
successSteps} -> Maybe Int
successSteps) (\s :: ProgressCounters
s@ProgressCounters' {} Maybe Int
a -> ProgressCounters
s {$sel:successSteps:ProgressCounters' :: Maybe Int
successSteps = Maybe Int
a} :: ProgressCounters)

-- | The total number of steps run in all specified Amazon Web Services
-- Regions and Amazon Web Services accounts for the current Automation
-- execution.
progressCounters_totalSteps :: Lens.Lens' ProgressCounters (Prelude.Maybe Prelude.Int)
progressCounters_totalSteps :: (Maybe Int -> f (Maybe Int))
-> ProgressCounters -> f ProgressCounters
progressCounters_totalSteps = (ProgressCounters -> Maybe Int)
-> (ProgressCounters -> Maybe Int -> ProgressCounters)
-> Lens ProgressCounters ProgressCounters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressCounters' {Maybe Int
totalSteps :: Maybe Int
$sel:totalSteps:ProgressCounters' :: ProgressCounters -> Maybe Int
totalSteps} -> Maybe Int
totalSteps) (\s :: ProgressCounters
s@ProgressCounters' {} Maybe Int
a -> ProgressCounters
s {$sel:totalSteps:ProgressCounters' :: Maybe Int
totalSteps = Maybe Int
a} :: ProgressCounters)

-- | The total number of steps that timed out in all specified Amazon Web
-- Services Regions and Amazon Web Services accounts for the current
-- Automation execution.
progressCounters_timedOutSteps :: Lens.Lens' ProgressCounters (Prelude.Maybe Prelude.Int)
progressCounters_timedOutSteps :: (Maybe Int -> f (Maybe Int))
-> ProgressCounters -> f ProgressCounters
progressCounters_timedOutSteps = (ProgressCounters -> Maybe Int)
-> (ProgressCounters -> Maybe Int -> ProgressCounters)
-> Lens ProgressCounters ProgressCounters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressCounters' {Maybe Int
timedOutSteps :: Maybe Int
$sel:timedOutSteps:ProgressCounters' :: ProgressCounters -> Maybe Int
timedOutSteps} -> Maybe Int
timedOutSteps) (\s :: ProgressCounters
s@ProgressCounters' {} Maybe Int
a -> ProgressCounters
s {$sel:timedOutSteps:ProgressCounters' :: Maybe Int
timedOutSteps = Maybe Int
a} :: ProgressCounters)

instance Core.FromJSON ProgressCounters where
  parseJSON :: Value -> Parser ProgressCounters
parseJSON =
    String
-> (Object -> Parser ProgressCounters)
-> Value
-> Parser ProgressCounters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProgressCounters"
      ( \Object
x ->
          Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> ProgressCounters
ProgressCounters'
            (Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> ProgressCounters)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int -> Maybe Int -> Maybe Int -> ProgressCounters)
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
"FailedSteps")
            Parser
  (Maybe Int
   -> Maybe Int -> Maybe Int -> Maybe Int -> ProgressCounters)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Int -> Maybe Int -> ProgressCounters)
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
"CancelledSteps")
            Parser (Maybe Int -> Maybe Int -> Maybe Int -> ProgressCounters)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Int -> ProgressCounters)
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
"SuccessSteps")
            Parser (Maybe Int -> Maybe Int -> ProgressCounters)
-> Parser (Maybe Int) -> Parser (Maybe Int -> ProgressCounters)
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
"TotalSteps")
            Parser (Maybe Int -> ProgressCounters)
-> Parser (Maybe Int) -> Parser ProgressCounters
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
"TimedOutSteps")
      )

instance Prelude.Hashable ProgressCounters

instance Prelude.NFData ProgressCounters