{-# 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.WAFRegional.Types.SampledHTTPRequest where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAFRegional.Types.HTTPRequest
data SampledHTTPRequest = SampledHTTPRequest'
{
SampledHTTPRequest -> Maybe Text
ruleWithinRuleGroup :: Prelude.Maybe Prelude.Text,
SampledHTTPRequest -> Maybe Text
action :: Prelude.Maybe Prelude.Text,
SampledHTTPRequest -> Maybe POSIX
timestamp :: Prelude.Maybe Core.POSIX,
SampledHTTPRequest -> HTTPRequest
request :: HTTPRequest,
SampledHTTPRequest -> Natural
weight :: Prelude.Natural
}
deriving (SampledHTTPRequest -> SampledHTTPRequest -> Bool
(SampledHTTPRequest -> SampledHTTPRequest -> Bool)
-> (SampledHTTPRequest -> SampledHTTPRequest -> Bool)
-> Eq SampledHTTPRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SampledHTTPRequest -> SampledHTTPRequest -> Bool
$c/= :: SampledHTTPRequest -> SampledHTTPRequest -> Bool
== :: SampledHTTPRequest -> SampledHTTPRequest -> Bool
$c== :: SampledHTTPRequest -> SampledHTTPRequest -> Bool
Prelude.Eq, ReadPrec [SampledHTTPRequest]
ReadPrec SampledHTTPRequest
Int -> ReadS SampledHTTPRequest
ReadS [SampledHTTPRequest]
(Int -> ReadS SampledHTTPRequest)
-> ReadS [SampledHTTPRequest]
-> ReadPrec SampledHTTPRequest
-> ReadPrec [SampledHTTPRequest]
-> Read SampledHTTPRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SampledHTTPRequest]
$creadListPrec :: ReadPrec [SampledHTTPRequest]
readPrec :: ReadPrec SampledHTTPRequest
$creadPrec :: ReadPrec SampledHTTPRequest
readList :: ReadS [SampledHTTPRequest]
$creadList :: ReadS [SampledHTTPRequest]
readsPrec :: Int -> ReadS SampledHTTPRequest
$creadsPrec :: Int -> ReadS SampledHTTPRequest
Prelude.Read, Int -> SampledHTTPRequest -> ShowS
[SampledHTTPRequest] -> ShowS
SampledHTTPRequest -> String
(Int -> SampledHTTPRequest -> ShowS)
-> (SampledHTTPRequest -> String)
-> ([SampledHTTPRequest] -> ShowS)
-> Show SampledHTTPRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SampledHTTPRequest] -> ShowS
$cshowList :: [SampledHTTPRequest] -> ShowS
show :: SampledHTTPRequest -> String
$cshow :: SampledHTTPRequest -> String
showsPrec :: Int -> SampledHTTPRequest -> ShowS
$cshowsPrec :: Int -> SampledHTTPRequest -> ShowS
Prelude.Show, (forall x. SampledHTTPRequest -> Rep SampledHTTPRequest x)
-> (forall x. Rep SampledHTTPRequest x -> SampledHTTPRequest)
-> Generic SampledHTTPRequest
forall x. Rep SampledHTTPRequest x -> SampledHTTPRequest
forall x. SampledHTTPRequest -> Rep SampledHTTPRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SampledHTTPRequest x -> SampledHTTPRequest
$cfrom :: forall x. SampledHTTPRequest -> Rep SampledHTTPRequest x
Prelude.Generic)
newSampledHTTPRequest ::
HTTPRequest ->
Prelude.Natural ->
SampledHTTPRequest
newSampledHTTPRequest :: HTTPRequest -> Natural -> SampledHTTPRequest
newSampledHTTPRequest HTTPRequest
pRequest_ Natural
pWeight_ =
SampledHTTPRequest' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> HTTPRequest
-> Natural
-> SampledHTTPRequest
SampledHTTPRequest'
{ $sel:ruleWithinRuleGroup:SampledHTTPRequest' :: Maybe Text
ruleWithinRuleGroup =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:action:SampledHTTPRequest' :: Maybe Text
action = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:SampledHTTPRequest' :: Maybe POSIX
timestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:request:SampledHTTPRequest' :: HTTPRequest
request = HTTPRequest
pRequest_,
$sel:weight:SampledHTTPRequest' :: Natural
weight = Natural
pWeight_
}
sampledHTTPRequest_ruleWithinRuleGroup :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe Prelude.Text)
sampledHTTPRequest_ruleWithinRuleGroup :: (Maybe Text -> f (Maybe Text))
-> SampledHTTPRequest -> f SampledHTTPRequest
sampledHTTPRequest_ruleWithinRuleGroup = (SampledHTTPRequest -> Maybe Text)
-> (SampledHTTPRequest -> Maybe Text -> SampledHTTPRequest)
-> Lens
SampledHTTPRequest SampledHTTPRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Maybe Text
ruleWithinRuleGroup :: Maybe Text
$sel:ruleWithinRuleGroup:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Text
ruleWithinRuleGroup} -> Maybe Text
ruleWithinRuleGroup) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Maybe Text
a -> SampledHTTPRequest
s {$sel:ruleWithinRuleGroup:SampledHTTPRequest' :: Maybe Text
ruleWithinRuleGroup = Maybe Text
a} :: SampledHTTPRequest)
sampledHTTPRequest_action :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe Prelude.Text)
sampledHTTPRequest_action :: (Maybe Text -> f (Maybe Text))
-> SampledHTTPRequest -> f SampledHTTPRequest
sampledHTTPRequest_action = (SampledHTTPRequest -> Maybe Text)
-> (SampledHTTPRequest -> Maybe Text -> SampledHTTPRequest)
-> Lens
SampledHTTPRequest SampledHTTPRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Maybe Text
action :: Maybe Text
$sel:action:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Text
action} -> Maybe Text
action) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Maybe Text
a -> SampledHTTPRequest
s {$sel:action:SampledHTTPRequest' :: Maybe Text
action = Maybe Text
a} :: SampledHTTPRequest)
sampledHTTPRequest_timestamp :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe Prelude.UTCTime)
sampledHTTPRequest_timestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SampledHTTPRequest -> f SampledHTTPRequest
sampledHTTPRequest_timestamp = (SampledHTTPRequest -> Maybe POSIX)
-> (SampledHTTPRequest -> Maybe POSIX -> SampledHTTPRequest)
-> Lens
SampledHTTPRequest SampledHTTPRequest (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Maybe POSIX
timestamp :: Maybe POSIX
$sel:timestamp:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe POSIX
timestamp} -> Maybe POSIX
timestamp) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Maybe POSIX
a -> SampledHTTPRequest
s {$sel:timestamp:SampledHTTPRequest' :: Maybe POSIX
timestamp = Maybe POSIX
a} :: SampledHTTPRequest) ((Maybe POSIX -> f (Maybe POSIX))
-> SampledHTTPRequest -> f SampledHTTPRequest)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SampledHTTPRequest
-> f SampledHTTPRequest
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
sampledHTTPRequest_request :: Lens.Lens' SampledHTTPRequest HTTPRequest
sampledHTTPRequest_request :: (HTTPRequest -> f HTTPRequest)
-> SampledHTTPRequest -> f SampledHTTPRequest
sampledHTTPRequest_request = (SampledHTTPRequest -> HTTPRequest)
-> (SampledHTTPRequest -> HTTPRequest -> SampledHTTPRequest)
-> Lens
SampledHTTPRequest SampledHTTPRequest HTTPRequest HTTPRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {HTTPRequest
request :: HTTPRequest
$sel:request:SampledHTTPRequest' :: SampledHTTPRequest -> HTTPRequest
request} -> HTTPRequest
request) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} HTTPRequest
a -> SampledHTTPRequest
s {$sel:request:SampledHTTPRequest' :: HTTPRequest
request = HTTPRequest
a} :: SampledHTTPRequest)
sampledHTTPRequest_weight :: Lens.Lens' SampledHTTPRequest Prelude.Natural
sampledHTTPRequest_weight :: (Natural -> f Natural)
-> SampledHTTPRequest -> f SampledHTTPRequest
sampledHTTPRequest_weight = (SampledHTTPRequest -> Natural)
-> (SampledHTTPRequest -> Natural -> SampledHTTPRequest)
-> Lens SampledHTTPRequest SampledHTTPRequest Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Natural
weight :: Natural
$sel:weight:SampledHTTPRequest' :: SampledHTTPRequest -> Natural
weight} -> Natural
weight) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Natural
a -> SampledHTTPRequest
s {$sel:weight:SampledHTTPRequest' :: Natural
weight = Natural
a} :: SampledHTTPRequest)
instance Core.FromJSON SampledHTTPRequest where
parseJSON :: Value -> Parser SampledHTTPRequest
parseJSON =
String
-> (Object -> Parser SampledHTTPRequest)
-> Value
-> Parser SampledHTTPRequest
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SampledHTTPRequest"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe POSIX
-> HTTPRequest
-> Natural
-> SampledHTTPRequest
SampledHTTPRequest'
(Maybe Text
-> Maybe Text
-> Maybe POSIX
-> HTTPRequest
-> Natural
-> SampledHTTPRequest)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe POSIX -> HTTPRequest -> Natural -> SampledHTTPRequest)
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
"RuleWithinRuleGroup")
Parser
(Maybe Text
-> Maybe POSIX -> HTTPRequest -> Natural -> SampledHTTPRequest)
-> Parser (Maybe Text)
-> Parser
(Maybe POSIX -> HTTPRequest -> Natural -> SampledHTTPRequest)
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
"Action")
Parser
(Maybe POSIX -> HTTPRequest -> Natural -> SampledHTTPRequest)
-> Parser (Maybe POSIX)
-> Parser (HTTPRequest -> Natural -> SampledHTTPRequest)
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
"Timestamp")
Parser (HTTPRequest -> Natural -> SampledHTTPRequest)
-> Parser HTTPRequest -> Parser (Natural -> SampledHTTPRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser HTTPRequest
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Request")
Parser (Natural -> SampledHTTPRequest)
-> Parser Natural -> Parser SampledHTTPRequest
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Weight")
)
instance Prelude.Hashable SampledHTTPRequest
instance Prelude.NFData SampledHTTPRequest