{-# 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 #-}
module Amazonka.Shield.Types.AttackProperty where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Shield.Types.AttackLayer
import Amazonka.Shield.Types.AttackPropertyIdentifier
import Amazonka.Shield.Types.Contributor
import Amazonka.Shield.Types.Unit
data AttackProperty = AttackProperty'
{
AttackProperty -> Maybe AttackLayer
attackLayer :: Prelude.Maybe AttackLayer,
AttackProperty -> Maybe [Contributor]
topContributors :: Prelude.Maybe [Contributor],
AttackProperty -> Maybe AttackPropertyIdentifier
attackPropertyIdentifier :: Prelude.Maybe AttackPropertyIdentifier,
AttackProperty -> Maybe Integer
total :: Prelude.Maybe Prelude.Integer,
AttackProperty -> Maybe Unit
unit :: Prelude.Maybe Unit
}
deriving (AttackProperty -> AttackProperty -> Bool
(AttackProperty -> AttackProperty -> Bool)
-> (AttackProperty -> AttackProperty -> Bool) -> Eq AttackProperty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttackProperty -> AttackProperty -> Bool
$c/= :: AttackProperty -> AttackProperty -> Bool
== :: AttackProperty -> AttackProperty -> Bool
$c== :: AttackProperty -> AttackProperty -> Bool
Prelude.Eq, ReadPrec [AttackProperty]
ReadPrec AttackProperty
Int -> ReadS AttackProperty
ReadS [AttackProperty]
(Int -> ReadS AttackProperty)
-> ReadS [AttackProperty]
-> ReadPrec AttackProperty
-> ReadPrec [AttackProperty]
-> Read AttackProperty
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttackProperty]
$creadListPrec :: ReadPrec [AttackProperty]
readPrec :: ReadPrec AttackProperty
$creadPrec :: ReadPrec AttackProperty
readList :: ReadS [AttackProperty]
$creadList :: ReadS [AttackProperty]
readsPrec :: Int -> ReadS AttackProperty
$creadsPrec :: Int -> ReadS AttackProperty
Prelude.Read, Int -> AttackProperty -> ShowS
[AttackProperty] -> ShowS
AttackProperty -> String
(Int -> AttackProperty -> ShowS)
-> (AttackProperty -> String)
-> ([AttackProperty] -> ShowS)
-> Show AttackProperty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttackProperty] -> ShowS
$cshowList :: [AttackProperty] -> ShowS
show :: AttackProperty -> String
$cshow :: AttackProperty -> String
showsPrec :: Int -> AttackProperty -> ShowS
$cshowsPrec :: Int -> AttackProperty -> ShowS
Prelude.Show, (forall x. AttackProperty -> Rep AttackProperty x)
-> (forall x. Rep AttackProperty x -> AttackProperty)
-> Generic AttackProperty
forall x. Rep AttackProperty x -> AttackProperty
forall x. AttackProperty -> Rep AttackProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttackProperty x -> AttackProperty
$cfrom :: forall x. AttackProperty -> Rep AttackProperty x
Prelude.Generic)
newAttackProperty ::
AttackProperty
newAttackProperty :: AttackProperty
newAttackProperty =
AttackProperty' :: Maybe AttackLayer
-> Maybe [Contributor]
-> Maybe AttackPropertyIdentifier
-> Maybe Integer
-> Maybe Unit
-> AttackProperty
AttackProperty'
{ $sel:attackLayer:AttackProperty' :: Maybe AttackLayer
attackLayer = Maybe AttackLayer
forall a. Maybe a
Prelude.Nothing,
$sel:topContributors:AttackProperty' :: Maybe [Contributor]
topContributors = Maybe [Contributor]
forall a. Maybe a
Prelude.Nothing,
$sel:attackPropertyIdentifier:AttackProperty' :: Maybe AttackPropertyIdentifier
attackPropertyIdentifier = Maybe AttackPropertyIdentifier
forall a. Maybe a
Prelude.Nothing,
$sel:total:AttackProperty' :: Maybe Integer
total = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:unit:AttackProperty' :: Maybe Unit
unit = Maybe Unit
forall a. Maybe a
Prelude.Nothing
}
attackProperty_attackLayer :: Lens.Lens' AttackProperty (Prelude.Maybe AttackLayer)
attackProperty_attackLayer :: (Maybe AttackLayer -> f (Maybe AttackLayer))
-> AttackProperty -> f AttackProperty
attackProperty_attackLayer = (AttackProperty -> Maybe AttackLayer)
-> (AttackProperty -> Maybe AttackLayer -> AttackProperty)
-> Lens
AttackProperty
AttackProperty
(Maybe AttackLayer)
(Maybe AttackLayer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackProperty' {Maybe AttackLayer
attackLayer :: Maybe AttackLayer
$sel:attackLayer:AttackProperty' :: AttackProperty -> Maybe AttackLayer
attackLayer} -> Maybe AttackLayer
attackLayer) (\s :: AttackProperty
s@AttackProperty' {} Maybe AttackLayer
a -> AttackProperty
s {$sel:attackLayer:AttackProperty' :: Maybe AttackLayer
attackLayer = Maybe AttackLayer
a} :: AttackProperty)
attackProperty_topContributors :: Lens.Lens' AttackProperty (Prelude.Maybe [Contributor])
attackProperty_topContributors :: (Maybe [Contributor] -> f (Maybe [Contributor]))
-> AttackProperty -> f AttackProperty
attackProperty_topContributors = (AttackProperty -> Maybe [Contributor])
-> (AttackProperty -> Maybe [Contributor] -> AttackProperty)
-> Lens
AttackProperty
AttackProperty
(Maybe [Contributor])
(Maybe [Contributor])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackProperty' {Maybe [Contributor]
topContributors :: Maybe [Contributor]
$sel:topContributors:AttackProperty' :: AttackProperty -> Maybe [Contributor]
topContributors} -> Maybe [Contributor]
topContributors) (\s :: AttackProperty
s@AttackProperty' {} Maybe [Contributor]
a -> AttackProperty
s {$sel:topContributors:AttackProperty' :: Maybe [Contributor]
topContributors = Maybe [Contributor]
a} :: AttackProperty) ((Maybe [Contributor] -> f (Maybe [Contributor]))
-> AttackProperty -> f AttackProperty)
-> ((Maybe [Contributor] -> f (Maybe [Contributor]))
-> Maybe [Contributor] -> f (Maybe [Contributor]))
-> (Maybe [Contributor] -> f (Maybe [Contributor]))
-> AttackProperty
-> f AttackProperty
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Contributor] [Contributor] [Contributor] [Contributor]
-> Iso
(Maybe [Contributor])
(Maybe [Contributor])
(Maybe [Contributor])
(Maybe [Contributor])
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 [Contributor] [Contributor] [Contributor] [Contributor]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
attackProperty_attackPropertyIdentifier :: Lens.Lens' AttackProperty (Prelude.Maybe AttackPropertyIdentifier)
attackProperty_attackPropertyIdentifier :: (Maybe AttackPropertyIdentifier
-> f (Maybe AttackPropertyIdentifier))
-> AttackProperty -> f AttackProperty
attackProperty_attackPropertyIdentifier = (AttackProperty -> Maybe AttackPropertyIdentifier)
-> (AttackProperty
-> Maybe AttackPropertyIdentifier -> AttackProperty)
-> Lens
AttackProperty
AttackProperty
(Maybe AttackPropertyIdentifier)
(Maybe AttackPropertyIdentifier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackProperty' {Maybe AttackPropertyIdentifier
attackPropertyIdentifier :: Maybe AttackPropertyIdentifier
$sel:attackPropertyIdentifier:AttackProperty' :: AttackProperty -> Maybe AttackPropertyIdentifier
attackPropertyIdentifier} -> Maybe AttackPropertyIdentifier
attackPropertyIdentifier) (\s :: AttackProperty
s@AttackProperty' {} Maybe AttackPropertyIdentifier
a -> AttackProperty
s {$sel:attackPropertyIdentifier:AttackProperty' :: Maybe AttackPropertyIdentifier
attackPropertyIdentifier = Maybe AttackPropertyIdentifier
a} :: AttackProperty)
attackProperty_total :: Lens.Lens' AttackProperty (Prelude.Maybe Prelude.Integer)
attackProperty_total :: (Maybe Integer -> f (Maybe Integer))
-> AttackProperty -> f AttackProperty
attackProperty_total = (AttackProperty -> Maybe Integer)
-> (AttackProperty -> Maybe Integer -> AttackProperty)
-> Lens
AttackProperty AttackProperty (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackProperty' {Maybe Integer
total :: Maybe Integer
$sel:total:AttackProperty' :: AttackProperty -> Maybe Integer
total} -> Maybe Integer
total) (\s :: AttackProperty
s@AttackProperty' {} Maybe Integer
a -> AttackProperty
s {$sel:total:AttackProperty' :: Maybe Integer
total = Maybe Integer
a} :: AttackProperty)
attackProperty_unit :: Lens.Lens' AttackProperty (Prelude.Maybe Unit)
attackProperty_unit :: (Maybe Unit -> f (Maybe Unit))
-> AttackProperty -> f AttackProperty
attackProperty_unit = (AttackProperty -> Maybe Unit)
-> (AttackProperty -> Maybe Unit -> AttackProperty)
-> Lens AttackProperty AttackProperty (Maybe Unit) (Maybe Unit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttackProperty' {Maybe Unit
unit :: Maybe Unit
$sel:unit:AttackProperty' :: AttackProperty -> Maybe Unit
unit} -> Maybe Unit
unit) (\s :: AttackProperty
s@AttackProperty' {} Maybe Unit
a -> AttackProperty
s {$sel:unit:AttackProperty' :: Maybe Unit
unit = Maybe Unit
a} :: AttackProperty)
instance Core.FromJSON AttackProperty where
parseJSON :: Value -> Parser AttackProperty
parseJSON =
String
-> (Object -> Parser AttackProperty)
-> Value
-> Parser AttackProperty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AttackProperty"
( \Object
x ->
Maybe AttackLayer
-> Maybe [Contributor]
-> Maybe AttackPropertyIdentifier
-> Maybe Integer
-> Maybe Unit
-> AttackProperty
AttackProperty'
(Maybe AttackLayer
-> Maybe [Contributor]
-> Maybe AttackPropertyIdentifier
-> Maybe Integer
-> Maybe Unit
-> AttackProperty)
-> Parser (Maybe AttackLayer)
-> Parser
(Maybe [Contributor]
-> Maybe AttackPropertyIdentifier
-> Maybe Integer
-> Maybe Unit
-> AttackProperty)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AttackLayer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AttackLayer")
Parser
(Maybe [Contributor]
-> Maybe AttackPropertyIdentifier
-> Maybe Integer
-> Maybe Unit
-> AttackProperty)
-> Parser (Maybe [Contributor])
-> Parser
(Maybe AttackPropertyIdentifier
-> Maybe Integer -> Maybe Unit -> AttackProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Contributor]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TopContributors"
Parser (Maybe (Maybe [Contributor]))
-> Maybe [Contributor] -> Parser (Maybe [Contributor])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Contributor]
forall a. Monoid a => a
Prelude.mempty
)
Parser
(Maybe AttackPropertyIdentifier
-> Maybe Integer -> Maybe Unit -> AttackProperty)
-> Parser (Maybe AttackPropertyIdentifier)
-> Parser (Maybe Integer -> Maybe Unit -> AttackProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AttackPropertyIdentifier)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AttackPropertyIdentifier")
Parser (Maybe Integer -> Maybe Unit -> AttackProperty)
-> Parser (Maybe Integer) -> Parser (Maybe Unit -> AttackProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Total")
Parser (Maybe Unit -> AttackProperty)
-> Parser (Maybe Unit) -> Parser AttackProperty
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Unit)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Unit")
)
instance Prelude.Hashable AttackProperty
instance Prelude.NFData AttackProperty