{-# 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.GuardDuty.Types.Evidence
-- 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.GuardDuty.Types.Evidence where

import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types.ThreatIntelligenceDetail
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the reason that the finding was generated.
--
-- /See:/ 'newEvidence' smart constructor.
data Evidence = Evidence'
  { -- | A list of threat intelligence details related to the evidence.
    Evidence -> Maybe [ThreatIntelligenceDetail]
threatIntelligenceDetails :: Prelude.Maybe [ThreatIntelligenceDetail]
  }
  deriving (Evidence -> Evidence -> Bool
(Evidence -> Evidence -> Bool)
-> (Evidence -> Evidence -> Bool) -> Eq Evidence
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Evidence -> Evidence -> Bool
$c/= :: Evidence -> Evidence -> Bool
== :: Evidence -> Evidence -> Bool
$c== :: Evidence -> Evidence -> Bool
Prelude.Eq, ReadPrec [Evidence]
ReadPrec Evidence
Int -> ReadS Evidence
ReadS [Evidence]
(Int -> ReadS Evidence)
-> ReadS [Evidence]
-> ReadPrec Evidence
-> ReadPrec [Evidence]
-> Read Evidence
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Evidence]
$creadListPrec :: ReadPrec [Evidence]
readPrec :: ReadPrec Evidence
$creadPrec :: ReadPrec Evidence
readList :: ReadS [Evidence]
$creadList :: ReadS [Evidence]
readsPrec :: Int -> ReadS Evidence
$creadsPrec :: Int -> ReadS Evidence
Prelude.Read, Int -> Evidence -> ShowS
[Evidence] -> ShowS
Evidence -> String
(Int -> Evidence -> ShowS)
-> (Evidence -> String) -> ([Evidence] -> ShowS) -> Show Evidence
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Evidence] -> ShowS
$cshowList :: [Evidence] -> ShowS
show :: Evidence -> String
$cshow :: Evidence -> String
showsPrec :: Int -> Evidence -> ShowS
$cshowsPrec :: Int -> Evidence -> ShowS
Prelude.Show, (forall x. Evidence -> Rep Evidence x)
-> (forall x. Rep Evidence x -> Evidence) -> Generic Evidence
forall x. Rep Evidence x -> Evidence
forall x. Evidence -> Rep Evidence x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Evidence x -> Evidence
$cfrom :: forall x. Evidence -> Rep Evidence x
Prelude.Generic)

-- |
-- Create a value of 'Evidence' 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:
--
-- 'threatIntelligenceDetails', 'evidence_threatIntelligenceDetails' - A list of threat intelligence details related to the evidence.
newEvidence ::
  Evidence
newEvidence :: Evidence
newEvidence =
  Evidence' :: Maybe [ThreatIntelligenceDetail] -> Evidence
Evidence'
    { $sel:threatIntelligenceDetails:Evidence' :: Maybe [ThreatIntelligenceDetail]
threatIntelligenceDetails =
        Maybe [ThreatIntelligenceDetail]
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of threat intelligence details related to the evidence.
evidence_threatIntelligenceDetails :: Lens.Lens' Evidence (Prelude.Maybe [ThreatIntelligenceDetail])
evidence_threatIntelligenceDetails :: (Maybe [ThreatIntelligenceDetail]
 -> f (Maybe [ThreatIntelligenceDetail]))
-> Evidence -> f Evidence
evidence_threatIntelligenceDetails = (Evidence -> Maybe [ThreatIntelligenceDetail])
-> (Evidence -> Maybe [ThreatIntelligenceDetail] -> Evidence)
-> Lens
     Evidence
     Evidence
     (Maybe [ThreatIntelligenceDetail])
     (Maybe [ThreatIntelligenceDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Evidence' {Maybe [ThreatIntelligenceDetail]
threatIntelligenceDetails :: Maybe [ThreatIntelligenceDetail]
$sel:threatIntelligenceDetails:Evidence' :: Evidence -> Maybe [ThreatIntelligenceDetail]
threatIntelligenceDetails} -> Maybe [ThreatIntelligenceDetail]
threatIntelligenceDetails) (\s :: Evidence
s@Evidence' {} Maybe [ThreatIntelligenceDetail]
a -> Evidence
s {$sel:threatIntelligenceDetails:Evidence' :: Maybe [ThreatIntelligenceDetail]
threatIntelligenceDetails = Maybe [ThreatIntelligenceDetail]
a} :: Evidence) ((Maybe [ThreatIntelligenceDetail]
  -> f (Maybe [ThreatIntelligenceDetail]))
 -> Evidence -> f Evidence)
-> ((Maybe [ThreatIntelligenceDetail]
     -> f (Maybe [ThreatIntelligenceDetail]))
    -> Maybe [ThreatIntelligenceDetail]
    -> f (Maybe [ThreatIntelligenceDetail]))
-> (Maybe [ThreatIntelligenceDetail]
    -> f (Maybe [ThreatIntelligenceDetail]))
-> Evidence
-> f Evidence
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ThreatIntelligenceDetail]
  [ThreatIntelligenceDetail]
  [ThreatIntelligenceDetail]
  [ThreatIntelligenceDetail]
-> Iso
     (Maybe [ThreatIntelligenceDetail])
     (Maybe [ThreatIntelligenceDetail])
     (Maybe [ThreatIntelligenceDetail])
     (Maybe [ThreatIntelligenceDetail])
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
  [ThreatIntelligenceDetail]
  [ThreatIntelligenceDetail]
  [ThreatIntelligenceDetail]
  [ThreatIntelligenceDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Evidence where
  parseJSON :: Value -> Parser Evidence
parseJSON =
    String -> (Object -> Parser Evidence) -> Value -> Parser Evidence
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Evidence"
      ( \Object
x ->
          Maybe [ThreatIntelligenceDetail] -> Evidence
Evidence'
            (Maybe [ThreatIntelligenceDetail] -> Evidence)
-> Parser (Maybe [ThreatIntelligenceDetail]) -> Parser Evidence
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ThreatIntelligenceDetail]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"threatIntelligenceDetails"
                            Parser (Maybe (Maybe [ThreatIntelligenceDetail]))
-> Maybe [ThreatIntelligenceDetail]
-> Parser (Maybe [ThreatIntelligenceDetail])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ThreatIntelligenceDetail]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable Evidence

instance Prelude.NFData Evidence