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

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.AuditCheckRunStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the audit check.
--
-- /See:/ 'newAuditCheckDetails' smart constructor.
data AuditCheckDetails = AuditCheckDetails'
  { -- | Describes how many of the non-compliant resources created during the
    -- evaluation of an audit check were marked as suppressed.
    AuditCheckDetails -> Maybe Integer
suppressedNonCompliantResourcesCount :: Prelude.Maybe Prelude.Integer,
    -- | The number of resources on which the check was performed.
    AuditCheckDetails -> Maybe Integer
totalResourcesCount :: Prelude.Maybe Prelude.Integer,
    -- | True if the check is complete and found all resources compliant.
    AuditCheckDetails -> Maybe Bool
checkCompliant :: Prelude.Maybe Prelude.Bool,
    -- | The number of resources that were found noncompliant during the check.
    AuditCheckDetails -> Maybe Integer
nonCompliantResourcesCount :: Prelude.Maybe Prelude.Integer,
    -- | The code of any error encountered when this check is performed during
    -- this audit. One of \"INSUFFICIENT_PERMISSIONS\" or
    -- \"AUDIT_CHECK_DISABLED\".
    AuditCheckDetails -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The message associated with any error encountered when this check is
    -- performed during this audit.
    AuditCheckDetails -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The completion status of this check. One of \"IN_PROGRESS\",
    -- \"WAITING_FOR_DATA_COLLECTION\", \"CANCELED\", \"COMPLETED_COMPLIANT\",
    -- \"COMPLETED_NON_COMPLIANT\", or \"FAILED\".
    AuditCheckDetails -> Maybe AuditCheckRunStatus
checkRunStatus :: Prelude.Maybe AuditCheckRunStatus
  }
  deriving (AuditCheckDetails -> AuditCheckDetails -> Bool
(AuditCheckDetails -> AuditCheckDetails -> Bool)
-> (AuditCheckDetails -> AuditCheckDetails -> Bool)
-> Eq AuditCheckDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuditCheckDetails -> AuditCheckDetails -> Bool
$c/= :: AuditCheckDetails -> AuditCheckDetails -> Bool
== :: AuditCheckDetails -> AuditCheckDetails -> Bool
$c== :: AuditCheckDetails -> AuditCheckDetails -> Bool
Prelude.Eq, ReadPrec [AuditCheckDetails]
ReadPrec AuditCheckDetails
Int -> ReadS AuditCheckDetails
ReadS [AuditCheckDetails]
(Int -> ReadS AuditCheckDetails)
-> ReadS [AuditCheckDetails]
-> ReadPrec AuditCheckDetails
-> ReadPrec [AuditCheckDetails]
-> Read AuditCheckDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuditCheckDetails]
$creadListPrec :: ReadPrec [AuditCheckDetails]
readPrec :: ReadPrec AuditCheckDetails
$creadPrec :: ReadPrec AuditCheckDetails
readList :: ReadS [AuditCheckDetails]
$creadList :: ReadS [AuditCheckDetails]
readsPrec :: Int -> ReadS AuditCheckDetails
$creadsPrec :: Int -> ReadS AuditCheckDetails
Prelude.Read, Int -> AuditCheckDetails -> ShowS
[AuditCheckDetails] -> ShowS
AuditCheckDetails -> String
(Int -> AuditCheckDetails -> ShowS)
-> (AuditCheckDetails -> String)
-> ([AuditCheckDetails] -> ShowS)
-> Show AuditCheckDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuditCheckDetails] -> ShowS
$cshowList :: [AuditCheckDetails] -> ShowS
show :: AuditCheckDetails -> String
$cshow :: AuditCheckDetails -> String
showsPrec :: Int -> AuditCheckDetails -> ShowS
$cshowsPrec :: Int -> AuditCheckDetails -> ShowS
Prelude.Show, (forall x. AuditCheckDetails -> Rep AuditCheckDetails x)
-> (forall x. Rep AuditCheckDetails x -> AuditCheckDetails)
-> Generic AuditCheckDetails
forall x. Rep AuditCheckDetails x -> AuditCheckDetails
forall x. AuditCheckDetails -> Rep AuditCheckDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuditCheckDetails x -> AuditCheckDetails
$cfrom :: forall x. AuditCheckDetails -> Rep AuditCheckDetails x
Prelude.Generic)

-- |
-- Create a value of 'AuditCheckDetails' 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:
--
-- 'suppressedNonCompliantResourcesCount', 'auditCheckDetails_suppressedNonCompliantResourcesCount' - Describes how many of the non-compliant resources created during the
-- evaluation of an audit check were marked as suppressed.
--
-- 'totalResourcesCount', 'auditCheckDetails_totalResourcesCount' - The number of resources on which the check was performed.
--
-- 'checkCompliant', 'auditCheckDetails_checkCompliant' - True if the check is complete and found all resources compliant.
--
-- 'nonCompliantResourcesCount', 'auditCheckDetails_nonCompliantResourcesCount' - The number of resources that were found noncompliant during the check.
--
-- 'errorCode', 'auditCheckDetails_errorCode' - The code of any error encountered when this check is performed during
-- this audit. One of \"INSUFFICIENT_PERMISSIONS\" or
-- \"AUDIT_CHECK_DISABLED\".
--
-- 'message', 'auditCheckDetails_message' - The message associated with any error encountered when this check is
-- performed during this audit.
--
-- 'checkRunStatus', 'auditCheckDetails_checkRunStatus' - The completion status of this check. One of \"IN_PROGRESS\",
-- \"WAITING_FOR_DATA_COLLECTION\", \"CANCELED\", \"COMPLETED_COMPLIANT\",
-- \"COMPLETED_NON_COMPLIANT\", or \"FAILED\".
newAuditCheckDetails ::
  AuditCheckDetails
newAuditCheckDetails :: AuditCheckDetails
newAuditCheckDetails =
  AuditCheckDetails' :: Maybe Integer
-> Maybe Integer
-> Maybe Bool
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe AuditCheckRunStatus
-> AuditCheckDetails
AuditCheckDetails'
    { $sel:suppressedNonCompliantResourcesCount:AuditCheckDetails' :: Maybe Integer
suppressedNonCompliantResourcesCount =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:totalResourcesCount:AuditCheckDetails' :: Maybe Integer
totalResourcesCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:checkCompliant:AuditCheckDetails' :: Maybe Bool
checkCompliant = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:nonCompliantResourcesCount:AuditCheckDetails' :: Maybe Integer
nonCompliantResourcesCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:AuditCheckDetails' :: Maybe Text
errorCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:AuditCheckDetails' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:checkRunStatus:AuditCheckDetails' :: Maybe AuditCheckRunStatus
checkRunStatus = Maybe AuditCheckRunStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes how many of the non-compliant resources created during the
-- evaluation of an audit check were marked as suppressed.
auditCheckDetails_suppressedNonCompliantResourcesCount :: Lens.Lens' AuditCheckDetails (Prelude.Maybe Prelude.Integer)
auditCheckDetails_suppressedNonCompliantResourcesCount :: (Maybe Integer -> f (Maybe Integer))
-> AuditCheckDetails -> f AuditCheckDetails
auditCheckDetails_suppressedNonCompliantResourcesCount = (AuditCheckDetails -> Maybe Integer)
-> (AuditCheckDetails -> Maybe Integer -> AuditCheckDetails)
-> Lens
     AuditCheckDetails AuditCheckDetails (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditCheckDetails' {Maybe Integer
suppressedNonCompliantResourcesCount :: Maybe Integer
$sel:suppressedNonCompliantResourcesCount:AuditCheckDetails' :: AuditCheckDetails -> Maybe Integer
suppressedNonCompliantResourcesCount} -> Maybe Integer
suppressedNonCompliantResourcesCount) (\s :: AuditCheckDetails
s@AuditCheckDetails' {} Maybe Integer
a -> AuditCheckDetails
s {$sel:suppressedNonCompliantResourcesCount:AuditCheckDetails' :: Maybe Integer
suppressedNonCompliantResourcesCount = Maybe Integer
a} :: AuditCheckDetails)

-- | The number of resources on which the check was performed.
auditCheckDetails_totalResourcesCount :: Lens.Lens' AuditCheckDetails (Prelude.Maybe Prelude.Integer)
auditCheckDetails_totalResourcesCount :: (Maybe Integer -> f (Maybe Integer))
-> AuditCheckDetails -> f AuditCheckDetails
auditCheckDetails_totalResourcesCount = (AuditCheckDetails -> Maybe Integer)
-> (AuditCheckDetails -> Maybe Integer -> AuditCheckDetails)
-> Lens
     AuditCheckDetails AuditCheckDetails (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditCheckDetails' {Maybe Integer
totalResourcesCount :: Maybe Integer
$sel:totalResourcesCount:AuditCheckDetails' :: AuditCheckDetails -> Maybe Integer
totalResourcesCount} -> Maybe Integer
totalResourcesCount) (\s :: AuditCheckDetails
s@AuditCheckDetails' {} Maybe Integer
a -> AuditCheckDetails
s {$sel:totalResourcesCount:AuditCheckDetails' :: Maybe Integer
totalResourcesCount = Maybe Integer
a} :: AuditCheckDetails)

-- | True if the check is complete and found all resources compliant.
auditCheckDetails_checkCompliant :: Lens.Lens' AuditCheckDetails (Prelude.Maybe Prelude.Bool)
auditCheckDetails_checkCompliant :: (Maybe Bool -> f (Maybe Bool))
-> AuditCheckDetails -> f AuditCheckDetails
auditCheckDetails_checkCompliant = (AuditCheckDetails -> Maybe Bool)
-> (AuditCheckDetails -> Maybe Bool -> AuditCheckDetails)
-> Lens
     AuditCheckDetails AuditCheckDetails (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditCheckDetails' {Maybe Bool
checkCompliant :: Maybe Bool
$sel:checkCompliant:AuditCheckDetails' :: AuditCheckDetails -> Maybe Bool
checkCompliant} -> Maybe Bool
checkCompliant) (\s :: AuditCheckDetails
s@AuditCheckDetails' {} Maybe Bool
a -> AuditCheckDetails
s {$sel:checkCompliant:AuditCheckDetails' :: Maybe Bool
checkCompliant = Maybe Bool
a} :: AuditCheckDetails)

-- | The number of resources that were found noncompliant during the check.
auditCheckDetails_nonCompliantResourcesCount :: Lens.Lens' AuditCheckDetails (Prelude.Maybe Prelude.Integer)
auditCheckDetails_nonCompliantResourcesCount :: (Maybe Integer -> f (Maybe Integer))
-> AuditCheckDetails -> f AuditCheckDetails
auditCheckDetails_nonCompliantResourcesCount = (AuditCheckDetails -> Maybe Integer)
-> (AuditCheckDetails -> Maybe Integer -> AuditCheckDetails)
-> Lens
     AuditCheckDetails AuditCheckDetails (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditCheckDetails' {Maybe Integer
nonCompliantResourcesCount :: Maybe Integer
$sel:nonCompliantResourcesCount:AuditCheckDetails' :: AuditCheckDetails -> Maybe Integer
nonCompliantResourcesCount} -> Maybe Integer
nonCompliantResourcesCount) (\s :: AuditCheckDetails
s@AuditCheckDetails' {} Maybe Integer
a -> AuditCheckDetails
s {$sel:nonCompliantResourcesCount:AuditCheckDetails' :: Maybe Integer
nonCompliantResourcesCount = Maybe Integer
a} :: AuditCheckDetails)

-- | The code of any error encountered when this check is performed during
-- this audit. One of \"INSUFFICIENT_PERMISSIONS\" or
-- \"AUDIT_CHECK_DISABLED\".
auditCheckDetails_errorCode :: Lens.Lens' AuditCheckDetails (Prelude.Maybe Prelude.Text)
auditCheckDetails_errorCode :: (Maybe Text -> f (Maybe Text))
-> AuditCheckDetails -> f AuditCheckDetails
auditCheckDetails_errorCode = (AuditCheckDetails -> Maybe Text)
-> (AuditCheckDetails -> Maybe Text -> AuditCheckDetails)
-> Lens
     AuditCheckDetails AuditCheckDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditCheckDetails' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:AuditCheckDetails' :: AuditCheckDetails -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: AuditCheckDetails
s@AuditCheckDetails' {} Maybe Text
a -> AuditCheckDetails
s {$sel:errorCode:AuditCheckDetails' :: Maybe Text
errorCode = Maybe Text
a} :: AuditCheckDetails)

-- | The message associated with any error encountered when this check is
-- performed during this audit.
auditCheckDetails_message :: Lens.Lens' AuditCheckDetails (Prelude.Maybe Prelude.Text)
auditCheckDetails_message :: (Maybe Text -> f (Maybe Text))
-> AuditCheckDetails -> f AuditCheckDetails
auditCheckDetails_message = (AuditCheckDetails -> Maybe Text)
-> (AuditCheckDetails -> Maybe Text -> AuditCheckDetails)
-> Lens
     AuditCheckDetails AuditCheckDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditCheckDetails' {Maybe Text
message :: Maybe Text
$sel:message:AuditCheckDetails' :: AuditCheckDetails -> Maybe Text
message} -> Maybe Text
message) (\s :: AuditCheckDetails
s@AuditCheckDetails' {} Maybe Text
a -> AuditCheckDetails
s {$sel:message:AuditCheckDetails' :: Maybe Text
message = Maybe Text
a} :: AuditCheckDetails)

-- | The completion status of this check. One of \"IN_PROGRESS\",
-- \"WAITING_FOR_DATA_COLLECTION\", \"CANCELED\", \"COMPLETED_COMPLIANT\",
-- \"COMPLETED_NON_COMPLIANT\", or \"FAILED\".
auditCheckDetails_checkRunStatus :: Lens.Lens' AuditCheckDetails (Prelude.Maybe AuditCheckRunStatus)
auditCheckDetails_checkRunStatus :: (Maybe AuditCheckRunStatus -> f (Maybe AuditCheckRunStatus))
-> AuditCheckDetails -> f AuditCheckDetails
auditCheckDetails_checkRunStatus = (AuditCheckDetails -> Maybe AuditCheckRunStatus)
-> (AuditCheckDetails
    -> Maybe AuditCheckRunStatus -> AuditCheckDetails)
-> Lens
     AuditCheckDetails
     AuditCheckDetails
     (Maybe AuditCheckRunStatus)
     (Maybe AuditCheckRunStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditCheckDetails' {Maybe AuditCheckRunStatus
checkRunStatus :: Maybe AuditCheckRunStatus
$sel:checkRunStatus:AuditCheckDetails' :: AuditCheckDetails -> Maybe AuditCheckRunStatus
checkRunStatus} -> Maybe AuditCheckRunStatus
checkRunStatus) (\s :: AuditCheckDetails
s@AuditCheckDetails' {} Maybe AuditCheckRunStatus
a -> AuditCheckDetails
s {$sel:checkRunStatus:AuditCheckDetails' :: Maybe AuditCheckRunStatus
checkRunStatus = Maybe AuditCheckRunStatus
a} :: AuditCheckDetails)

instance Core.FromJSON AuditCheckDetails where
  parseJSON :: Value -> Parser AuditCheckDetails
parseJSON =
    String
-> (Object -> Parser AuditCheckDetails)
-> Value
-> Parser AuditCheckDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AuditCheckDetails"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Bool
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe AuditCheckRunStatus
-> AuditCheckDetails
AuditCheckDetails'
            (Maybe Integer
 -> Maybe Integer
 -> Maybe Bool
 -> Maybe Integer
 -> Maybe Text
 -> Maybe Text
 -> Maybe AuditCheckRunStatus
 -> AuditCheckDetails)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Bool
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Text
      -> Maybe AuditCheckRunStatus
      -> AuditCheckDetails)
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
"suppressedNonCompliantResourcesCount")
            Parser
  (Maybe Integer
   -> Maybe Bool
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Text
   -> Maybe AuditCheckRunStatus
   -> AuditCheckDetails)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Bool
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Text
      -> Maybe AuditCheckRunStatus
      -> AuditCheckDetails)
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
"totalResourcesCount")
            Parser
  (Maybe Bool
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Text
   -> Maybe AuditCheckRunStatus
   -> AuditCheckDetails)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Integer
      -> Maybe Text
      -> Maybe Text
      -> Maybe AuditCheckRunStatus
      -> AuditCheckDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"checkCompliant")
            Parser
  (Maybe Integer
   -> Maybe Text
   -> Maybe Text
   -> Maybe AuditCheckRunStatus
   -> AuditCheckDetails)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe AuditCheckRunStatus -> AuditCheckDetails)
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
"nonCompliantResourcesCount")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe AuditCheckRunStatus -> AuditCheckDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe AuditCheckRunStatus -> AuditCheckDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"errorCode")
            Parser
  (Maybe Text -> Maybe AuditCheckRunStatus -> AuditCheckDetails)
-> Parser (Maybe Text)
-> Parser (Maybe AuditCheckRunStatus -> AuditCheckDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"message")
            Parser (Maybe AuditCheckRunStatus -> AuditCheckDetails)
-> Parser (Maybe AuditCheckRunStatus) -> Parser AuditCheckDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AuditCheckRunStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"checkRunStatus")
      )

instance Prelude.Hashable AuditCheckDetails

instance Prelude.NFData AuditCheckDetails