{-# 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.AttackDetail
-- 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.Shield.Types.AttackDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Shield.Types.AttackProperty
import Amazonka.Shield.Types.Mitigation
import Amazonka.Shield.Types.SubResourceSummary
import Amazonka.Shield.Types.SummarizedCounter

-- | The details of a DDoS attack.
--
-- /See:/ 'newAttackDetail' smart constructor.
data AttackDetail = AttackDetail'
  { -- | The unique identifier (ID) of the attack.
    AttackDetail -> Maybe Text
attackId :: Prelude.Maybe Prelude.Text,
    -- | The time the attack started, in Unix time in seconds. For more
    -- information see
    -- <http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#parameter-types timestamp>.
    AttackDetail -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | If applicable, additional detail about the resource being attacked, for
    -- example, IP address or URL.
    AttackDetail -> Maybe [SubResourceSummary]
subResources :: Prelude.Maybe [SubResourceSummary],
    -- | List of mitigation actions taken for the attack.
    AttackDetail -> Maybe [Mitigation]
mitigations :: Prelude.Maybe [Mitigation],
    -- | The array of objects that provide details of the Shield event.
    --
    -- For infrastructure layer events (L3 and L4 events) after January 25,
    -- 2021, you can view metrics for top contributors in Amazon CloudWatch
    -- metrics. For more information, see
    -- <https://docs.aws.amazon.com/waf/latest/developerguide/monitoring-cloudwatch.html#set-ddos-alarms Shield metrics and alarms>
    -- in the /WAF Developer Guide/.
    AttackDetail -> Maybe [AttackProperty]
attackProperties :: Prelude.Maybe [AttackProperty],
    -- | List of counters that describe the attack for the specified time period.
    AttackDetail -> Maybe [SummarizedCounter]
attackCounters :: Prelude.Maybe [SummarizedCounter],
    -- | The ARN (Amazon Resource Name) of the resource that was attacked.
    AttackDetail -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
    -- | The time the attack ended, in Unix time in seconds. For more information
    -- see
    -- <http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#parameter-types timestamp>.
    AttackDetail -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX
  }
  deriving (AttackDetail -> AttackDetail -> Bool
(AttackDetail -> AttackDetail -> Bool)
-> (AttackDetail -> AttackDetail -> Bool) -> Eq AttackDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttackDetail -> AttackDetail -> Bool
$c/= :: AttackDetail -> AttackDetail -> Bool
== :: AttackDetail -> AttackDetail -> Bool
$c== :: AttackDetail -> AttackDetail -> Bool
Prelude.Eq, ReadPrec [AttackDetail]
ReadPrec AttackDetail
Int -> ReadS AttackDetail
ReadS [AttackDetail]
(Int -> ReadS AttackDetail)
-> ReadS [AttackDetail]
-> ReadPrec AttackDetail
-> ReadPrec [AttackDetail]
-> Read AttackDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttackDetail]
$creadListPrec :: ReadPrec [AttackDetail]
readPrec :: ReadPrec AttackDetail
$creadPrec :: ReadPrec AttackDetail
readList :: ReadS [AttackDetail]
$creadList :: ReadS [AttackDetail]
readsPrec :: Int -> ReadS AttackDetail
$creadsPrec :: Int -> ReadS AttackDetail
Prelude.Read, Int -> AttackDetail -> ShowS
[AttackDetail] -> ShowS
AttackDetail -> String
(Int -> AttackDetail -> ShowS)
-> (AttackDetail -> String)
-> ([AttackDetail] -> ShowS)
-> Show AttackDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttackDetail] -> ShowS
$cshowList :: [AttackDetail] -> ShowS
show :: AttackDetail -> String
$cshow :: AttackDetail -> String
showsPrec :: Int -> AttackDetail -> ShowS
$cshowsPrec :: Int -> AttackDetail -> ShowS
Prelude.Show, (forall x. AttackDetail -> Rep AttackDetail x)
-> (forall x. Rep AttackDetail x -> AttackDetail)
-> Generic AttackDetail
forall x. Rep AttackDetail x -> AttackDetail
forall x. AttackDetail -> Rep AttackDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttackDetail x -> AttackDetail
$cfrom :: forall x. AttackDetail -> Rep AttackDetail x
Prelude.Generic)

-- |
-- Create a value of 'AttackDetail' 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:
--
-- 'attackId', 'attackDetail_attackId' - The unique identifier (ID) of the attack.
--
-- 'startTime', 'attackDetail_startTime' - The time the attack started, in Unix time in seconds. For more
-- information see
-- <http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#parameter-types timestamp>.
--
-- 'subResources', 'attackDetail_subResources' - If applicable, additional detail about the resource being attacked, for
-- example, IP address or URL.
--
-- 'mitigations', 'attackDetail_mitigations' - List of mitigation actions taken for the attack.
--
-- 'attackProperties', 'attackDetail_attackProperties' - The array of objects that provide details of the Shield event.
--
-- For infrastructure layer events (L3 and L4 events) after January 25,
-- 2021, you can view metrics for top contributors in Amazon CloudWatch
-- metrics. For more information, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/monitoring-cloudwatch.html#set-ddos-alarms Shield metrics and alarms>
-- in the /WAF Developer Guide/.
--
-- 'attackCounters', 'attackDetail_attackCounters' - List of counters that describe the attack for the specified time period.
--
-- 'resourceArn', 'attackDetail_resourceArn' - The ARN (Amazon Resource Name) of the resource that was attacked.
--
-- 'endTime', 'attackDetail_endTime' - The time the attack ended, in Unix time in seconds. For more information
-- see
-- <http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#parameter-types timestamp>.
newAttackDetail ::
  AttackDetail
newAttackDetail :: AttackDetail
newAttackDetail =
  AttackDetail' :: Maybe Text
-> Maybe POSIX
-> Maybe [SubResourceSummary]
-> Maybe [Mitigation]
-> Maybe [AttackProperty]
-> Maybe [SummarizedCounter]
-> Maybe Text
-> Maybe POSIX
-> AttackDetail
AttackDetail'
    { $sel:attackId:AttackDetail' :: Maybe Text
attackId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:AttackDetail' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:subResources:AttackDetail' :: Maybe [SubResourceSummary]
subResources = Maybe [SubResourceSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:mitigations:AttackDetail' :: Maybe [Mitigation]
mitigations = Maybe [Mitigation]
forall a. Maybe a
Prelude.Nothing,
      $sel:attackProperties:AttackDetail' :: Maybe [AttackProperty]
attackProperties = Maybe [AttackProperty]
forall a. Maybe a
Prelude.Nothing,
      $sel:attackCounters:AttackDetail' :: Maybe [SummarizedCounter]
attackCounters = Maybe [SummarizedCounter]
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArn:AttackDetail' :: Maybe Text
resourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:AttackDetail' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The unique identifier (ID) of the attack.
attackDetail_attackId :: Lens.Lens' AttackDetail (Prelude.Maybe Prelude.Text)
attackDetail_attackId :: (Maybe Text -> f (Maybe Text)) -> AttackDetail -> f AttackDetail
attackDetail_attackId = (AttackDetail -> Maybe Text)
-> (AttackDetail -> Maybe Text -> AttackDetail)
-> Lens AttackDetail AttackDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackDetail' {Maybe Text
attackId :: Maybe Text
$sel:attackId:AttackDetail' :: AttackDetail -> Maybe Text
attackId} -> Maybe Text
attackId) (\s :: AttackDetail
s@AttackDetail' {} Maybe Text
a -> AttackDetail
s {$sel:attackId:AttackDetail' :: Maybe Text
attackId = Maybe Text
a} :: AttackDetail)

-- | The time the attack started, in Unix time in seconds. For more
-- information see
-- <http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#parameter-types timestamp>.
attackDetail_startTime :: Lens.Lens' AttackDetail (Prelude.Maybe Prelude.UTCTime)
attackDetail_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AttackDetail -> f AttackDetail
attackDetail_startTime = (AttackDetail -> Maybe POSIX)
-> (AttackDetail -> Maybe POSIX -> AttackDetail)
-> Lens AttackDetail AttackDetail (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackDetail' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:AttackDetail' :: AttackDetail -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: AttackDetail
s@AttackDetail' {} Maybe POSIX
a -> AttackDetail
s {$sel:startTime:AttackDetail' :: Maybe POSIX
startTime = Maybe POSIX
a} :: AttackDetail) ((Maybe POSIX -> f (Maybe POSIX))
 -> AttackDetail -> f AttackDetail)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AttackDetail
-> f AttackDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | If applicable, additional detail about the resource being attacked, for
-- example, IP address or URL.
attackDetail_subResources :: Lens.Lens' AttackDetail (Prelude.Maybe [SubResourceSummary])
attackDetail_subResources :: (Maybe [SubResourceSummary] -> f (Maybe [SubResourceSummary]))
-> AttackDetail -> f AttackDetail
attackDetail_subResources = (AttackDetail -> Maybe [SubResourceSummary])
-> (AttackDetail -> Maybe [SubResourceSummary] -> AttackDetail)
-> Lens
     AttackDetail
     AttackDetail
     (Maybe [SubResourceSummary])
     (Maybe [SubResourceSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackDetail' {Maybe [SubResourceSummary]
subResources :: Maybe [SubResourceSummary]
$sel:subResources:AttackDetail' :: AttackDetail -> Maybe [SubResourceSummary]
subResources} -> Maybe [SubResourceSummary]
subResources) (\s :: AttackDetail
s@AttackDetail' {} Maybe [SubResourceSummary]
a -> AttackDetail
s {$sel:subResources:AttackDetail' :: Maybe [SubResourceSummary]
subResources = Maybe [SubResourceSummary]
a} :: AttackDetail) ((Maybe [SubResourceSummary] -> f (Maybe [SubResourceSummary]))
 -> AttackDetail -> f AttackDetail)
-> ((Maybe [SubResourceSummary] -> f (Maybe [SubResourceSummary]))
    -> Maybe [SubResourceSummary] -> f (Maybe [SubResourceSummary]))
-> (Maybe [SubResourceSummary] -> f (Maybe [SubResourceSummary]))
-> AttackDetail
-> f AttackDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SubResourceSummary]
  [SubResourceSummary]
  [SubResourceSummary]
  [SubResourceSummary]
-> Iso
     (Maybe [SubResourceSummary])
     (Maybe [SubResourceSummary])
     (Maybe [SubResourceSummary])
     (Maybe [SubResourceSummary])
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
  [SubResourceSummary]
  [SubResourceSummary]
  [SubResourceSummary]
  [SubResourceSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | List of mitigation actions taken for the attack.
attackDetail_mitigations :: Lens.Lens' AttackDetail (Prelude.Maybe [Mitigation])
attackDetail_mitigations :: (Maybe [Mitigation] -> f (Maybe [Mitigation]))
-> AttackDetail -> f AttackDetail
attackDetail_mitigations = (AttackDetail -> Maybe [Mitigation])
-> (AttackDetail -> Maybe [Mitigation] -> AttackDetail)
-> Lens
     AttackDetail AttackDetail (Maybe [Mitigation]) (Maybe [Mitigation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackDetail' {Maybe [Mitigation]
mitigations :: Maybe [Mitigation]
$sel:mitigations:AttackDetail' :: AttackDetail -> Maybe [Mitigation]
mitigations} -> Maybe [Mitigation]
mitigations) (\s :: AttackDetail
s@AttackDetail' {} Maybe [Mitigation]
a -> AttackDetail
s {$sel:mitigations:AttackDetail' :: Maybe [Mitigation]
mitigations = Maybe [Mitigation]
a} :: AttackDetail) ((Maybe [Mitigation] -> f (Maybe [Mitigation]))
 -> AttackDetail -> f AttackDetail)
-> ((Maybe [Mitigation] -> f (Maybe [Mitigation]))
    -> Maybe [Mitigation] -> f (Maybe [Mitigation]))
-> (Maybe [Mitigation] -> f (Maybe [Mitigation]))
-> AttackDetail
-> f AttackDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Mitigation] [Mitigation] [Mitigation] [Mitigation]
-> Iso
     (Maybe [Mitigation])
     (Maybe [Mitigation])
     (Maybe [Mitigation])
     (Maybe [Mitigation])
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 [Mitigation] [Mitigation] [Mitigation] [Mitigation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The array of objects that provide details of the Shield event.
--
-- For infrastructure layer events (L3 and L4 events) after January 25,
-- 2021, you can view metrics for top contributors in Amazon CloudWatch
-- metrics. For more information, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/monitoring-cloudwatch.html#set-ddos-alarms Shield metrics and alarms>
-- in the /WAF Developer Guide/.
attackDetail_attackProperties :: Lens.Lens' AttackDetail (Prelude.Maybe [AttackProperty])
attackDetail_attackProperties :: (Maybe [AttackProperty] -> f (Maybe [AttackProperty]))
-> AttackDetail -> f AttackDetail
attackDetail_attackProperties = (AttackDetail -> Maybe [AttackProperty])
-> (AttackDetail -> Maybe [AttackProperty] -> AttackDetail)
-> Lens
     AttackDetail
     AttackDetail
     (Maybe [AttackProperty])
     (Maybe [AttackProperty])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackDetail' {Maybe [AttackProperty]
attackProperties :: Maybe [AttackProperty]
$sel:attackProperties:AttackDetail' :: AttackDetail -> Maybe [AttackProperty]
attackProperties} -> Maybe [AttackProperty]
attackProperties) (\s :: AttackDetail
s@AttackDetail' {} Maybe [AttackProperty]
a -> AttackDetail
s {$sel:attackProperties:AttackDetail' :: Maybe [AttackProperty]
attackProperties = Maybe [AttackProperty]
a} :: AttackDetail) ((Maybe [AttackProperty] -> f (Maybe [AttackProperty]))
 -> AttackDetail -> f AttackDetail)
-> ((Maybe [AttackProperty] -> f (Maybe [AttackProperty]))
    -> Maybe [AttackProperty] -> f (Maybe [AttackProperty]))
-> (Maybe [AttackProperty] -> f (Maybe [AttackProperty]))
-> AttackDetail
-> f AttackDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AttackProperty] [AttackProperty] [AttackProperty] [AttackProperty]
-> Iso
     (Maybe [AttackProperty])
     (Maybe [AttackProperty])
     (Maybe [AttackProperty])
     (Maybe [AttackProperty])
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
  [AttackProperty] [AttackProperty] [AttackProperty] [AttackProperty]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | List of counters that describe the attack for the specified time period.
attackDetail_attackCounters :: Lens.Lens' AttackDetail (Prelude.Maybe [SummarizedCounter])
attackDetail_attackCounters :: (Maybe [SummarizedCounter] -> f (Maybe [SummarizedCounter]))
-> AttackDetail -> f AttackDetail
attackDetail_attackCounters = (AttackDetail -> Maybe [SummarizedCounter])
-> (AttackDetail -> Maybe [SummarizedCounter] -> AttackDetail)
-> Lens
     AttackDetail
     AttackDetail
     (Maybe [SummarizedCounter])
     (Maybe [SummarizedCounter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackDetail' {Maybe [SummarizedCounter]
attackCounters :: Maybe [SummarizedCounter]
$sel:attackCounters:AttackDetail' :: AttackDetail -> Maybe [SummarizedCounter]
attackCounters} -> Maybe [SummarizedCounter]
attackCounters) (\s :: AttackDetail
s@AttackDetail' {} Maybe [SummarizedCounter]
a -> AttackDetail
s {$sel:attackCounters:AttackDetail' :: Maybe [SummarizedCounter]
attackCounters = Maybe [SummarizedCounter]
a} :: AttackDetail) ((Maybe [SummarizedCounter] -> f (Maybe [SummarizedCounter]))
 -> AttackDetail -> f AttackDetail)
-> ((Maybe [SummarizedCounter] -> f (Maybe [SummarizedCounter]))
    -> Maybe [SummarizedCounter] -> f (Maybe [SummarizedCounter]))
-> (Maybe [SummarizedCounter] -> f (Maybe [SummarizedCounter]))
-> AttackDetail
-> f AttackDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SummarizedCounter]
  [SummarizedCounter]
  [SummarizedCounter]
  [SummarizedCounter]
-> Iso
     (Maybe [SummarizedCounter])
     (Maybe [SummarizedCounter])
     (Maybe [SummarizedCounter])
     (Maybe [SummarizedCounter])
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
  [SummarizedCounter]
  [SummarizedCounter]
  [SummarizedCounter]
  [SummarizedCounter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN (Amazon Resource Name) of the resource that was attacked.
attackDetail_resourceArn :: Lens.Lens' AttackDetail (Prelude.Maybe Prelude.Text)
attackDetail_resourceArn :: (Maybe Text -> f (Maybe Text)) -> AttackDetail -> f AttackDetail
attackDetail_resourceArn = (AttackDetail -> Maybe Text)
-> (AttackDetail -> Maybe Text -> AttackDetail)
-> Lens AttackDetail AttackDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackDetail' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:AttackDetail' :: AttackDetail -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: AttackDetail
s@AttackDetail' {} Maybe Text
a -> AttackDetail
s {$sel:resourceArn:AttackDetail' :: Maybe Text
resourceArn = Maybe Text
a} :: AttackDetail)

-- | The time the attack ended, in Unix time in seconds. For more information
-- see
-- <http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#parameter-types timestamp>.
attackDetail_endTime :: Lens.Lens' AttackDetail (Prelude.Maybe Prelude.UTCTime)
attackDetail_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AttackDetail -> f AttackDetail
attackDetail_endTime = (AttackDetail -> Maybe POSIX)
-> (AttackDetail -> Maybe POSIX -> AttackDetail)
-> Lens AttackDetail AttackDetail (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackDetail' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:AttackDetail' :: AttackDetail -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: AttackDetail
s@AttackDetail' {} Maybe POSIX
a -> AttackDetail
s {$sel:endTime:AttackDetail' :: Maybe POSIX
endTime = Maybe POSIX
a} :: AttackDetail) ((Maybe POSIX -> f (Maybe POSIX))
 -> AttackDetail -> f AttackDetail)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AttackDetail
-> f AttackDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON AttackDetail where
  parseJSON :: Value -> Parser AttackDetail
parseJSON =
    String
-> (Object -> Parser AttackDetail) -> Value -> Parser AttackDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AttackDetail"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe [SubResourceSummary]
-> Maybe [Mitigation]
-> Maybe [AttackProperty]
-> Maybe [SummarizedCounter]
-> Maybe Text
-> Maybe POSIX
-> AttackDetail
AttackDetail'
            (Maybe Text
 -> Maybe POSIX
 -> Maybe [SubResourceSummary]
 -> Maybe [Mitigation]
 -> Maybe [AttackProperty]
 -> Maybe [SummarizedCounter]
 -> Maybe Text
 -> Maybe POSIX
 -> AttackDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe [SubResourceSummary]
      -> Maybe [Mitigation]
      -> Maybe [AttackProperty]
      -> Maybe [SummarizedCounter]
      -> Maybe Text
      -> Maybe POSIX
      -> AttackDetail)
forall (f :: * -> *) a b. Functor 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
"AttackId")
            Parser
  (Maybe POSIX
   -> Maybe [SubResourceSummary]
   -> Maybe [Mitigation]
   -> Maybe [AttackProperty]
   -> Maybe [SummarizedCounter]
   -> Maybe Text
   -> Maybe POSIX
   -> AttackDetail)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe [SubResourceSummary]
      -> Maybe [Mitigation]
      -> Maybe [AttackProperty]
      -> Maybe [SummarizedCounter]
      -> Maybe Text
      -> Maybe POSIX
      -> AttackDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTime")
            Parser
  (Maybe [SubResourceSummary]
   -> Maybe [Mitigation]
   -> Maybe [AttackProperty]
   -> Maybe [SummarizedCounter]
   -> Maybe Text
   -> Maybe POSIX
   -> AttackDetail)
-> Parser (Maybe [SubResourceSummary])
-> Parser
     (Maybe [Mitigation]
      -> Maybe [AttackProperty]
      -> Maybe [SummarizedCounter]
      -> Maybe Text
      -> Maybe POSIX
      -> AttackDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [SubResourceSummary]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubResources" Parser (Maybe (Maybe [SubResourceSummary]))
-> Maybe [SubResourceSummary]
-> Parser (Maybe [SubResourceSummary])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [SubResourceSummary]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [Mitigation]
   -> Maybe [AttackProperty]
   -> Maybe [SummarizedCounter]
   -> Maybe Text
   -> Maybe POSIX
   -> AttackDetail)
-> Parser (Maybe [Mitigation])
-> Parser
     (Maybe [AttackProperty]
      -> Maybe [SummarizedCounter]
      -> Maybe Text
      -> Maybe POSIX
      -> AttackDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Mitigation]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Mitigations" Parser (Maybe (Maybe [Mitigation]))
-> Maybe [Mitigation] -> Parser (Maybe [Mitigation])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Mitigation]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [AttackProperty]
   -> Maybe [SummarizedCounter]
   -> Maybe Text
   -> Maybe POSIX
   -> AttackDetail)
-> Parser (Maybe [AttackProperty])
-> Parser
     (Maybe [SummarizedCounter]
      -> Maybe Text -> Maybe POSIX -> AttackDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AttackProperty]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AttackProperties"
                            Parser (Maybe (Maybe [AttackProperty]))
-> Maybe [AttackProperty] -> Parser (Maybe [AttackProperty])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AttackProperty]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [SummarizedCounter]
   -> Maybe Text -> Maybe POSIX -> AttackDetail)
-> Parser (Maybe [SummarizedCounter])
-> Parser (Maybe Text -> Maybe POSIX -> AttackDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [SummarizedCounter]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AttackCounters" Parser (Maybe (Maybe [SummarizedCounter]))
-> Maybe [SummarizedCounter] -> Parser (Maybe [SummarizedCounter])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [SummarizedCounter]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Maybe POSIX -> AttackDetail)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> AttackDetail)
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
"ResourceArn")
            Parser (Maybe POSIX -> AttackDetail)
-> Parser (Maybe POSIX) -> Parser AttackDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndTime")
      )

instance Prelude.Hashable AttackDetail

instance Prelude.NFData AttackDetail