{-# 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.IoT.Types.TaskStatisticsForAuditCheck
-- 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.IoT.Types.TaskStatisticsForAuditCheck where

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

-- | Provides summary counts of how many tasks for findings are in a
-- particular state. This information is included in the response from
-- DescribeAuditMitigationActionsTask.
--
-- /See:/ 'newTaskStatisticsForAuditCheck' smart constructor.
data TaskStatisticsForAuditCheck = TaskStatisticsForAuditCheck'
  { -- | The number of findings to which the mitigation action task was canceled
    -- when applied.
    TaskStatisticsForAuditCheck -> Maybe Integer
canceledFindingsCount :: Prelude.Maybe Prelude.Integer,
    -- | The number of findings skipped because of filter conditions provided in
    -- the parameters to the command.
    TaskStatisticsForAuditCheck -> Maybe Integer
skippedFindingsCount :: Prelude.Maybe Prelude.Integer,
    -- | The total number of findings to which a task is being applied.
    TaskStatisticsForAuditCheck -> Maybe Integer
totalFindingsCount :: Prelude.Maybe Prelude.Integer,
    -- | The number of findings for which at least one of the actions failed when
    -- applied.
    TaskStatisticsForAuditCheck -> Maybe Integer
failedFindingsCount :: Prelude.Maybe Prelude.Integer,
    -- | The number of findings for which all mitigation actions succeeded when
    -- applied.
    TaskStatisticsForAuditCheck -> Maybe Integer
succeededFindingsCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (TaskStatisticsForAuditCheck -> TaskStatisticsForAuditCheck -> Bool
(TaskStatisticsForAuditCheck
 -> TaskStatisticsForAuditCheck -> Bool)
-> (TaskStatisticsForAuditCheck
    -> TaskStatisticsForAuditCheck -> Bool)
-> Eq TaskStatisticsForAuditCheck
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskStatisticsForAuditCheck -> TaskStatisticsForAuditCheck -> Bool
$c/= :: TaskStatisticsForAuditCheck -> TaskStatisticsForAuditCheck -> Bool
== :: TaskStatisticsForAuditCheck -> TaskStatisticsForAuditCheck -> Bool
$c== :: TaskStatisticsForAuditCheck -> TaskStatisticsForAuditCheck -> Bool
Prelude.Eq, ReadPrec [TaskStatisticsForAuditCheck]
ReadPrec TaskStatisticsForAuditCheck
Int -> ReadS TaskStatisticsForAuditCheck
ReadS [TaskStatisticsForAuditCheck]
(Int -> ReadS TaskStatisticsForAuditCheck)
-> ReadS [TaskStatisticsForAuditCheck]
-> ReadPrec TaskStatisticsForAuditCheck
-> ReadPrec [TaskStatisticsForAuditCheck]
-> Read TaskStatisticsForAuditCheck
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TaskStatisticsForAuditCheck]
$creadListPrec :: ReadPrec [TaskStatisticsForAuditCheck]
readPrec :: ReadPrec TaskStatisticsForAuditCheck
$creadPrec :: ReadPrec TaskStatisticsForAuditCheck
readList :: ReadS [TaskStatisticsForAuditCheck]
$creadList :: ReadS [TaskStatisticsForAuditCheck]
readsPrec :: Int -> ReadS TaskStatisticsForAuditCheck
$creadsPrec :: Int -> ReadS TaskStatisticsForAuditCheck
Prelude.Read, Int -> TaskStatisticsForAuditCheck -> ShowS
[TaskStatisticsForAuditCheck] -> ShowS
TaskStatisticsForAuditCheck -> String
(Int -> TaskStatisticsForAuditCheck -> ShowS)
-> (TaskStatisticsForAuditCheck -> String)
-> ([TaskStatisticsForAuditCheck] -> ShowS)
-> Show TaskStatisticsForAuditCheck
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskStatisticsForAuditCheck] -> ShowS
$cshowList :: [TaskStatisticsForAuditCheck] -> ShowS
show :: TaskStatisticsForAuditCheck -> String
$cshow :: TaskStatisticsForAuditCheck -> String
showsPrec :: Int -> TaskStatisticsForAuditCheck -> ShowS
$cshowsPrec :: Int -> TaskStatisticsForAuditCheck -> ShowS
Prelude.Show, (forall x.
 TaskStatisticsForAuditCheck -> Rep TaskStatisticsForAuditCheck x)
-> (forall x.
    Rep TaskStatisticsForAuditCheck x -> TaskStatisticsForAuditCheck)
-> Generic TaskStatisticsForAuditCheck
forall x.
Rep TaskStatisticsForAuditCheck x -> TaskStatisticsForAuditCheck
forall x.
TaskStatisticsForAuditCheck -> Rep TaskStatisticsForAuditCheck x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TaskStatisticsForAuditCheck x -> TaskStatisticsForAuditCheck
$cfrom :: forall x.
TaskStatisticsForAuditCheck -> Rep TaskStatisticsForAuditCheck x
Prelude.Generic)

-- |
-- Create a value of 'TaskStatisticsForAuditCheck' 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:
--
-- 'canceledFindingsCount', 'taskStatisticsForAuditCheck_canceledFindingsCount' - The number of findings to which the mitigation action task was canceled
-- when applied.
--
-- 'skippedFindingsCount', 'taskStatisticsForAuditCheck_skippedFindingsCount' - The number of findings skipped because of filter conditions provided in
-- the parameters to the command.
--
-- 'totalFindingsCount', 'taskStatisticsForAuditCheck_totalFindingsCount' - The total number of findings to which a task is being applied.
--
-- 'failedFindingsCount', 'taskStatisticsForAuditCheck_failedFindingsCount' - The number of findings for which at least one of the actions failed when
-- applied.
--
-- 'succeededFindingsCount', 'taskStatisticsForAuditCheck_succeededFindingsCount' - The number of findings for which all mitigation actions succeeded when
-- applied.
newTaskStatisticsForAuditCheck ::
  TaskStatisticsForAuditCheck
newTaskStatisticsForAuditCheck :: TaskStatisticsForAuditCheck
newTaskStatisticsForAuditCheck =
  TaskStatisticsForAuditCheck' :: Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> TaskStatisticsForAuditCheck
TaskStatisticsForAuditCheck'
    { $sel:canceledFindingsCount:TaskStatisticsForAuditCheck' :: Maybe Integer
canceledFindingsCount =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:skippedFindingsCount:TaskStatisticsForAuditCheck' :: Maybe Integer
skippedFindingsCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:totalFindingsCount:TaskStatisticsForAuditCheck' :: Maybe Integer
totalFindingsCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:failedFindingsCount:TaskStatisticsForAuditCheck' :: Maybe Integer
failedFindingsCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:succeededFindingsCount:TaskStatisticsForAuditCheck' :: Maybe Integer
succeededFindingsCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of findings to which the mitigation action task was canceled
-- when applied.
taskStatisticsForAuditCheck_canceledFindingsCount :: Lens.Lens' TaskStatisticsForAuditCheck (Prelude.Maybe Prelude.Integer)
taskStatisticsForAuditCheck_canceledFindingsCount :: (Maybe Integer -> f (Maybe Integer))
-> TaskStatisticsForAuditCheck -> f TaskStatisticsForAuditCheck
taskStatisticsForAuditCheck_canceledFindingsCount = (TaskStatisticsForAuditCheck -> Maybe Integer)
-> (TaskStatisticsForAuditCheck
    -> Maybe Integer -> TaskStatisticsForAuditCheck)
-> Lens
     TaskStatisticsForAuditCheck
     TaskStatisticsForAuditCheck
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskStatisticsForAuditCheck' {Maybe Integer
canceledFindingsCount :: Maybe Integer
$sel:canceledFindingsCount:TaskStatisticsForAuditCheck' :: TaskStatisticsForAuditCheck -> Maybe Integer
canceledFindingsCount} -> Maybe Integer
canceledFindingsCount) (\s :: TaskStatisticsForAuditCheck
s@TaskStatisticsForAuditCheck' {} Maybe Integer
a -> TaskStatisticsForAuditCheck
s {$sel:canceledFindingsCount:TaskStatisticsForAuditCheck' :: Maybe Integer
canceledFindingsCount = Maybe Integer
a} :: TaskStatisticsForAuditCheck)

-- | The number of findings skipped because of filter conditions provided in
-- the parameters to the command.
taskStatisticsForAuditCheck_skippedFindingsCount :: Lens.Lens' TaskStatisticsForAuditCheck (Prelude.Maybe Prelude.Integer)
taskStatisticsForAuditCheck_skippedFindingsCount :: (Maybe Integer -> f (Maybe Integer))
-> TaskStatisticsForAuditCheck -> f TaskStatisticsForAuditCheck
taskStatisticsForAuditCheck_skippedFindingsCount = (TaskStatisticsForAuditCheck -> Maybe Integer)
-> (TaskStatisticsForAuditCheck
    -> Maybe Integer -> TaskStatisticsForAuditCheck)
-> Lens
     TaskStatisticsForAuditCheck
     TaskStatisticsForAuditCheck
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskStatisticsForAuditCheck' {Maybe Integer
skippedFindingsCount :: Maybe Integer
$sel:skippedFindingsCount:TaskStatisticsForAuditCheck' :: TaskStatisticsForAuditCheck -> Maybe Integer
skippedFindingsCount} -> Maybe Integer
skippedFindingsCount) (\s :: TaskStatisticsForAuditCheck
s@TaskStatisticsForAuditCheck' {} Maybe Integer
a -> TaskStatisticsForAuditCheck
s {$sel:skippedFindingsCount:TaskStatisticsForAuditCheck' :: Maybe Integer
skippedFindingsCount = Maybe Integer
a} :: TaskStatisticsForAuditCheck)

-- | The total number of findings to which a task is being applied.
taskStatisticsForAuditCheck_totalFindingsCount :: Lens.Lens' TaskStatisticsForAuditCheck (Prelude.Maybe Prelude.Integer)
taskStatisticsForAuditCheck_totalFindingsCount :: (Maybe Integer -> f (Maybe Integer))
-> TaskStatisticsForAuditCheck -> f TaskStatisticsForAuditCheck
taskStatisticsForAuditCheck_totalFindingsCount = (TaskStatisticsForAuditCheck -> Maybe Integer)
-> (TaskStatisticsForAuditCheck
    -> Maybe Integer -> TaskStatisticsForAuditCheck)
-> Lens
     TaskStatisticsForAuditCheck
     TaskStatisticsForAuditCheck
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskStatisticsForAuditCheck' {Maybe Integer
totalFindingsCount :: Maybe Integer
$sel:totalFindingsCount:TaskStatisticsForAuditCheck' :: TaskStatisticsForAuditCheck -> Maybe Integer
totalFindingsCount} -> Maybe Integer
totalFindingsCount) (\s :: TaskStatisticsForAuditCheck
s@TaskStatisticsForAuditCheck' {} Maybe Integer
a -> TaskStatisticsForAuditCheck
s {$sel:totalFindingsCount:TaskStatisticsForAuditCheck' :: Maybe Integer
totalFindingsCount = Maybe Integer
a} :: TaskStatisticsForAuditCheck)

-- | The number of findings for which at least one of the actions failed when
-- applied.
taskStatisticsForAuditCheck_failedFindingsCount :: Lens.Lens' TaskStatisticsForAuditCheck (Prelude.Maybe Prelude.Integer)
taskStatisticsForAuditCheck_failedFindingsCount :: (Maybe Integer -> f (Maybe Integer))
-> TaskStatisticsForAuditCheck -> f TaskStatisticsForAuditCheck
taskStatisticsForAuditCheck_failedFindingsCount = (TaskStatisticsForAuditCheck -> Maybe Integer)
-> (TaskStatisticsForAuditCheck
    -> Maybe Integer -> TaskStatisticsForAuditCheck)
-> Lens
     TaskStatisticsForAuditCheck
     TaskStatisticsForAuditCheck
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskStatisticsForAuditCheck' {Maybe Integer
failedFindingsCount :: Maybe Integer
$sel:failedFindingsCount:TaskStatisticsForAuditCheck' :: TaskStatisticsForAuditCheck -> Maybe Integer
failedFindingsCount} -> Maybe Integer
failedFindingsCount) (\s :: TaskStatisticsForAuditCheck
s@TaskStatisticsForAuditCheck' {} Maybe Integer
a -> TaskStatisticsForAuditCheck
s {$sel:failedFindingsCount:TaskStatisticsForAuditCheck' :: Maybe Integer
failedFindingsCount = Maybe Integer
a} :: TaskStatisticsForAuditCheck)

-- | The number of findings for which all mitigation actions succeeded when
-- applied.
taskStatisticsForAuditCheck_succeededFindingsCount :: Lens.Lens' TaskStatisticsForAuditCheck (Prelude.Maybe Prelude.Integer)
taskStatisticsForAuditCheck_succeededFindingsCount :: (Maybe Integer -> f (Maybe Integer))
-> TaskStatisticsForAuditCheck -> f TaskStatisticsForAuditCheck
taskStatisticsForAuditCheck_succeededFindingsCount = (TaskStatisticsForAuditCheck -> Maybe Integer)
-> (TaskStatisticsForAuditCheck
    -> Maybe Integer -> TaskStatisticsForAuditCheck)
-> Lens
     TaskStatisticsForAuditCheck
     TaskStatisticsForAuditCheck
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskStatisticsForAuditCheck' {Maybe Integer
succeededFindingsCount :: Maybe Integer
$sel:succeededFindingsCount:TaskStatisticsForAuditCheck' :: TaskStatisticsForAuditCheck -> Maybe Integer
succeededFindingsCount} -> Maybe Integer
succeededFindingsCount) (\s :: TaskStatisticsForAuditCheck
s@TaskStatisticsForAuditCheck' {} Maybe Integer
a -> TaskStatisticsForAuditCheck
s {$sel:succeededFindingsCount:TaskStatisticsForAuditCheck' :: Maybe Integer
succeededFindingsCount = Maybe Integer
a} :: TaskStatisticsForAuditCheck)

instance Core.FromJSON TaskStatisticsForAuditCheck where
  parseJSON :: Value -> Parser TaskStatisticsForAuditCheck
parseJSON =
    String
-> (Object -> Parser TaskStatisticsForAuditCheck)
-> Value
-> Parser TaskStatisticsForAuditCheck
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TaskStatisticsForAuditCheck"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> TaskStatisticsForAuditCheck
TaskStatisticsForAuditCheck'
            (Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> TaskStatisticsForAuditCheck)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> TaskStatisticsForAuditCheck)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"canceledFindingsCount")
            Parser
  (Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> TaskStatisticsForAuditCheck)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Integer -> Maybe Integer -> TaskStatisticsForAuditCheck)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"skippedFindingsCount")
            Parser
  (Maybe Integer
   -> Maybe Integer -> Maybe Integer -> TaskStatisticsForAuditCheck)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer -> Maybe Integer -> TaskStatisticsForAuditCheck)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"totalFindingsCount")
            Parser
  (Maybe Integer -> Maybe Integer -> TaskStatisticsForAuditCheck)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> TaskStatisticsForAuditCheck)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"failedFindingsCount")
            Parser (Maybe Integer -> TaskStatisticsForAuditCheck)
-> Parser (Maybe Integer) -> Parser TaskStatisticsForAuditCheck
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"succeededFindingsCount")
      )

instance Prelude.Hashable TaskStatisticsForAuditCheck

instance Prelude.NFData TaskStatisticsForAuditCheck