{-# 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.Shield.Types.SummarizedAttackVector
-- 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.Shield.Types.SummarizedAttackVector 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
import Amazonka.Shield.Types.SummarizedCounter

-- | A summary of information about the attack.
--
-- /See:/ 'newSummarizedAttackVector' smart constructor.
data SummarizedAttackVector = SummarizedAttackVector'
  { -- | The list of counters that describe the details of the attack.
    SummarizedAttackVector -> Maybe [SummarizedCounter]
vectorCounters :: Prelude.Maybe [SummarizedCounter],
    -- | The attack type, for example, SNMP reflection or SYN flood.
    SummarizedAttackVector -> Text
vectorType :: Prelude.Text
  }
  deriving (SummarizedAttackVector -> SummarizedAttackVector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SummarizedAttackVector -> SummarizedAttackVector -> Bool
$c/= :: SummarizedAttackVector -> SummarizedAttackVector -> Bool
== :: SummarizedAttackVector -> SummarizedAttackVector -> Bool
$c== :: SummarizedAttackVector -> SummarizedAttackVector -> Bool
Prelude.Eq, ReadPrec [SummarizedAttackVector]
ReadPrec SummarizedAttackVector
Int -> ReadS SummarizedAttackVector
ReadS [SummarizedAttackVector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SummarizedAttackVector]
$creadListPrec :: ReadPrec [SummarizedAttackVector]
readPrec :: ReadPrec SummarizedAttackVector
$creadPrec :: ReadPrec SummarizedAttackVector
readList :: ReadS [SummarizedAttackVector]
$creadList :: ReadS [SummarizedAttackVector]
readsPrec :: Int -> ReadS SummarizedAttackVector
$creadsPrec :: Int -> ReadS SummarizedAttackVector
Prelude.Read, Int -> SummarizedAttackVector -> ShowS
[SummarizedAttackVector] -> ShowS
SummarizedAttackVector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SummarizedAttackVector] -> ShowS
$cshowList :: [SummarizedAttackVector] -> ShowS
show :: SummarizedAttackVector -> String
$cshow :: SummarizedAttackVector -> String
showsPrec :: Int -> SummarizedAttackVector -> ShowS
$cshowsPrec :: Int -> SummarizedAttackVector -> ShowS
Prelude.Show, forall x. Rep SummarizedAttackVector x -> SummarizedAttackVector
forall x. SummarizedAttackVector -> Rep SummarizedAttackVector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SummarizedAttackVector x -> SummarizedAttackVector
$cfrom :: forall x. SummarizedAttackVector -> Rep SummarizedAttackVector x
Prelude.Generic)

-- |
-- Create a value of 'SummarizedAttackVector' 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:
--
-- 'vectorCounters', 'summarizedAttackVector_vectorCounters' - The list of counters that describe the details of the attack.
--
-- 'vectorType', 'summarizedAttackVector_vectorType' - The attack type, for example, SNMP reflection or SYN flood.
newSummarizedAttackVector ::
  -- | 'vectorType'
  Prelude.Text ->
  SummarizedAttackVector
newSummarizedAttackVector :: Text -> SummarizedAttackVector
newSummarizedAttackVector Text
pVectorType_ =
  SummarizedAttackVector'
    { $sel:vectorCounters:SummarizedAttackVector' :: Maybe [SummarizedCounter]
vectorCounters =
        forall a. Maybe a
Prelude.Nothing,
      $sel:vectorType:SummarizedAttackVector' :: Text
vectorType = Text
pVectorType_
    }

-- | The list of counters that describe the details of the attack.
summarizedAttackVector_vectorCounters :: Lens.Lens' SummarizedAttackVector (Prelude.Maybe [SummarizedCounter])
summarizedAttackVector_vectorCounters :: Lens' SummarizedAttackVector (Maybe [SummarizedCounter])
summarizedAttackVector_vectorCounters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SummarizedAttackVector' {Maybe [SummarizedCounter]
vectorCounters :: Maybe [SummarizedCounter]
$sel:vectorCounters:SummarizedAttackVector' :: SummarizedAttackVector -> Maybe [SummarizedCounter]
vectorCounters} -> Maybe [SummarizedCounter]
vectorCounters) (\s :: SummarizedAttackVector
s@SummarizedAttackVector' {} Maybe [SummarizedCounter]
a -> SummarizedAttackVector
s {$sel:vectorCounters:SummarizedAttackVector' :: Maybe [SummarizedCounter]
vectorCounters = Maybe [SummarizedCounter]
a} :: SummarizedAttackVector) 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

-- | The attack type, for example, SNMP reflection or SYN flood.
summarizedAttackVector_vectorType :: Lens.Lens' SummarizedAttackVector Prelude.Text
summarizedAttackVector_vectorType :: Lens' SummarizedAttackVector Text
summarizedAttackVector_vectorType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SummarizedAttackVector' {Text
vectorType :: Text
$sel:vectorType:SummarizedAttackVector' :: SummarizedAttackVector -> Text
vectorType} -> Text
vectorType) (\s :: SummarizedAttackVector
s@SummarizedAttackVector' {} Text
a -> SummarizedAttackVector
s {$sel:vectorType:SummarizedAttackVector' :: Text
vectorType = Text
a} :: SummarizedAttackVector)

instance Data.FromJSON SummarizedAttackVector where
  parseJSON :: Value -> Parser SummarizedAttackVector
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SummarizedAttackVector"
      ( \Object
x ->
          Maybe [SummarizedCounter] -> Text -> SummarizedAttackVector
SummarizedAttackVector'
            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
"VectorCounters" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"VectorType")
      )

instance Prelude.Hashable SummarizedAttackVector where
  hashWithSalt :: Int -> SummarizedAttackVector -> Int
hashWithSalt Int
_salt SummarizedAttackVector' {Maybe [SummarizedCounter]
Text
vectorType :: Text
vectorCounters :: Maybe [SummarizedCounter]
$sel:vectorType:SummarizedAttackVector' :: SummarizedAttackVector -> Text
$sel:vectorCounters:SummarizedAttackVector' :: SummarizedAttackVector -> Maybe [SummarizedCounter]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SummarizedCounter]
vectorCounters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vectorType

instance Prelude.NFData SummarizedAttackVector where
  rnf :: SummarizedAttackVector -> ()
rnf SummarizedAttackVector' {Maybe [SummarizedCounter]
Text
vectorType :: Text
vectorCounters :: Maybe [SummarizedCounter]
$sel:vectorType:SummarizedAttackVector' :: SummarizedAttackVector -> Text
$sel:vectorCounters:SummarizedAttackVector' :: SummarizedAttackVector -> Maybe [SummarizedCounter]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SummarizedCounter]
vectorCounters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
vectorType