{-# 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.WAFV2.Types.SampledHTTPRequest
-- 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.WAFV2.Types.SampledHTTPRequest 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.WAFV2.Types.CaptchaResponse
import Amazonka.WAFV2.Types.ChallengeResponse
import Amazonka.WAFV2.Types.HTTPHeader
import Amazonka.WAFV2.Types.HTTPRequest
import Amazonka.WAFV2.Types.Label

-- | Represents a single sampled web request. The response from
-- GetSampledRequests includes a @SampledHTTPRequests@ complex type that
-- appears as @SampledRequests@ in the response syntax.
-- @SampledHTTPRequests@ contains an array of @SampledHTTPRequest@ objects.
--
-- /See:/ 'newSampledHTTPRequest' smart constructor.
data SampledHTTPRequest = SampledHTTPRequest'
  { -- | The action that WAF applied to the request.
    SampledHTTPRequest -> Maybe Text
action :: Prelude.Maybe Prelude.Text,
    -- | The @CAPTCHA@ response for the request.
    SampledHTTPRequest -> Maybe CaptchaResponse
captchaResponse :: Prelude.Maybe CaptchaResponse,
    -- | The @Challenge@ response for the request.
    SampledHTTPRequest -> Maybe ChallengeResponse
challengeResponse :: Prelude.Maybe ChallengeResponse,
    -- | Labels applied to the web request by matching rules. WAF applies fully
    -- qualified labels to matching web requests. A fully qualified label is
    -- the concatenation of a label namespace and a rule label. The rule\'s
    -- rule group or web ACL defines the label namespace.
    --
    -- For example,
    -- @awswaf:111122223333:myRuleGroup:testRules:testNS1:testNS2:labelNameA@
    -- or @awswaf:managed:aws:managed-rule-set:header:encoding:utf8@.
    SampledHTTPRequest -> Maybe [Label]
labels :: Prelude.Maybe [Label],
    -- | Used only for rule group rules that have a rule action override in place
    -- in the web ACL. This is the action that the rule group rule is
    -- configured for, and not the action that was applied to the request. The
    -- action that WAF applied is the @Action@ value.
    SampledHTTPRequest -> Maybe Text
overriddenAction :: Prelude.Maybe Prelude.Text,
    -- | Custom request headers inserted by WAF into the request, according to
    -- the custom request configuration for the matching rule action.
    SampledHTTPRequest -> Maybe [HTTPHeader]
requestHeadersInserted :: Prelude.Maybe [HTTPHeader],
    -- | The response code that was sent for the request.
    SampledHTTPRequest -> Maybe Natural
responseCodeSent :: Prelude.Maybe Prelude.Natural,
    -- | The name of the @Rule@ that the request matched. For managed rule
    -- groups, the format for this name is
    -- @\<vendor name>#\<managed rule group name>#\<rule name>@. For your own
    -- rule groups, the format for this name is
    -- @\<rule group name>#\<rule name>@. If the rule is not in a rule group,
    -- this field is absent.
    SampledHTTPRequest -> Maybe Text
ruleNameWithinRuleGroup :: Prelude.Maybe Prelude.Text,
    -- | The time at which WAF received the request from your Amazon Web Services
    -- resource, in Unix time format (in seconds).
    SampledHTTPRequest -> Maybe POSIX
timestamp :: Prelude.Maybe Data.POSIX,
    -- | A complex type that contains detailed information about the request.
    SampledHTTPRequest -> HTTPRequest
request :: HTTPRequest,
    -- | A value that indicates how one result in the response relates
    -- proportionally to other results in the response. For example, a result
    -- that has a weight of @2@ represents roughly twice as many web requests
    -- as a result that has a weight of @1@.
    SampledHTTPRequest -> Natural
weight :: Prelude.Natural
  }
  deriving (SampledHTTPRequest -> SampledHTTPRequest -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'SampledHTTPRequest' 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:
--
-- 'action', 'sampledHTTPRequest_action' - The action that WAF applied to the request.
--
-- 'captchaResponse', 'sampledHTTPRequest_captchaResponse' - The @CAPTCHA@ response for the request.
--
-- 'challengeResponse', 'sampledHTTPRequest_challengeResponse' - The @Challenge@ response for the request.
--
-- 'labels', 'sampledHTTPRequest_labels' - Labels applied to the web request by matching rules. WAF applies fully
-- qualified labels to matching web requests. A fully qualified label is
-- the concatenation of a label namespace and a rule label. The rule\'s
-- rule group or web ACL defines the label namespace.
--
-- For example,
-- @awswaf:111122223333:myRuleGroup:testRules:testNS1:testNS2:labelNameA@
-- or @awswaf:managed:aws:managed-rule-set:header:encoding:utf8@.
--
-- 'overriddenAction', 'sampledHTTPRequest_overriddenAction' - Used only for rule group rules that have a rule action override in place
-- in the web ACL. This is the action that the rule group rule is
-- configured for, and not the action that was applied to the request. The
-- action that WAF applied is the @Action@ value.
--
-- 'requestHeadersInserted', 'sampledHTTPRequest_requestHeadersInserted' - Custom request headers inserted by WAF into the request, according to
-- the custom request configuration for the matching rule action.
--
-- 'responseCodeSent', 'sampledHTTPRequest_responseCodeSent' - The response code that was sent for the request.
--
-- 'ruleNameWithinRuleGroup', 'sampledHTTPRequest_ruleNameWithinRuleGroup' - The name of the @Rule@ that the request matched. For managed rule
-- groups, the format for this name is
-- @\<vendor name>#\<managed rule group name>#\<rule name>@. For your own
-- rule groups, the format for this name is
-- @\<rule group name>#\<rule name>@. If the rule is not in a rule group,
-- this field is absent.
--
-- 'timestamp', 'sampledHTTPRequest_timestamp' - The time at which WAF received the request from your Amazon Web Services
-- resource, in Unix time format (in seconds).
--
-- 'request', 'sampledHTTPRequest_request' - A complex type that contains detailed information about the request.
--
-- 'weight', 'sampledHTTPRequest_weight' - A value that indicates how one result in the response relates
-- proportionally to other results in the response. For example, a result
-- that has a weight of @2@ represents roughly twice as many web requests
-- as a result that has a weight of @1@.
newSampledHTTPRequest ::
  -- | 'request'
  HTTPRequest ->
  -- | 'weight'
  Prelude.Natural ->
  SampledHTTPRequest
newSampledHTTPRequest :: HTTPRequest -> Natural -> SampledHTTPRequest
newSampledHTTPRequest HTTPRequest
pRequest_ Natural
pWeight_ =
  SampledHTTPRequest'
    { $sel:action:SampledHTTPRequest' :: Maybe Text
action = forall a. Maybe a
Prelude.Nothing,
      $sel:captchaResponse:SampledHTTPRequest' :: Maybe CaptchaResponse
captchaResponse = forall a. Maybe a
Prelude.Nothing,
      $sel:challengeResponse:SampledHTTPRequest' :: Maybe ChallengeResponse
challengeResponse = forall a. Maybe a
Prelude.Nothing,
      $sel:labels:SampledHTTPRequest' :: Maybe [Label]
labels = forall a. Maybe a
Prelude.Nothing,
      $sel:overriddenAction:SampledHTTPRequest' :: Maybe Text
overriddenAction = forall a. Maybe a
Prelude.Nothing,
      $sel:requestHeadersInserted:SampledHTTPRequest' :: Maybe [HTTPHeader]
requestHeadersInserted = forall a. Maybe a
Prelude.Nothing,
      $sel:responseCodeSent:SampledHTTPRequest' :: Maybe Natural
responseCodeSent = forall a. Maybe a
Prelude.Nothing,
      $sel:ruleNameWithinRuleGroup:SampledHTTPRequest' :: Maybe Text
ruleNameWithinRuleGroup = forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:SampledHTTPRequest' :: Maybe POSIX
timestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:request:SampledHTTPRequest' :: HTTPRequest
request = HTTPRequest
pRequest_,
      $sel:weight:SampledHTTPRequest' :: Natural
weight = Natural
pWeight_
    }

-- | The action that WAF applied to the request.
sampledHTTPRequest_action :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe Prelude.Text)
sampledHTTPRequest_action :: Lens' SampledHTTPRequest (Maybe Text)
sampledHTTPRequest_action = 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)

-- | The @CAPTCHA@ response for the request.
sampledHTTPRequest_captchaResponse :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe CaptchaResponse)
sampledHTTPRequest_captchaResponse :: Lens' SampledHTTPRequest (Maybe CaptchaResponse)
sampledHTTPRequest_captchaResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Maybe CaptchaResponse
captchaResponse :: Maybe CaptchaResponse
$sel:captchaResponse:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe CaptchaResponse
captchaResponse} -> Maybe CaptchaResponse
captchaResponse) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Maybe CaptchaResponse
a -> SampledHTTPRequest
s {$sel:captchaResponse:SampledHTTPRequest' :: Maybe CaptchaResponse
captchaResponse = Maybe CaptchaResponse
a} :: SampledHTTPRequest)

-- | The @Challenge@ response for the request.
sampledHTTPRequest_challengeResponse :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe ChallengeResponse)
sampledHTTPRequest_challengeResponse :: Lens' SampledHTTPRequest (Maybe ChallengeResponse)
sampledHTTPRequest_challengeResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Maybe ChallengeResponse
challengeResponse :: Maybe ChallengeResponse
$sel:challengeResponse:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe ChallengeResponse
challengeResponse} -> Maybe ChallengeResponse
challengeResponse) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Maybe ChallengeResponse
a -> SampledHTTPRequest
s {$sel:challengeResponse:SampledHTTPRequest' :: Maybe ChallengeResponse
challengeResponse = Maybe ChallengeResponse
a} :: SampledHTTPRequest)

-- | Labels applied to the web request by matching rules. WAF applies fully
-- qualified labels to matching web requests. A fully qualified label is
-- the concatenation of a label namespace and a rule label. The rule\'s
-- rule group or web ACL defines the label namespace.
--
-- For example,
-- @awswaf:111122223333:myRuleGroup:testRules:testNS1:testNS2:labelNameA@
-- or @awswaf:managed:aws:managed-rule-set:header:encoding:utf8@.
sampledHTTPRequest_labels :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe [Label])
sampledHTTPRequest_labels :: Lens' SampledHTTPRequest (Maybe [Label])
sampledHTTPRequest_labels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Maybe [Label]
labels :: Maybe [Label]
$sel:labels:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe [Label]
labels} -> Maybe [Label]
labels) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Maybe [Label]
a -> SampledHTTPRequest
s {$sel:labels:SampledHTTPRequest' :: Maybe [Label]
labels = Maybe [Label]
a} :: SampledHTTPRequest) 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

-- | Used only for rule group rules that have a rule action override in place
-- in the web ACL. This is the action that the rule group rule is
-- configured for, and not the action that was applied to the request. The
-- action that WAF applied is the @Action@ value.
sampledHTTPRequest_overriddenAction :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe Prelude.Text)
sampledHTTPRequest_overriddenAction :: Lens' SampledHTTPRequest (Maybe Text)
sampledHTTPRequest_overriddenAction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Maybe Text
overriddenAction :: Maybe Text
$sel:overriddenAction:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Text
overriddenAction} -> Maybe Text
overriddenAction) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Maybe Text
a -> SampledHTTPRequest
s {$sel:overriddenAction:SampledHTTPRequest' :: Maybe Text
overriddenAction = Maybe Text
a} :: SampledHTTPRequest)

-- | Custom request headers inserted by WAF into the request, according to
-- the custom request configuration for the matching rule action.
sampledHTTPRequest_requestHeadersInserted :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe [HTTPHeader])
sampledHTTPRequest_requestHeadersInserted :: Lens' SampledHTTPRequest (Maybe [HTTPHeader])
sampledHTTPRequest_requestHeadersInserted = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Maybe [HTTPHeader]
requestHeadersInserted :: Maybe [HTTPHeader]
$sel:requestHeadersInserted:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe [HTTPHeader]
requestHeadersInserted} -> Maybe [HTTPHeader]
requestHeadersInserted) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Maybe [HTTPHeader]
a -> SampledHTTPRequest
s {$sel:requestHeadersInserted:SampledHTTPRequest' :: Maybe [HTTPHeader]
requestHeadersInserted = Maybe [HTTPHeader]
a} :: SampledHTTPRequest) 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 response code that was sent for the request.
sampledHTTPRequest_responseCodeSent :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe Prelude.Natural)
sampledHTTPRequest_responseCodeSent :: Lens' SampledHTTPRequest (Maybe Natural)
sampledHTTPRequest_responseCodeSent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Maybe Natural
responseCodeSent :: Maybe Natural
$sel:responseCodeSent:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Natural
responseCodeSent} -> Maybe Natural
responseCodeSent) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Maybe Natural
a -> SampledHTTPRequest
s {$sel:responseCodeSent:SampledHTTPRequest' :: Maybe Natural
responseCodeSent = Maybe Natural
a} :: SampledHTTPRequest)

-- | The name of the @Rule@ that the request matched. For managed rule
-- groups, the format for this name is
-- @\<vendor name>#\<managed rule group name>#\<rule name>@. For your own
-- rule groups, the format for this name is
-- @\<rule group name>#\<rule name>@. If the rule is not in a rule group,
-- this field is absent.
sampledHTTPRequest_ruleNameWithinRuleGroup :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe Prelude.Text)
sampledHTTPRequest_ruleNameWithinRuleGroup :: Lens' SampledHTTPRequest (Maybe Text)
sampledHTTPRequest_ruleNameWithinRuleGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampledHTTPRequest' {Maybe Text
ruleNameWithinRuleGroup :: Maybe Text
$sel:ruleNameWithinRuleGroup:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Text
ruleNameWithinRuleGroup} -> Maybe Text
ruleNameWithinRuleGroup) (\s :: SampledHTTPRequest
s@SampledHTTPRequest' {} Maybe Text
a -> SampledHTTPRequest
s {$sel:ruleNameWithinRuleGroup:SampledHTTPRequest' :: Maybe Text
ruleNameWithinRuleGroup = Maybe Text
a} :: SampledHTTPRequest)

-- | The time at which WAF received the request from your Amazon Web Services
-- resource, in Unix time format (in seconds).
sampledHTTPRequest_timestamp :: Lens.Lens' SampledHTTPRequest (Prelude.Maybe Prelude.UTCTime)
sampledHTTPRequest_timestamp :: Lens' SampledHTTPRequest (Maybe UTCTime)
sampledHTTPRequest_timestamp = 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) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A complex type that contains detailed information about the request.
sampledHTTPRequest_request :: Lens.Lens' SampledHTTPRequest HTTPRequest
sampledHTTPRequest_request :: Lens' SampledHTTPRequest HTTPRequest
sampledHTTPRequest_request = 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)

-- | A value that indicates how one result in the response relates
-- proportionally to other results in the response. For example, a result
-- that has a weight of @2@ represents roughly twice as many web requests
-- as a result that has a weight of @1@.
sampledHTTPRequest_weight :: Lens.Lens' SampledHTTPRequest Prelude.Natural
sampledHTTPRequest_weight :: Lens' SampledHTTPRequest Natural
sampledHTTPRequest_weight = 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 Data.FromJSON SampledHTTPRequest where
  parseJSON :: Value -> Parser SampledHTTPRequest
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SampledHTTPRequest"
      ( \Object
x ->
          Maybe Text
-> Maybe CaptchaResponse
-> Maybe ChallengeResponse
-> Maybe [Label]
-> Maybe Text
-> Maybe [HTTPHeader]
-> Maybe Natural
-> Maybe Text
-> Maybe POSIX
-> HTTPRequest
-> Natural
-> SampledHTTPRequest
SampledHTTPRequest'
            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
"Action")
            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
"CaptchaResponse")
            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
"ChallengeResponse")
            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
"Labels" 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 (Maybe a)
Data..:? Key
"OverriddenAction")
            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
"RequestHeadersInserted"
                            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 (Maybe a)
Data..:? Key
"ResponseCodeSent")
            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
"RuleNameWithinRuleGroup")
            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
"Timestamp")
            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
"Request")
            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
"Weight")
      )

instance Prelude.Hashable SampledHTTPRequest where
  hashWithSalt :: Int -> SampledHTTPRequest -> Int
hashWithSalt Int
_salt SampledHTTPRequest' {Natural
Maybe Natural
Maybe [HTTPHeader]
Maybe [Label]
Maybe Text
Maybe POSIX
Maybe ChallengeResponse
Maybe CaptchaResponse
HTTPRequest
weight :: Natural
request :: HTTPRequest
timestamp :: Maybe POSIX
ruleNameWithinRuleGroup :: Maybe Text
responseCodeSent :: Maybe Natural
requestHeadersInserted :: Maybe [HTTPHeader]
overriddenAction :: Maybe Text
labels :: Maybe [Label]
challengeResponse :: Maybe ChallengeResponse
captchaResponse :: Maybe CaptchaResponse
action :: Maybe Text
$sel:weight:SampledHTTPRequest' :: SampledHTTPRequest -> Natural
$sel:request:SampledHTTPRequest' :: SampledHTTPRequest -> HTTPRequest
$sel:timestamp:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe POSIX
$sel:ruleNameWithinRuleGroup:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Text
$sel:responseCodeSent:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Natural
$sel:requestHeadersInserted:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe [HTTPHeader]
$sel:overriddenAction:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Text
$sel:labels:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe [Label]
$sel:challengeResponse:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe ChallengeResponse
$sel:captchaResponse:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe CaptchaResponse
$sel:action:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
action
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CaptchaResponse
captchaResponse
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ChallengeResponse
challengeResponse
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Label]
labels
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
overriddenAction
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [HTTPHeader]
requestHeadersInserted
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
responseCodeSent
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ruleNameWithinRuleGroup
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
timestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HTTPRequest
request
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
weight

instance Prelude.NFData SampledHTTPRequest where
  rnf :: SampledHTTPRequest -> ()
rnf SampledHTTPRequest' {Natural
Maybe Natural
Maybe [HTTPHeader]
Maybe [Label]
Maybe Text
Maybe POSIX
Maybe ChallengeResponse
Maybe CaptchaResponse
HTTPRequest
weight :: Natural
request :: HTTPRequest
timestamp :: Maybe POSIX
ruleNameWithinRuleGroup :: Maybe Text
responseCodeSent :: Maybe Natural
requestHeadersInserted :: Maybe [HTTPHeader]
overriddenAction :: Maybe Text
labels :: Maybe [Label]
challengeResponse :: Maybe ChallengeResponse
captchaResponse :: Maybe CaptchaResponse
action :: Maybe Text
$sel:weight:SampledHTTPRequest' :: SampledHTTPRequest -> Natural
$sel:request:SampledHTTPRequest' :: SampledHTTPRequest -> HTTPRequest
$sel:timestamp:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe POSIX
$sel:ruleNameWithinRuleGroup:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Text
$sel:responseCodeSent:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Natural
$sel:requestHeadersInserted:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe [HTTPHeader]
$sel:overriddenAction:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Text
$sel:labels:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe [Label]
$sel:challengeResponse:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe ChallengeResponse
$sel:captchaResponse:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe CaptchaResponse
$sel:action:SampledHTTPRequest' :: SampledHTTPRequest -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
action
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CaptchaResponse
captchaResponse
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ChallengeResponse
challengeResponse
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Label]
labels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
overriddenAction
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [HTTPHeader]
requestHeadersInserted
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
responseCodeSent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ruleNameWithinRuleGroup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
timestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HTTPRequest
request
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
weight