{-# 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.AuditManager.Types.ControlDomainInsights
-- 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.AuditManager.Types.ControlDomainInsights where

import Amazonka.AuditManager.Types.EvidenceInsights
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

-- | A summary of the latest analytics data for a specific control domain.
--
-- Control domain insights are grouped by control domain, and ranked by the
-- highest total count of non-compliant evidence.
--
-- /See:/ 'newControlDomainInsights' smart constructor.
data ControlDomainInsights = ControlDomainInsights'
  { -- | The number of controls in the control domain that collected
    -- non-compliant evidence on the @lastUpdated@ date.
    ControlDomainInsights -> Maybe Int
controlsCountByNoncompliantEvidence :: Prelude.Maybe Prelude.Int,
    -- | A breakdown of the compliance check status for the evidence that’s
    -- associated with the control domain.
    ControlDomainInsights -> Maybe EvidenceInsights
evidenceInsights :: Prelude.Maybe EvidenceInsights,
    -- | The unique identifier for the control domain.
    ControlDomainInsights -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The time when the control domain insights were last updated.
    ControlDomainInsights -> Maybe POSIX
lastUpdated :: Prelude.Maybe Data.POSIX,
    -- | The name of the control domain.
    ControlDomainInsights -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The total number of controls in the control domain.
    ControlDomainInsights -> Maybe Int
totalControlsCount :: Prelude.Maybe Prelude.Int
  }
  deriving (ControlDomainInsights -> ControlDomainInsights -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ControlDomainInsights -> ControlDomainInsights -> Bool
$c/= :: ControlDomainInsights -> ControlDomainInsights -> Bool
== :: ControlDomainInsights -> ControlDomainInsights -> Bool
$c== :: ControlDomainInsights -> ControlDomainInsights -> Bool
Prelude.Eq, ReadPrec [ControlDomainInsights]
ReadPrec ControlDomainInsights
Int -> ReadS ControlDomainInsights
ReadS [ControlDomainInsights]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ControlDomainInsights]
$creadListPrec :: ReadPrec [ControlDomainInsights]
readPrec :: ReadPrec ControlDomainInsights
$creadPrec :: ReadPrec ControlDomainInsights
readList :: ReadS [ControlDomainInsights]
$creadList :: ReadS [ControlDomainInsights]
readsPrec :: Int -> ReadS ControlDomainInsights
$creadsPrec :: Int -> ReadS ControlDomainInsights
Prelude.Read, Int -> ControlDomainInsights -> ShowS
[ControlDomainInsights] -> ShowS
ControlDomainInsights -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ControlDomainInsights] -> ShowS
$cshowList :: [ControlDomainInsights] -> ShowS
show :: ControlDomainInsights -> String
$cshow :: ControlDomainInsights -> String
showsPrec :: Int -> ControlDomainInsights -> ShowS
$cshowsPrec :: Int -> ControlDomainInsights -> ShowS
Prelude.Show, forall x. Rep ControlDomainInsights x -> ControlDomainInsights
forall x. ControlDomainInsights -> Rep ControlDomainInsights x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ControlDomainInsights x -> ControlDomainInsights
$cfrom :: forall x. ControlDomainInsights -> Rep ControlDomainInsights x
Prelude.Generic)

-- |
-- Create a value of 'ControlDomainInsights' 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:
--
-- 'controlsCountByNoncompliantEvidence', 'controlDomainInsights_controlsCountByNoncompliantEvidence' - The number of controls in the control domain that collected
-- non-compliant evidence on the @lastUpdated@ date.
--
-- 'evidenceInsights', 'controlDomainInsights_evidenceInsights' - A breakdown of the compliance check status for the evidence that’s
-- associated with the control domain.
--
-- 'id', 'controlDomainInsights_id' - The unique identifier for the control domain.
--
-- 'lastUpdated', 'controlDomainInsights_lastUpdated' - The time when the control domain insights were last updated.
--
-- 'name', 'controlDomainInsights_name' - The name of the control domain.
--
-- 'totalControlsCount', 'controlDomainInsights_totalControlsCount' - The total number of controls in the control domain.
newControlDomainInsights ::
  ControlDomainInsights
newControlDomainInsights :: ControlDomainInsights
newControlDomainInsights =
  ControlDomainInsights'
    { $sel:controlsCountByNoncompliantEvidence:ControlDomainInsights' :: Maybe Int
controlsCountByNoncompliantEvidence =
        forall a. Maybe a
Prelude.Nothing,
      $sel:evidenceInsights:ControlDomainInsights' :: Maybe EvidenceInsights
evidenceInsights = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ControlDomainInsights' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdated:ControlDomainInsights' :: Maybe POSIX
lastUpdated = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ControlDomainInsights' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:totalControlsCount:ControlDomainInsights' :: Maybe Int
totalControlsCount = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of controls in the control domain that collected
-- non-compliant evidence on the @lastUpdated@ date.
controlDomainInsights_controlsCountByNoncompliantEvidence :: Lens.Lens' ControlDomainInsights (Prelude.Maybe Prelude.Int)
controlDomainInsights_controlsCountByNoncompliantEvidence :: Lens' ControlDomainInsights (Maybe Int)
controlDomainInsights_controlsCountByNoncompliantEvidence = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlDomainInsights' {Maybe Int
controlsCountByNoncompliantEvidence :: Maybe Int
$sel:controlsCountByNoncompliantEvidence:ControlDomainInsights' :: ControlDomainInsights -> Maybe Int
controlsCountByNoncompliantEvidence} -> Maybe Int
controlsCountByNoncompliantEvidence) (\s :: ControlDomainInsights
s@ControlDomainInsights' {} Maybe Int
a -> ControlDomainInsights
s {$sel:controlsCountByNoncompliantEvidence:ControlDomainInsights' :: Maybe Int
controlsCountByNoncompliantEvidence = Maybe Int
a} :: ControlDomainInsights)

-- | A breakdown of the compliance check status for the evidence that’s
-- associated with the control domain.
controlDomainInsights_evidenceInsights :: Lens.Lens' ControlDomainInsights (Prelude.Maybe EvidenceInsights)
controlDomainInsights_evidenceInsights :: Lens' ControlDomainInsights (Maybe EvidenceInsights)
controlDomainInsights_evidenceInsights = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlDomainInsights' {Maybe EvidenceInsights
evidenceInsights :: Maybe EvidenceInsights
$sel:evidenceInsights:ControlDomainInsights' :: ControlDomainInsights -> Maybe EvidenceInsights
evidenceInsights} -> Maybe EvidenceInsights
evidenceInsights) (\s :: ControlDomainInsights
s@ControlDomainInsights' {} Maybe EvidenceInsights
a -> ControlDomainInsights
s {$sel:evidenceInsights:ControlDomainInsights' :: Maybe EvidenceInsights
evidenceInsights = Maybe EvidenceInsights
a} :: ControlDomainInsights)

-- | The unique identifier for the control domain.
controlDomainInsights_id :: Lens.Lens' ControlDomainInsights (Prelude.Maybe Prelude.Text)
controlDomainInsights_id :: Lens' ControlDomainInsights (Maybe Text)
controlDomainInsights_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlDomainInsights' {Maybe Text
id :: Maybe Text
$sel:id:ControlDomainInsights' :: ControlDomainInsights -> Maybe Text
id} -> Maybe Text
id) (\s :: ControlDomainInsights
s@ControlDomainInsights' {} Maybe Text
a -> ControlDomainInsights
s {$sel:id:ControlDomainInsights' :: Maybe Text
id = Maybe Text
a} :: ControlDomainInsights)

-- | The time when the control domain insights were last updated.
controlDomainInsights_lastUpdated :: Lens.Lens' ControlDomainInsights (Prelude.Maybe Prelude.UTCTime)
controlDomainInsights_lastUpdated :: Lens' ControlDomainInsights (Maybe UTCTime)
controlDomainInsights_lastUpdated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlDomainInsights' {Maybe POSIX
lastUpdated :: Maybe POSIX
$sel:lastUpdated:ControlDomainInsights' :: ControlDomainInsights -> Maybe POSIX
lastUpdated} -> Maybe POSIX
lastUpdated) (\s :: ControlDomainInsights
s@ControlDomainInsights' {} Maybe POSIX
a -> ControlDomainInsights
s {$sel:lastUpdated:ControlDomainInsights' :: Maybe POSIX
lastUpdated = Maybe POSIX
a} :: ControlDomainInsights) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the control domain.
controlDomainInsights_name :: Lens.Lens' ControlDomainInsights (Prelude.Maybe Prelude.Text)
controlDomainInsights_name :: Lens' ControlDomainInsights (Maybe Text)
controlDomainInsights_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlDomainInsights' {Maybe Text
name :: Maybe Text
$sel:name:ControlDomainInsights' :: ControlDomainInsights -> Maybe Text
name} -> Maybe Text
name) (\s :: ControlDomainInsights
s@ControlDomainInsights' {} Maybe Text
a -> ControlDomainInsights
s {$sel:name:ControlDomainInsights' :: Maybe Text
name = Maybe Text
a} :: ControlDomainInsights)

-- | The total number of controls in the control domain.
controlDomainInsights_totalControlsCount :: Lens.Lens' ControlDomainInsights (Prelude.Maybe Prelude.Int)
controlDomainInsights_totalControlsCount :: Lens' ControlDomainInsights (Maybe Int)
controlDomainInsights_totalControlsCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlDomainInsights' {Maybe Int
totalControlsCount :: Maybe Int
$sel:totalControlsCount:ControlDomainInsights' :: ControlDomainInsights -> Maybe Int
totalControlsCount} -> Maybe Int
totalControlsCount) (\s :: ControlDomainInsights
s@ControlDomainInsights' {} Maybe Int
a -> ControlDomainInsights
s {$sel:totalControlsCount:ControlDomainInsights' :: Maybe Int
totalControlsCount = Maybe Int
a} :: ControlDomainInsights)

instance Data.FromJSON ControlDomainInsights where
  parseJSON :: Value -> Parser ControlDomainInsights
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ControlDomainInsights"
      ( \Object
x ->
          Maybe Int
-> Maybe EvidenceInsights
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Int
-> ControlDomainInsights
ControlDomainInsights'
            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
"controlsCountByNoncompliantEvidence")
            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
"evidenceInsights")
            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
"id")
            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
"lastUpdated")
            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
"name")
            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
"totalControlsCount")
      )

instance Prelude.Hashable ControlDomainInsights where
  hashWithSalt :: Int -> ControlDomainInsights -> Int
hashWithSalt Int
_salt ControlDomainInsights' {Maybe Int
Maybe Text
Maybe POSIX
Maybe EvidenceInsights
totalControlsCount :: Maybe Int
name :: Maybe Text
lastUpdated :: Maybe POSIX
id :: Maybe Text
evidenceInsights :: Maybe EvidenceInsights
controlsCountByNoncompliantEvidence :: Maybe Int
$sel:totalControlsCount:ControlDomainInsights' :: ControlDomainInsights -> Maybe Int
$sel:name:ControlDomainInsights' :: ControlDomainInsights -> Maybe Text
$sel:lastUpdated:ControlDomainInsights' :: ControlDomainInsights -> Maybe POSIX
$sel:id:ControlDomainInsights' :: ControlDomainInsights -> Maybe Text
$sel:evidenceInsights:ControlDomainInsights' :: ControlDomainInsights -> Maybe EvidenceInsights
$sel:controlsCountByNoncompliantEvidence:ControlDomainInsights' :: ControlDomainInsights -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
controlsCountByNoncompliantEvidence
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EvidenceInsights
evidenceInsights
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
totalControlsCount

instance Prelude.NFData ControlDomainInsights where
  rnf :: ControlDomainInsights -> ()
rnf ControlDomainInsights' {Maybe Int
Maybe Text
Maybe POSIX
Maybe EvidenceInsights
totalControlsCount :: Maybe Int
name :: Maybe Text
lastUpdated :: Maybe POSIX
id :: Maybe Text
evidenceInsights :: Maybe EvidenceInsights
controlsCountByNoncompliantEvidence :: Maybe Int
$sel:totalControlsCount:ControlDomainInsights' :: ControlDomainInsights -> Maybe Int
$sel:name:ControlDomainInsights' :: ControlDomainInsights -> Maybe Text
$sel:lastUpdated:ControlDomainInsights' :: ControlDomainInsights -> Maybe POSIX
$sel:id:ControlDomainInsights' :: ControlDomainInsights -> Maybe Text
$sel:evidenceInsights:ControlDomainInsights' :: ControlDomainInsights -> Maybe EvidenceInsights
$sel:controlsCountByNoncompliantEvidence:ControlDomainInsights' :: ControlDomainInsights -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
controlsCountByNoncompliantEvidence
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EvidenceInsights
evidenceInsights
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
totalControlsCount