{-# 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.Resource
-- 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.Resource 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 system asset that\'s evaluated in an Audit Manager assessment.
--
-- /See:/ 'newResource' smart constructor.
data Resource = Resource'
  { -- | The Amazon Resource Name (ARN) for the resource.
    Resource -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The evaluation status for a resource that was assessed when collecting
    -- compliance check evidence.
    --
    -- -   Audit Manager classes the resource as non-compliant if Security Hub
    --     reports a /Fail/ result, or if Config reports a /Non-compliant/
    --     result.
    --
    -- -   Audit Manager classes the resource as compliant if Security Hub
    --     reports a /Pass/ result, or if Config reports a /Compliant/ result.
    --
    -- -   If a compliance check isn\'t available or applicable, then no
    --     compliance evaluation can be made for that resource. This is the
    --     case if a resource assessment uses Config or Security Hub as the
    --     underlying data source type, but those services aren\'t enabled.
    --     This is also the case if the resource assessment uses an underlying
    --     data source type that doesn\'t support compliance checks (such as
    --     manual evidence, Amazon Web Services API calls, or CloudTrail).
    Resource -> Maybe Text
complianceCheck :: Prelude.Maybe Prelude.Text,
    -- | The value of the resource.
    Resource -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (Resource -> Resource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Resource -> Resource -> Bool
$c/= :: Resource -> Resource -> Bool
== :: Resource -> Resource -> Bool
$c== :: Resource -> Resource -> Bool
Prelude.Eq, ReadPrec [Resource]
ReadPrec Resource
Int -> ReadS Resource
ReadS [Resource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Resource]
$creadListPrec :: ReadPrec [Resource]
readPrec :: ReadPrec Resource
$creadPrec :: ReadPrec Resource
readList :: ReadS [Resource]
$creadList :: ReadS [Resource]
readsPrec :: Int -> ReadS Resource
$creadsPrec :: Int -> ReadS Resource
Prelude.Read, Int -> Resource -> ShowS
[Resource] -> ShowS
Resource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Resource] -> ShowS
$cshowList :: [Resource] -> ShowS
show :: Resource -> String
$cshow :: Resource -> String
showsPrec :: Int -> Resource -> ShowS
$cshowsPrec :: Int -> Resource -> ShowS
Prelude.Show, forall x. Rep Resource x -> Resource
forall x. Resource -> Rep Resource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Resource x -> Resource
$cfrom :: forall x. Resource -> Rep Resource x
Prelude.Generic)

-- |
-- Create a value of 'Resource' 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:
--
-- 'arn', 'resource_arn' - The Amazon Resource Name (ARN) for the resource.
--
-- 'complianceCheck', 'resource_complianceCheck' - The evaluation status for a resource that was assessed when collecting
-- compliance check evidence.
--
-- -   Audit Manager classes the resource as non-compliant if Security Hub
--     reports a /Fail/ result, or if Config reports a /Non-compliant/
--     result.
--
-- -   Audit Manager classes the resource as compliant if Security Hub
--     reports a /Pass/ result, or if Config reports a /Compliant/ result.
--
-- -   If a compliance check isn\'t available or applicable, then no
--     compliance evaluation can be made for that resource. This is the
--     case if a resource assessment uses Config or Security Hub as the
--     underlying data source type, but those services aren\'t enabled.
--     This is also the case if the resource assessment uses an underlying
--     data source type that doesn\'t support compliance checks (such as
--     manual evidence, Amazon Web Services API calls, or CloudTrail).
--
-- 'value', 'resource_value' - The value of the resource.
newResource ::
  Resource
newResource :: Resource
newResource =
  Resource'
    { $sel:arn:Resource' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:complianceCheck:Resource' :: Maybe Text
complianceCheck = forall a. Maybe a
Prelude.Nothing,
      $sel:value:Resource' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The evaluation status for a resource that was assessed when collecting
-- compliance check evidence.
--
-- -   Audit Manager classes the resource as non-compliant if Security Hub
--     reports a /Fail/ result, or if Config reports a /Non-compliant/
--     result.
--
-- -   Audit Manager classes the resource as compliant if Security Hub
--     reports a /Pass/ result, or if Config reports a /Compliant/ result.
--
-- -   If a compliance check isn\'t available or applicable, then no
--     compliance evaluation can be made for that resource. This is the
--     case if a resource assessment uses Config or Security Hub as the
--     underlying data source type, but those services aren\'t enabled.
--     This is also the case if the resource assessment uses an underlying
--     data source type that doesn\'t support compliance checks (such as
--     manual evidence, Amazon Web Services API calls, or CloudTrail).
resource_complianceCheck :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_complianceCheck :: Lens' Resource (Maybe Text)
resource_complianceCheck = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
complianceCheck :: Maybe Text
$sel:complianceCheck:Resource' :: Resource -> Maybe Text
complianceCheck} -> Maybe Text
complianceCheck) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:complianceCheck:Resource' :: Maybe Text
complianceCheck = Maybe Text
a} :: Resource)

-- | The value of the resource.
resource_value :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_value :: Lens' Resource (Maybe Text)
resource_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
value :: Maybe Text
$sel:value:Resource' :: Resource -> Maybe Text
value} -> Maybe Text
value) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:value:Resource' :: Maybe Text
value = Maybe Text
a} :: Resource)

instance Data.FromJSON Resource where
  parseJSON :: Value -> Parser Resource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Resource"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> Resource
Resource'
            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
"arn")
            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
"complianceCheck")
            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
"value")
      )

instance Prelude.Hashable Resource where
  hashWithSalt :: Int -> Resource -> Int
hashWithSalt Int
_salt Resource' {Maybe Text
value :: Maybe Text
complianceCheck :: Maybe Text
arn :: Maybe Text
$sel:value:Resource' :: Resource -> Maybe Text
$sel:complianceCheck:Resource' :: Resource -> Maybe Text
$sel:arn:Resource' :: Resource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
complianceCheck
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData Resource where
  rnf :: Resource -> ()
rnf Resource' {Maybe Text
value :: Maybe Text
complianceCheck :: Maybe Text
arn :: Maybe Text
$sel:value:Resource' :: Resource -> Maybe Text
$sel:complianceCheck:Resource' :: Resource -> Maybe Text
$sel:arn:Resource' :: Resource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
complianceCheck
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value