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

import Amazonka.AuditManager.Types.AWSAccount
import Amazonka.AuditManager.Types.AssessmentFramework
import Amazonka.AuditManager.Types.AssessmentMetadata
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An entity that defines the scope of audit evidence collected by Audit
-- Manager. An Audit Manager assessment is an implementation of an Audit
-- Manager framework.
--
-- /See:/ 'newAssessment' smart constructor.
data Assessment = Assessment'
  { -- | The framework from which the assessment was created.
    Assessment -> Maybe AssessmentFramework
framework :: Prelude.Maybe AssessmentFramework,
    -- | The Amazon Resource Name (ARN) of the assessment.
    Assessment -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services account associated with the assessment.
    Assessment -> Maybe AWSAccount
awsAccount :: Prelude.Maybe AWSAccount,
    -- | The metadata for the specified assessment.
    Assessment -> Maybe AssessmentMetadata
metadata :: Prelude.Maybe AssessmentMetadata,
    -- | The tags associated with the assessment.
    Assessment -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (Assessment -> Assessment -> Bool
(Assessment -> Assessment -> Bool)
-> (Assessment -> Assessment -> Bool) -> Eq Assessment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Assessment -> Assessment -> Bool
$c/= :: Assessment -> Assessment -> Bool
== :: Assessment -> Assessment -> Bool
$c== :: Assessment -> Assessment -> Bool
Prelude.Eq, ReadPrec [Assessment]
ReadPrec Assessment
Int -> ReadS Assessment
ReadS [Assessment]
(Int -> ReadS Assessment)
-> ReadS [Assessment]
-> ReadPrec Assessment
-> ReadPrec [Assessment]
-> Read Assessment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Assessment]
$creadListPrec :: ReadPrec [Assessment]
readPrec :: ReadPrec Assessment
$creadPrec :: ReadPrec Assessment
readList :: ReadS [Assessment]
$creadList :: ReadS [Assessment]
readsPrec :: Int -> ReadS Assessment
$creadsPrec :: Int -> ReadS Assessment
Prelude.Read, Int -> Assessment -> ShowS
[Assessment] -> ShowS
Assessment -> String
(Int -> Assessment -> ShowS)
-> (Assessment -> String)
-> ([Assessment] -> ShowS)
-> Show Assessment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Assessment] -> ShowS
$cshowList :: [Assessment] -> ShowS
show :: Assessment -> String
$cshow :: Assessment -> String
showsPrec :: Int -> Assessment -> ShowS
$cshowsPrec :: Int -> Assessment -> ShowS
Prelude.Show, (forall x. Assessment -> Rep Assessment x)
-> (forall x. Rep Assessment x -> Assessment) -> Generic Assessment
forall x. Rep Assessment x -> Assessment
forall x. Assessment -> Rep Assessment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Assessment x -> Assessment
$cfrom :: forall x. Assessment -> Rep Assessment x
Prelude.Generic)

-- |
-- Create a value of 'Assessment' 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:
--
-- 'framework', 'assessment_framework' - The framework from which the assessment was created.
--
-- 'arn', 'assessment_arn' - The Amazon Resource Name (ARN) of the assessment.
--
-- 'awsAccount', 'assessment_awsAccount' - The Amazon Web Services account associated with the assessment.
--
-- 'metadata', 'assessment_metadata' - The metadata for the specified assessment.
--
-- 'tags', 'assessment_tags' - The tags associated with the assessment.
newAssessment ::
  Assessment
newAssessment :: Assessment
newAssessment =
  Assessment' :: Maybe AssessmentFramework
-> Maybe Text
-> Maybe AWSAccount
-> Maybe AssessmentMetadata
-> Maybe (HashMap Text Text)
-> Assessment
Assessment'
    { $sel:framework:Assessment' :: Maybe AssessmentFramework
framework = Maybe AssessmentFramework
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Assessment' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:awsAccount:Assessment' :: Maybe AWSAccount
awsAccount = Maybe AWSAccount
forall a. Maybe a
Prelude.Nothing,
      $sel:metadata:Assessment' :: Maybe AssessmentMetadata
metadata = Maybe AssessmentMetadata
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Assessment' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The framework from which the assessment was created.
assessment_framework :: Lens.Lens' Assessment (Prelude.Maybe AssessmentFramework)
assessment_framework :: (Maybe AssessmentFramework -> f (Maybe AssessmentFramework))
-> Assessment -> f Assessment
assessment_framework = (Assessment -> Maybe AssessmentFramework)
-> (Assessment -> Maybe AssessmentFramework -> Assessment)
-> Lens
     Assessment
     Assessment
     (Maybe AssessmentFramework)
     (Maybe AssessmentFramework)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assessment' {Maybe AssessmentFramework
framework :: Maybe AssessmentFramework
$sel:framework:Assessment' :: Assessment -> Maybe AssessmentFramework
framework} -> Maybe AssessmentFramework
framework) (\s :: Assessment
s@Assessment' {} Maybe AssessmentFramework
a -> Assessment
s {$sel:framework:Assessment' :: Maybe AssessmentFramework
framework = Maybe AssessmentFramework
a} :: Assessment)

-- | The Amazon Resource Name (ARN) of the assessment.
assessment_arn :: Lens.Lens' Assessment (Prelude.Maybe Prelude.Text)
assessment_arn :: (Maybe Text -> f (Maybe Text)) -> Assessment -> f Assessment
assessment_arn = (Assessment -> Maybe Text)
-> (Assessment -> Maybe Text -> Assessment)
-> Lens Assessment Assessment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assessment' {Maybe Text
arn :: Maybe Text
$sel:arn:Assessment' :: Assessment -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Assessment
s@Assessment' {} Maybe Text
a -> Assessment
s {$sel:arn:Assessment' :: Maybe Text
arn = Maybe Text
a} :: Assessment)

-- | The Amazon Web Services account associated with the assessment.
assessment_awsAccount :: Lens.Lens' Assessment (Prelude.Maybe AWSAccount)
assessment_awsAccount :: (Maybe AWSAccount -> f (Maybe AWSAccount))
-> Assessment -> f Assessment
assessment_awsAccount = (Assessment -> Maybe AWSAccount)
-> (Assessment -> Maybe AWSAccount -> Assessment)
-> Lens Assessment Assessment (Maybe AWSAccount) (Maybe AWSAccount)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assessment' {Maybe AWSAccount
awsAccount :: Maybe AWSAccount
$sel:awsAccount:Assessment' :: Assessment -> Maybe AWSAccount
awsAccount} -> Maybe AWSAccount
awsAccount) (\s :: Assessment
s@Assessment' {} Maybe AWSAccount
a -> Assessment
s {$sel:awsAccount:Assessment' :: Maybe AWSAccount
awsAccount = Maybe AWSAccount
a} :: Assessment)

-- | The metadata for the specified assessment.
assessment_metadata :: Lens.Lens' Assessment (Prelude.Maybe AssessmentMetadata)
assessment_metadata :: (Maybe AssessmentMetadata -> f (Maybe AssessmentMetadata))
-> Assessment -> f Assessment
assessment_metadata = (Assessment -> Maybe AssessmentMetadata)
-> (Assessment -> Maybe AssessmentMetadata -> Assessment)
-> Lens
     Assessment
     Assessment
     (Maybe AssessmentMetadata)
     (Maybe AssessmentMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assessment' {Maybe AssessmentMetadata
metadata :: Maybe AssessmentMetadata
$sel:metadata:Assessment' :: Assessment -> Maybe AssessmentMetadata
metadata} -> Maybe AssessmentMetadata
metadata) (\s :: Assessment
s@Assessment' {} Maybe AssessmentMetadata
a -> Assessment
s {$sel:metadata:Assessment' :: Maybe AssessmentMetadata
metadata = Maybe AssessmentMetadata
a} :: Assessment)

-- | The tags associated with the assessment.
assessment_tags :: Lens.Lens' Assessment (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
assessment_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Assessment -> f Assessment
assessment_tags = (Assessment -> Maybe (HashMap Text Text))
-> (Assessment -> Maybe (HashMap Text Text) -> Assessment)
-> Lens
     Assessment
     Assessment
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assessment' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Assessment' :: Assessment -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Assessment
s@Assessment' {} Maybe (HashMap Text Text)
a -> Assessment
s {$sel:tags:Assessment' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: Assessment) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> Assessment -> f Assessment)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Assessment
-> f Assessment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Assessment where
  parseJSON :: Value -> Parser Assessment
parseJSON =
    String
-> (Object -> Parser Assessment) -> Value -> Parser Assessment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Assessment"
      ( \Object
x ->
          Maybe AssessmentFramework
-> Maybe Text
-> Maybe AWSAccount
-> Maybe AssessmentMetadata
-> Maybe (HashMap Text Text)
-> Assessment
Assessment'
            (Maybe AssessmentFramework
 -> Maybe Text
 -> Maybe AWSAccount
 -> Maybe AssessmentMetadata
 -> Maybe (HashMap Text Text)
 -> Assessment)
-> Parser (Maybe AssessmentFramework)
-> Parser
     (Maybe Text
      -> Maybe AWSAccount
      -> Maybe AssessmentMetadata
      -> Maybe (HashMap Text Text)
      -> Assessment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AssessmentFramework)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"framework")
            Parser
  (Maybe Text
   -> Maybe AWSAccount
   -> Maybe AssessmentMetadata
   -> Maybe (HashMap Text Text)
   -> Assessment)
-> Parser (Maybe Text)
-> Parser
     (Maybe AWSAccount
      -> Maybe AssessmentMetadata
      -> Maybe (HashMap Text Text)
      -> Assessment)
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
"arn")
            Parser
  (Maybe AWSAccount
   -> Maybe AssessmentMetadata
   -> Maybe (HashMap Text Text)
   -> Assessment)
-> Parser (Maybe AWSAccount)
-> Parser
     (Maybe AssessmentMetadata
      -> Maybe (HashMap Text Text) -> Assessment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AWSAccount)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"awsAccount")
            Parser
  (Maybe AssessmentMetadata
   -> Maybe (HashMap Text Text) -> Assessment)
-> Parser (Maybe AssessmentMetadata)
-> Parser (Maybe (HashMap Text Text) -> Assessment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AssessmentMetadata)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"metadata")
            Parser (Maybe (HashMap Text Text) -> Assessment)
-> Parser (Maybe (HashMap Text Text)) -> Parser Assessment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Assessment

instance Prelude.NFData Assessment