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

-- | An instance of a threat intelligence detail that constitutes evidence
-- for the finding.
--
-- /See:/ 'newThreatIntelligenceDetail' smart constructor.
data ThreatIntelligenceDetail = ThreatIntelligenceDetail'
  { -- | The name of the threat intelligence list that triggered the finding.
    ThreatIntelligenceDetail -> Maybe Text
threatListName :: Prelude.Maybe Prelude.Text,
    -- | A list of names of the threats in the threat intelligence list that
    -- triggered the finding.
    ThreatIntelligenceDetail -> Maybe [Text]
threatNames :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ThreatIntelligenceDetail -> ThreatIntelligenceDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThreatIntelligenceDetail -> ThreatIntelligenceDetail -> Bool
$c/= :: ThreatIntelligenceDetail -> ThreatIntelligenceDetail -> Bool
== :: ThreatIntelligenceDetail -> ThreatIntelligenceDetail -> Bool
$c== :: ThreatIntelligenceDetail -> ThreatIntelligenceDetail -> Bool
Prelude.Eq, ReadPrec [ThreatIntelligenceDetail]
ReadPrec ThreatIntelligenceDetail
Int -> ReadS ThreatIntelligenceDetail
ReadS [ThreatIntelligenceDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThreatIntelligenceDetail]
$creadListPrec :: ReadPrec [ThreatIntelligenceDetail]
readPrec :: ReadPrec ThreatIntelligenceDetail
$creadPrec :: ReadPrec ThreatIntelligenceDetail
readList :: ReadS [ThreatIntelligenceDetail]
$creadList :: ReadS [ThreatIntelligenceDetail]
readsPrec :: Int -> ReadS ThreatIntelligenceDetail
$creadsPrec :: Int -> ReadS ThreatIntelligenceDetail
Prelude.Read, Int -> ThreatIntelligenceDetail -> ShowS
[ThreatIntelligenceDetail] -> ShowS
ThreatIntelligenceDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThreatIntelligenceDetail] -> ShowS
$cshowList :: [ThreatIntelligenceDetail] -> ShowS
show :: ThreatIntelligenceDetail -> String
$cshow :: ThreatIntelligenceDetail -> String
showsPrec :: Int -> ThreatIntelligenceDetail -> ShowS
$cshowsPrec :: Int -> ThreatIntelligenceDetail -> ShowS
Prelude.Show, forall x.
Rep ThreatIntelligenceDetail x -> ThreatIntelligenceDetail
forall x.
ThreatIntelligenceDetail -> Rep ThreatIntelligenceDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ThreatIntelligenceDetail x -> ThreatIntelligenceDetail
$cfrom :: forall x.
ThreatIntelligenceDetail -> Rep ThreatIntelligenceDetail x
Prelude.Generic)

-- |
-- Create a value of 'ThreatIntelligenceDetail' 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:
--
-- 'threatListName', 'threatIntelligenceDetail_threatListName' - The name of the threat intelligence list that triggered the finding.
--
-- 'threatNames', 'threatIntelligenceDetail_threatNames' - A list of names of the threats in the threat intelligence list that
-- triggered the finding.
newThreatIntelligenceDetail ::
  ThreatIntelligenceDetail
newThreatIntelligenceDetail :: ThreatIntelligenceDetail
newThreatIntelligenceDetail =
  ThreatIntelligenceDetail'
    { $sel:threatListName:ThreatIntelligenceDetail' :: Maybe Text
threatListName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:threatNames:ThreatIntelligenceDetail' :: Maybe [Text]
threatNames = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the threat intelligence list that triggered the finding.
threatIntelligenceDetail_threatListName :: Lens.Lens' ThreatIntelligenceDetail (Prelude.Maybe Prelude.Text)
threatIntelligenceDetail_threatListName :: Lens' ThreatIntelligenceDetail (Maybe Text)
threatIntelligenceDetail_threatListName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThreatIntelligenceDetail' {Maybe Text
threatListName :: Maybe Text
$sel:threatListName:ThreatIntelligenceDetail' :: ThreatIntelligenceDetail -> Maybe Text
threatListName} -> Maybe Text
threatListName) (\s :: ThreatIntelligenceDetail
s@ThreatIntelligenceDetail' {} Maybe Text
a -> ThreatIntelligenceDetail
s {$sel:threatListName:ThreatIntelligenceDetail' :: Maybe Text
threatListName = Maybe Text
a} :: ThreatIntelligenceDetail)

-- | A list of names of the threats in the threat intelligence list that
-- triggered the finding.
threatIntelligenceDetail_threatNames :: Lens.Lens' ThreatIntelligenceDetail (Prelude.Maybe [Prelude.Text])
threatIntelligenceDetail_threatNames :: Lens' ThreatIntelligenceDetail (Maybe [Text])
threatIntelligenceDetail_threatNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThreatIntelligenceDetail' {Maybe [Text]
threatNames :: Maybe [Text]
$sel:threatNames:ThreatIntelligenceDetail' :: ThreatIntelligenceDetail -> Maybe [Text]
threatNames} -> Maybe [Text]
threatNames) (\s :: ThreatIntelligenceDetail
s@ThreatIntelligenceDetail' {} Maybe [Text]
a -> ThreatIntelligenceDetail
s {$sel:threatNames:ThreatIntelligenceDetail' :: Maybe [Text]
threatNames = Maybe [Text]
a} :: ThreatIntelligenceDetail) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON ThreatIntelligenceDetail where
  parseJSON :: Value -> Parser ThreatIntelligenceDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ThreatIntelligenceDetail"
      ( \Object
x ->
          Maybe Text -> Maybe [Text] -> ThreatIntelligenceDetail
ThreatIntelligenceDetail'
            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
"threatListName")
            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
"threatNames" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ThreatIntelligenceDetail where
  hashWithSalt :: Int -> ThreatIntelligenceDetail -> Int
hashWithSalt Int
_salt ThreatIntelligenceDetail' {Maybe [Text]
Maybe Text
threatNames :: Maybe [Text]
threatListName :: Maybe Text
$sel:threatNames:ThreatIntelligenceDetail' :: ThreatIntelligenceDetail -> Maybe [Text]
$sel:threatListName:ThreatIntelligenceDetail' :: ThreatIntelligenceDetail -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
threatListName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
threatNames

instance Prelude.NFData ThreatIntelligenceDetail where
  rnf :: ThreatIntelligenceDetail -> ()
rnf ThreatIntelligenceDetail' {Maybe [Text]
Maybe Text
threatNames :: Maybe [Text]
threatListName :: Maybe Text
$sel:threatNames:ThreatIntelligenceDetail' :: ThreatIntelligenceDetail -> Maybe [Text]
$sel:threatListName:ThreatIntelligenceDetail' :: ThreatIntelligenceDetail -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
threatListName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
threatNames