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

import Amazonka.Config.Types.ComplianceType
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

-- | Identifies an Amazon Web Services resource and indicates whether it
-- complies with the Config rule that it was evaluated against.
--
-- /See:/ 'newExternalEvaluation' smart constructor.
data ExternalEvaluation = ExternalEvaluation'
  { -- | Supplementary information about the reason of compliance. For example,
    -- this task was completed on a specific date.
    ExternalEvaluation -> Maybe Text
annotation :: Prelude.Maybe Prelude.Text,
    -- | The evaluated compliance resource type. Config accepts @AWS::::Account@
    -- resource type.
    ExternalEvaluation -> Text
complianceResourceType :: Prelude.Text,
    -- | The evaluated compliance resource ID. Config accepts only Amazon Web
    -- Services account ID.
    ExternalEvaluation -> Text
complianceResourceId :: Prelude.Text,
    -- | The compliance of the Amazon Web Services resource. The valid values are
    -- @COMPLIANT, NON_COMPLIANT, @ and @NOT_APPLICABLE@.
    ExternalEvaluation -> ComplianceType
complianceType :: ComplianceType,
    -- | The time when the compliance was recorded.
    ExternalEvaluation -> POSIX
orderingTimestamp :: Data.POSIX
  }
  deriving (ExternalEvaluation -> ExternalEvaluation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalEvaluation -> ExternalEvaluation -> Bool
$c/= :: ExternalEvaluation -> ExternalEvaluation -> Bool
== :: ExternalEvaluation -> ExternalEvaluation -> Bool
$c== :: ExternalEvaluation -> ExternalEvaluation -> Bool
Prelude.Eq, ReadPrec [ExternalEvaluation]
ReadPrec ExternalEvaluation
Int -> ReadS ExternalEvaluation
ReadS [ExternalEvaluation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExternalEvaluation]
$creadListPrec :: ReadPrec [ExternalEvaluation]
readPrec :: ReadPrec ExternalEvaluation
$creadPrec :: ReadPrec ExternalEvaluation
readList :: ReadS [ExternalEvaluation]
$creadList :: ReadS [ExternalEvaluation]
readsPrec :: Int -> ReadS ExternalEvaluation
$creadsPrec :: Int -> ReadS ExternalEvaluation
Prelude.Read, Int -> ExternalEvaluation -> ShowS
[ExternalEvaluation] -> ShowS
ExternalEvaluation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExternalEvaluation] -> ShowS
$cshowList :: [ExternalEvaluation] -> ShowS
show :: ExternalEvaluation -> String
$cshow :: ExternalEvaluation -> String
showsPrec :: Int -> ExternalEvaluation -> ShowS
$cshowsPrec :: Int -> ExternalEvaluation -> ShowS
Prelude.Show, forall x. Rep ExternalEvaluation x -> ExternalEvaluation
forall x. ExternalEvaluation -> Rep ExternalEvaluation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExternalEvaluation x -> ExternalEvaluation
$cfrom :: forall x. ExternalEvaluation -> Rep ExternalEvaluation x
Prelude.Generic)

-- |
-- Create a value of 'ExternalEvaluation' 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:
--
-- 'annotation', 'externalEvaluation_annotation' - Supplementary information about the reason of compliance. For example,
-- this task was completed on a specific date.
--
-- 'complianceResourceType', 'externalEvaluation_complianceResourceType' - The evaluated compliance resource type. Config accepts @AWS::::Account@
-- resource type.
--
-- 'complianceResourceId', 'externalEvaluation_complianceResourceId' - The evaluated compliance resource ID. Config accepts only Amazon Web
-- Services account ID.
--
-- 'complianceType', 'externalEvaluation_complianceType' - The compliance of the Amazon Web Services resource. The valid values are
-- @COMPLIANT, NON_COMPLIANT, @ and @NOT_APPLICABLE@.
--
-- 'orderingTimestamp', 'externalEvaluation_orderingTimestamp' - The time when the compliance was recorded.
newExternalEvaluation ::
  -- | 'complianceResourceType'
  Prelude.Text ->
  -- | 'complianceResourceId'
  Prelude.Text ->
  -- | 'complianceType'
  ComplianceType ->
  -- | 'orderingTimestamp'
  Prelude.UTCTime ->
  ExternalEvaluation
newExternalEvaluation :: Text -> Text -> ComplianceType -> UTCTime -> ExternalEvaluation
newExternalEvaluation
  Text
pComplianceResourceType_
  Text
pComplianceResourceId_
  ComplianceType
pComplianceType_
  UTCTime
pOrderingTimestamp_ =
    ExternalEvaluation'
      { $sel:annotation:ExternalEvaluation' :: Maybe Text
annotation = forall a. Maybe a
Prelude.Nothing,
        $sel:complianceResourceType:ExternalEvaluation' :: Text
complianceResourceType = Text
pComplianceResourceType_,
        $sel:complianceResourceId:ExternalEvaluation' :: Text
complianceResourceId = Text
pComplianceResourceId_,
        $sel:complianceType:ExternalEvaluation' :: ComplianceType
complianceType = ComplianceType
pComplianceType_,
        $sel:orderingTimestamp:ExternalEvaluation' :: POSIX
orderingTimestamp =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pOrderingTimestamp_
      }

-- | Supplementary information about the reason of compliance. For example,
-- this task was completed on a specific date.
externalEvaluation_annotation :: Lens.Lens' ExternalEvaluation (Prelude.Maybe Prelude.Text)
externalEvaluation_annotation :: Lens' ExternalEvaluation (Maybe Text)
externalEvaluation_annotation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalEvaluation' {Maybe Text
annotation :: Maybe Text
$sel:annotation:ExternalEvaluation' :: ExternalEvaluation -> Maybe Text
annotation} -> Maybe Text
annotation) (\s :: ExternalEvaluation
s@ExternalEvaluation' {} Maybe Text
a -> ExternalEvaluation
s {$sel:annotation:ExternalEvaluation' :: Maybe Text
annotation = Maybe Text
a} :: ExternalEvaluation)

-- | The evaluated compliance resource type. Config accepts @AWS::::Account@
-- resource type.
externalEvaluation_complianceResourceType :: Lens.Lens' ExternalEvaluation Prelude.Text
externalEvaluation_complianceResourceType :: Lens' ExternalEvaluation Text
externalEvaluation_complianceResourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalEvaluation' {Text
complianceResourceType :: Text
$sel:complianceResourceType:ExternalEvaluation' :: ExternalEvaluation -> Text
complianceResourceType} -> Text
complianceResourceType) (\s :: ExternalEvaluation
s@ExternalEvaluation' {} Text
a -> ExternalEvaluation
s {$sel:complianceResourceType:ExternalEvaluation' :: Text
complianceResourceType = Text
a} :: ExternalEvaluation)

-- | The evaluated compliance resource ID. Config accepts only Amazon Web
-- Services account ID.
externalEvaluation_complianceResourceId :: Lens.Lens' ExternalEvaluation Prelude.Text
externalEvaluation_complianceResourceId :: Lens' ExternalEvaluation Text
externalEvaluation_complianceResourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalEvaluation' {Text
complianceResourceId :: Text
$sel:complianceResourceId:ExternalEvaluation' :: ExternalEvaluation -> Text
complianceResourceId} -> Text
complianceResourceId) (\s :: ExternalEvaluation
s@ExternalEvaluation' {} Text
a -> ExternalEvaluation
s {$sel:complianceResourceId:ExternalEvaluation' :: Text
complianceResourceId = Text
a} :: ExternalEvaluation)

-- | The compliance of the Amazon Web Services resource. The valid values are
-- @COMPLIANT, NON_COMPLIANT, @ and @NOT_APPLICABLE@.
externalEvaluation_complianceType :: Lens.Lens' ExternalEvaluation ComplianceType
externalEvaluation_complianceType :: Lens' ExternalEvaluation ComplianceType
externalEvaluation_complianceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalEvaluation' {ComplianceType
complianceType :: ComplianceType
$sel:complianceType:ExternalEvaluation' :: ExternalEvaluation -> ComplianceType
complianceType} -> ComplianceType
complianceType) (\s :: ExternalEvaluation
s@ExternalEvaluation' {} ComplianceType
a -> ExternalEvaluation
s {$sel:complianceType:ExternalEvaluation' :: ComplianceType
complianceType = ComplianceType
a} :: ExternalEvaluation)

-- | The time when the compliance was recorded.
externalEvaluation_orderingTimestamp :: Lens.Lens' ExternalEvaluation Prelude.UTCTime
externalEvaluation_orderingTimestamp :: Lens' ExternalEvaluation UTCTime
externalEvaluation_orderingTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalEvaluation' {POSIX
orderingTimestamp :: POSIX
$sel:orderingTimestamp:ExternalEvaluation' :: ExternalEvaluation -> POSIX
orderingTimestamp} -> POSIX
orderingTimestamp) (\s :: ExternalEvaluation
s@ExternalEvaluation' {} POSIX
a -> ExternalEvaluation
s {$sel:orderingTimestamp:ExternalEvaluation' :: POSIX
orderingTimestamp = POSIX
a} :: ExternalEvaluation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Prelude.Hashable ExternalEvaluation where
  hashWithSalt :: Int -> ExternalEvaluation -> Int
hashWithSalt Int
_salt ExternalEvaluation' {Maybe Text
Text
POSIX
ComplianceType
orderingTimestamp :: POSIX
complianceType :: ComplianceType
complianceResourceId :: Text
complianceResourceType :: Text
annotation :: Maybe Text
$sel:orderingTimestamp:ExternalEvaluation' :: ExternalEvaluation -> POSIX
$sel:complianceType:ExternalEvaluation' :: ExternalEvaluation -> ComplianceType
$sel:complianceResourceId:ExternalEvaluation' :: ExternalEvaluation -> Text
$sel:complianceResourceType:ExternalEvaluation' :: ExternalEvaluation -> Text
$sel:annotation:ExternalEvaluation' :: ExternalEvaluation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
annotation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
complianceResourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
complianceResourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ComplianceType
complianceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
orderingTimestamp

instance Prelude.NFData ExternalEvaluation where
  rnf :: ExternalEvaluation -> ()
rnf ExternalEvaluation' {Maybe Text
Text
POSIX
ComplianceType
orderingTimestamp :: POSIX
complianceType :: ComplianceType
complianceResourceId :: Text
complianceResourceType :: Text
annotation :: Maybe Text
$sel:orderingTimestamp:ExternalEvaluation' :: ExternalEvaluation -> POSIX
$sel:complianceType:ExternalEvaluation' :: ExternalEvaluation -> ComplianceType
$sel:complianceResourceId:ExternalEvaluation' :: ExternalEvaluation -> Text
$sel:complianceResourceType:ExternalEvaluation' :: ExternalEvaluation -> Text
$sel:annotation:ExternalEvaluation' :: ExternalEvaluation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
annotation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
complianceResourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
complianceResourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ComplianceType
complianceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
orderingTimestamp

instance Data.ToJSON ExternalEvaluation where
  toJSON :: ExternalEvaluation -> Value
toJSON ExternalEvaluation' {Maybe Text
Text
POSIX
ComplianceType
orderingTimestamp :: POSIX
complianceType :: ComplianceType
complianceResourceId :: Text
complianceResourceType :: Text
annotation :: Maybe Text
$sel:orderingTimestamp:ExternalEvaluation' :: ExternalEvaluation -> POSIX
$sel:complianceType:ExternalEvaluation' :: ExternalEvaluation -> ComplianceType
$sel:complianceResourceId:ExternalEvaluation' :: ExternalEvaluation -> Text
$sel:complianceResourceType:ExternalEvaluation' :: ExternalEvaluation -> Text
$sel:annotation:ExternalEvaluation' :: ExternalEvaluation -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Annotation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
annotation,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"ComplianceResourceType"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
complianceResourceType
              ),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"ComplianceResourceId"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
complianceResourceId
              ),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ComplianceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ComplianceType
complianceType),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"OrderingTimestamp" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= POSIX
orderingTimestamp)
          ]
      )