{-# 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.FMS.Types.EvaluationResult
-- 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.FMS.Types.EvaluationResult where

import qualified Amazonka.Core as Core
import Amazonka.FMS.Types.PolicyComplianceStatusType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the compliance status for the account. An account is
-- considered noncompliant if it includes resources that are not protected
-- by the specified policy or that don\'t comply with the policy.
--
-- /See:/ 'newEvaluationResult' smart constructor.
data EvaluationResult = EvaluationResult'
  { -- | The number of resources that are noncompliant with the specified policy.
    -- For WAF and Shield Advanced policies, a resource is considered
    -- noncompliant if it is not associated with the policy. For security group
    -- policies, a resource is considered noncompliant if it doesn\'t comply
    -- with the rules of the policy and remediation is disabled or not
    -- possible.
    EvaluationResult -> Maybe Natural
violatorCount :: Prelude.Maybe Prelude.Natural,
    -- | Describes an Amazon Web Services account\'s compliance with the Firewall
    -- Manager policy.
    EvaluationResult -> Maybe PolicyComplianceStatusType
complianceStatus :: Prelude.Maybe PolicyComplianceStatusType,
    -- | Indicates that over 100 resources are noncompliant with the Firewall
    -- Manager policy.
    EvaluationResult -> Maybe Bool
evaluationLimitExceeded :: Prelude.Maybe Prelude.Bool
  }
  deriving (EvaluationResult -> EvaluationResult -> Bool
(EvaluationResult -> EvaluationResult -> Bool)
-> (EvaluationResult -> EvaluationResult -> Bool)
-> Eq EvaluationResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EvaluationResult -> EvaluationResult -> Bool
$c/= :: EvaluationResult -> EvaluationResult -> Bool
== :: EvaluationResult -> EvaluationResult -> Bool
$c== :: EvaluationResult -> EvaluationResult -> Bool
Prelude.Eq, ReadPrec [EvaluationResult]
ReadPrec EvaluationResult
Int -> ReadS EvaluationResult
ReadS [EvaluationResult]
(Int -> ReadS EvaluationResult)
-> ReadS [EvaluationResult]
-> ReadPrec EvaluationResult
-> ReadPrec [EvaluationResult]
-> Read EvaluationResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EvaluationResult]
$creadListPrec :: ReadPrec [EvaluationResult]
readPrec :: ReadPrec EvaluationResult
$creadPrec :: ReadPrec EvaluationResult
readList :: ReadS [EvaluationResult]
$creadList :: ReadS [EvaluationResult]
readsPrec :: Int -> ReadS EvaluationResult
$creadsPrec :: Int -> ReadS EvaluationResult
Prelude.Read, Int -> EvaluationResult -> ShowS
[EvaluationResult] -> ShowS
EvaluationResult -> String
(Int -> EvaluationResult -> ShowS)
-> (EvaluationResult -> String)
-> ([EvaluationResult] -> ShowS)
-> Show EvaluationResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EvaluationResult] -> ShowS
$cshowList :: [EvaluationResult] -> ShowS
show :: EvaluationResult -> String
$cshow :: EvaluationResult -> String
showsPrec :: Int -> EvaluationResult -> ShowS
$cshowsPrec :: Int -> EvaluationResult -> ShowS
Prelude.Show, (forall x. EvaluationResult -> Rep EvaluationResult x)
-> (forall x. Rep EvaluationResult x -> EvaluationResult)
-> Generic EvaluationResult
forall x. Rep EvaluationResult x -> EvaluationResult
forall x. EvaluationResult -> Rep EvaluationResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EvaluationResult x -> EvaluationResult
$cfrom :: forall x. EvaluationResult -> Rep EvaluationResult x
Prelude.Generic)

-- |
-- Create a value of 'EvaluationResult' 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:
--
-- 'violatorCount', 'evaluationResult_violatorCount' - The number of resources that are noncompliant with the specified policy.
-- For WAF and Shield Advanced policies, a resource is considered
-- noncompliant if it is not associated with the policy. For security group
-- policies, a resource is considered noncompliant if it doesn\'t comply
-- with the rules of the policy and remediation is disabled or not
-- possible.
--
-- 'complianceStatus', 'evaluationResult_complianceStatus' - Describes an Amazon Web Services account\'s compliance with the Firewall
-- Manager policy.
--
-- 'evaluationLimitExceeded', 'evaluationResult_evaluationLimitExceeded' - Indicates that over 100 resources are noncompliant with the Firewall
-- Manager policy.
newEvaluationResult ::
  EvaluationResult
newEvaluationResult :: EvaluationResult
newEvaluationResult =
  EvaluationResult' :: Maybe Natural
-> Maybe PolicyComplianceStatusType
-> Maybe Bool
-> EvaluationResult
EvaluationResult'
    { $sel:violatorCount:EvaluationResult' :: Maybe Natural
violatorCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:complianceStatus:EvaluationResult' :: Maybe PolicyComplianceStatusType
complianceStatus = Maybe PolicyComplianceStatusType
forall a. Maybe a
Prelude.Nothing,
      $sel:evaluationLimitExceeded:EvaluationResult' :: Maybe Bool
evaluationLimitExceeded = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of resources that are noncompliant with the specified policy.
-- For WAF and Shield Advanced policies, a resource is considered
-- noncompliant if it is not associated with the policy. For security group
-- policies, a resource is considered noncompliant if it doesn\'t comply
-- with the rules of the policy and remediation is disabled or not
-- possible.
evaluationResult_violatorCount :: Lens.Lens' EvaluationResult (Prelude.Maybe Prelude.Natural)
evaluationResult_violatorCount :: (Maybe Natural -> f (Maybe Natural))
-> EvaluationResult -> f EvaluationResult
evaluationResult_violatorCount = (EvaluationResult -> Maybe Natural)
-> (EvaluationResult -> Maybe Natural -> EvaluationResult)
-> Lens
     EvaluationResult EvaluationResult (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluationResult' {Maybe Natural
violatorCount :: Maybe Natural
$sel:violatorCount:EvaluationResult' :: EvaluationResult -> Maybe Natural
violatorCount} -> Maybe Natural
violatorCount) (\s :: EvaluationResult
s@EvaluationResult' {} Maybe Natural
a -> EvaluationResult
s {$sel:violatorCount:EvaluationResult' :: Maybe Natural
violatorCount = Maybe Natural
a} :: EvaluationResult)

-- | Describes an Amazon Web Services account\'s compliance with the Firewall
-- Manager policy.
evaluationResult_complianceStatus :: Lens.Lens' EvaluationResult (Prelude.Maybe PolicyComplianceStatusType)
evaluationResult_complianceStatus :: (Maybe PolicyComplianceStatusType
 -> f (Maybe PolicyComplianceStatusType))
-> EvaluationResult -> f EvaluationResult
evaluationResult_complianceStatus = (EvaluationResult -> Maybe PolicyComplianceStatusType)
-> (EvaluationResult
    -> Maybe PolicyComplianceStatusType -> EvaluationResult)
-> Lens
     EvaluationResult
     EvaluationResult
     (Maybe PolicyComplianceStatusType)
     (Maybe PolicyComplianceStatusType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluationResult' {Maybe PolicyComplianceStatusType
complianceStatus :: Maybe PolicyComplianceStatusType
$sel:complianceStatus:EvaluationResult' :: EvaluationResult -> Maybe PolicyComplianceStatusType
complianceStatus} -> Maybe PolicyComplianceStatusType
complianceStatus) (\s :: EvaluationResult
s@EvaluationResult' {} Maybe PolicyComplianceStatusType
a -> EvaluationResult
s {$sel:complianceStatus:EvaluationResult' :: Maybe PolicyComplianceStatusType
complianceStatus = Maybe PolicyComplianceStatusType
a} :: EvaluationResult)

-- | Indicates that over 100 resources are noncompliant with the Firewall
-- Manager policy.
evaluationResult_evaluationLimitExceeded :: Lens.Lens' EvaluationResult (Prelude.Maybe Prelude.Bool)
evaluationResult_evaluationLimitExceeded :: (Maybe Bool -> f (Maybe Bool))
-> EvaluationResult -> f EvaluationResult
evaluationResult_evaluationLimitExceeded = (EvaluationResult -> Maybe Bool)
-> (EvaluationResult -> Maybe Bool -> EvaluationResult)
-> Lens EvaluationResult EvaluationResult (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluationResult' {Maybe Bool
evaluationLimitExceeded :: Maybe Bool
$sel:evaluationLimitExceeded:EvaluationResult' :: EvaluationResult -> Maybe Bool
evaluationLimitExceeded} -> Maybe Bool
evaluationLimitExceeded) (\s :: EvaluationResult
s@EvaluationResult' {} Maybe Bool
a -> EvaluationResult
s {$sel:evaluationLimitExceeded:EvaluationResult' :: Maybe Bool
evaluationLimitExceeded = Maybe Bool
a} :: EvaluationResult)

instance Core.FromJSON EvaluationResult where
  parseJSON :: Value -> Parser EvaluationResult
parseJSON =
    String
-> (Object -> Parser EvaluationResult)
-> Value
-> Parser EvaluationResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EvaluationResult"
      ( \Object
x ->
          Maybe Natural
-> Maybe PolicyComplianceStatusType
-> Maybe Bool
-> EvaluationResult
EvaluationResult'
            (Maybe Natural
 -> Maybe PolicyComplianceStatusType
 -> Maybe Bool
 -> EvaluationResult)
-> Parser (Maybe Natural)
-> Parser
     (Maybe PolicyComplianceStatusType
      -> Maybe Bool -> EvaluationResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ViolatorCount")
            Parser
  (Maybe PolicyComplianceStatusType
   -> Maybe Bool -> EvaluationResult)
-> Parser (Maybe PolicyComplianceStatusType)
-> Parser (Maybe Bool -> EvaluationResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PolicyComplianceStatusType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComplianceStatus")
            Parser (Maybe Bool -> EvaluationResult)
-> Parser (Maybe Bool) -> Parser EvaluationResult
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
"EvaluationLimitExceeded")
      )

instance Prelude.Hashable EvaluationResult

instance Prelude.NFData EvaluationResult