{-# 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.Config.Types.ConformancePackComplianceScore
-- 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.Config.Types.ConformancePackComplianceScore where

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 compliance score is the percentage of the number of compliant
-- rule-resource combinations in a conformance pack compared to the number
-- of total possible rule-resource combinations in the conformance pack.
-- This metric provides you with a high-level view of the compliance state
-- of your conformance packs. You can use it to identify, investigate, and
-- understand the level of compliance in your conformance packs.
--
-- /See:/ 'newConformancePackComplianceScore' smart constructor.
data ConformancePackComplianceScore = ConformancePackComplianceScore'
  { -- | The name of the conformance pack.
    ConformancePackComplianceScore -> Maybe Text
conformancePackName :: Prelude.Maybe Prelude.Text,
    -- | The time that the conformance pack compliance score was last updated.
    ConformancePackComplianceScore -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Data.POSIX,
    -- | Compliance score for the conformance pack. Conformance packs with no
    -- evaluation results will have a compliance score of @INSUFFICIENT_DATA@.
    ConformancePackComplianceScore -> Maybe Text
score :: Prelude.Maybe Prelude.Text
  }
  deriving (ConformancePackComplianceScore
-> ConformancePackComplianceScore -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConformancePackComplianceScore
-> ConformancePackComplianceScore -> Bool
$c/= :: ConformancePackComplianceScore
-> ConformancePackComplianceScore -> Bool
== :: ConformancePackComplianceScore
-> ConformancePackComplianceScore -> Bool
$c== :: ConformancePackComplianceScore
-> ConformancePackComplianceScore -> Bool
Prelude.Eq, ReadPrec [ConformancePackComplianceScore]
ReadPrec ConformancePackComplianceScore
Int -> ReadS ConformancePackComplianceScore
ReadS [ConformancePackComplianceScore]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConformancePackComplianceScore]
$creadListPrec :: ReadPrec [ConformancePackComplianceScore]
readPrec :: ReadPrec ConformancePackComplianceScore
$creadPrec :: ReadPrec ConformancePackComplianceScore
readList :: ReadS [ConformancePackComplianceScore]
$creadList :: ReadS [ConformancePackComplianceScore]
readsPrec :: Int -> ReadS ConformancePackComplianceScore
$creadsPrec :: Int -> ReadS ConformancePackComplianceScore
Prelude.Read, Int -> ConformancePackComplianceScore -> ShowS
[ConformancePackComplianceScore] -> ShowS
ConformancePackComplianceScore -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConformancePackComplianceScore] -> ShowS
$cshowList :: [ConformancePackComplianceScore] -> ShowS
show :: ConformancePackComplianceScore -> String
$cshow :: ConformancePackComplianceScore -> String
showsPrec :: Int -> ConformancePackComplianceScore -> ShowS
$cshowsPrec :: Int -> ConformancePackComplianceScore -> ShowS
Prelude.Show, forall x.
Rep ConformancePackComplianceScore x
-> ConformancePackComplianceScore
forall x.
ConformancePackComplianceScore
-> Rep ConformancePackComplianceScore x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConformancePackComplianceScore x
-> ConformancePackComplianceScore
$cfrom :: forall x.
ConformancePackComplianceScore
-> Rep ConformancePackComplianceScore x
Prelude.Generic)

-- |
-- Create a value of 'ConformancePackComplianceScore' 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:
--
-- 'conformancePackName', 'conformancePackComplianceScore_conformancePackName' - The name of the conformance pack.
--
-- 'lastUpdatedTime', 'conformancePackComplianceScore_lastUpdatedTime' - The time that the conformance pack compliance score was last updated.
--
-- 'score', 'conformancePackComplianceScore_score' - Compliance score for the conformance pack. Conformance packs with no
-- evaluation results will have a compliance score of @INSUFFICIENT_DATA@.
newConformancePackComplianceScore ::
  ConformancePackComplianceScore
newConformancePackComplianceScore :: ConformancePackComplianceScore
newConformancePackComplianceScore =
  ConformancePackComplianceScore'
    { $sel:conformancePackName:ConformancePackComplianceScore' :: Maybe Text
conformancePackName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:ConformancePackComplianceScore' :: Maybe POSIX
lastUpdatedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:score:ConformancePackComplianceScore' :: Maybe Text
score = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the conformance pack.
conformancePackComplianceScore_conformancePackName :: Lens.Lens' ConformancePackComplianceScore (Prelude.Maybe Prelude.Text)
conformancePackComplianceScore_conformancePackName :: Lens' ConformancePackComplianceScore (Maybe Text)
conformancePackComplianceScore_conformancePackName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackComplianceScore' {Maybe Text
conformancePackName :: Maybe Text
$sel:conformancePackName:ConformancePackComplianceScore' :: ConformancePackComplianceScore -> Maybe Text
conformancePackName} -> Maybe Text
conformancePackName) (\s :: ConformancePackComplianceScore
s@ConformancePackComplianceScore' {} Maybe Text
a -> ConformancePackComplianceScore
s {$sel:conformancePackName:ConformancePackComplianceScore' :: Maybe Text
conformancePackName = Maybe Text
a} :: ConformancePackComplianceScore)

-- | The time that the conformance pack compliance score was last updated.
conformancePackComplianceScore_lastUpdatedTime :: Lens.Lens' ConformancePackComplianceScore (Prelude.Maybe Prelude.UTCTime)
conformancePackComplianceScore_lastUpdatedTime :: Lens' ConformancePackComplianceScore (Maybe UTCTime)
conformancePackComplianceScore_lastUpdatedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackComplianceScore' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:ConformancePackComplianceScore' :: ConformancePackComplianceScore -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: ConformancePackComplianceScore
s@ConformancePackComplianceScore' {} Maybe POSIX
a -> ConformancePackComplianceScore
s {$sel:lastUpdatedTime:ConformancePackComplianceScore' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: ConformancePackComplianceScore) 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

-- | Compliance score for the conformance pack. Conformance packs with no
-- evaluation results will have a compliance score of @INSUFFICIENT_DATA@.
conformancePackComplianceScore_score :: Lens.Lens' ConformancePackComplianceScore (Prelude.Maybe Prelude.Text)
conformancePackComplianceScore_score :: Lens' ConformancePackComplianceScore (Maybe Text)
conformancePackComplianceScore_score = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackComplianceScore' {Maybe Text
score :: Maybe Text
$sel:score:ConformancePackComplianceScore' :: ConformancePackComplianceScore -> Maybe Text
score} -> Maybe Text
score) (\s :: ConformancePackComplianceScore
s@ConformancePackComplianceScore' {} Maybe Text
a -> ConformancePackComplianceScore
s {$sel:score:ConformancePackComplianceScore' :: Maybe Text
score = Maybe Text
a} :: ConformancePackComplianceScore)

instance Data.FromJSON ConformancePackComplianceScore where
  parseJSON :: Value -> Parser ConformancePackComplianceScore
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConformancePackComplianceScore"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX -> Maybe Text -> ConformancePackComplianceScore
ConformancePackComplianceScore'
            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
"ConformancePackName")
            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
"LastUpdatedTime")
            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
"Score")
      )

instance
  Prelude.Hashable
    ConformancePackComplianceScore
  where
  hashWithSalt :: Int -> ConformancePackComplianceScore -> Int
hashWithSalt
    Int
_salt
    ConformancePackComplianceScore' {Maybe Text
Maybe POSIX
score :: Maybe Text
lastUpdatedTime :: Maybe POSIX
conformancePackName :: Maybe Text
$sel:score:ConformancePackComplianceScore' :: ConformancePackComplianceScore -> Maybe Text
$sel:lastUpdatedTime:ConformancePackComplianceScore' :: ConformancePackComplianceScore -> Maybe POSIX
$sel:conformancePackName:ConformancePackComplianceScore' :: ConformancePackComplianceScore -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
conformancePackName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTime
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
score

instance
  Prelude.NFData
    ConformancePackComplianceScore
  where
  rnf :: ConformancePackComplianceScore -> ()
rnf ConformancePackComplianceScore' {Maybe Text
Maybe POSIX
score :: Maybe Text
lastUpdatedTime :: Maybe POSIX
conformancePackName :: Maybe Text
$sel:score:ConformancePackComplianceScore' :: ConformancePackComplianceScore -> Maybe Text
$sel:lastUpdatedTime:ConformancePackComplianceScore' :: ConformancePackComplianceScore -> Maybe POSIX
$sel:conformancePackName:ConformancePackComplianceScore' :: ConformancePackComplianceScore -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
conformancePackName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
score