{-# 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.WAFV2.Types.CaptchaResponse 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.FailureReason
data CaptchaResponse = CaptchaResponse'
{
CaptchaResponse -> Maybe FailureReason
failureReason :: Prelude.Maybe FailureReason,
CaptchaResponse -> Maybe Int
responseCode :: Prelude.Maybe Prelude.Int,
CaptchaResponse -> Maybe Integer
solveTimestamp :: Prelude.Maybe Prelude.Integer
}
deriving (CaptchaResponse -> CaptchaResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaptchaResponse -> CaptchaResponse -> Bool
$c/= :: CaptchaResponse -> CaptchaResponse -> Bool
== :: CaptchaResponse -> CaptchaResponse -> Bool
$c== :: CaptchaResponse -> CaptchaResponse -> Bool
Prelude.Eq, ReadPrec [CaptchaResponse]
ReadPrec CaptchaResponse
Int -> ReadS CaptchaResponse
ReadS [CaptchaResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaptchaResponse]
$creadListPrec :: ReadPrec [CaptchaResponse]
readPrec :: ReadPrec CaptchaResponse
$creadPrec :: ReadPrec CaptchaResponse
readList :: ReadS [CaptchaResponse]
$creadList :: ReadS [CaptchaResponse]
readsPrec :: Int -> ReadS CaptchaResponse
$creadsPrec :: Int -> ReadS CaptchaResponse
Prelude.Read, Int -> CaptchaResponse -> ShowS
[CaptchaResponse] -> ShowS
CaptchaResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaptchaResponse] -> ShowS
$cshowList :: [CaptchaResponse] -> ShowS
show :: CaptchaResponse -> String
$cshow :: CaptchaResponse -> String
showsPrec :: Int -> CaptchaResponse -> ShowS
$cshowsPrec :: Int -> CaptchaResponse -> ShowS
Prelude.Show, forall x. Rep CaptchaResponse x -> CaptchaResponse
forall x. CaptchaResponse -> Rep CaptchaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CaptchaResponse x -> CaptchaResponse
$cfrom :: forall x. CaptchaResponse -> Rep CaptchaResponse x
Prelude.Generic)
newCaptchaResponse ::
CaptchaResponse
newCaptchaResponse :: CaptchaResponse
newCaptchaResponse =
CaptchaResponse'
{ $sel:failureReason:CaptchaResponse' :: Maybe FailureReason
failureReason = forall a. Maybe a
Prelude.Nothing,
$sel:responseCode:CaptchaResponse' :: Maybe Int
responseCode = forall a. Maybe a
Prelude.Nothing,
$sel:solveTimestamp:CaptchaResponse' :: Maybe Integer
solveTimestamp = forall a. Maybe a
Prelude.Nothing
}
captchaResponse_failureReason :: Lens.Lens' CaptchaResponse (Prelude.Maybe FailureReason)
captchaResponse_failureReason :: Lens' CaptchaResponse (Maybe FailureReason)
captchaResponse_failureReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptchaResponse' {Maybe FailureReason
failureReason :: Maybe FailureReason
$sel:failureReason:CaptchaResponse' :: CaptchaResponse -> Maybe FailureReason
failureReason} -> Maybe FailureReason
failureReason) (\s :: CaptchaResponse
s@CaptchaResponse' {} Maybe FailureReason
a -> CaptchaResponse
s {$sel:failureReason:CaptchaResponse' :: Maybe FailureReason
failureReason = Maybe FailureReason
a} :: CaptchaResponse)
captchaResponse_responseCode :: Lens.Lens' CaptchaResponse (Prelude.Maybe Prelude.Int)
captchaResponse_responseCode :: Lens' CaptchaResponse (Maybe Int)
captchaResponse_responseCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptchaResponse' {Maybe Int
responseCode :: Maybe Int
$sel:responseCode:CaptchaResponse' :: CaptchaResponse -> Maybe Int
responseCode} -> Maybe Int
responseCode) (\s :: CaptchaResponse
s@CaptchaResponse' {} Maybe Int
a -> CaptchaResponse
s {$sel:responseCode:CaptchaResponse' :: Maybe Int
responseCode = Maybe Int
a} :: CaptchaResponse)
captchaResponse_solveTimestamp :: Lens.Lens' CaptchaResponse (Prelude.Maybe Prelude.Integer)
captchaResponse_solveTimestamp :: Lens' CaptchaResponse (Maybe Integer)
captchaResponse_solveTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptchaResponse' {Maybe Integer
solveTimestamp :: Maybe Integer
$sel:solveTimestamp:CaptchaResponse' :: CaptchaResponse -> Maybe Integer
solveTimestamp} -> Maybe Integer
solveTimestamp) (\s :: CaptchaResponse
s@CaptchaResponse' {} Maybe Integer
a -> CaptchaResponse
s {$sel:solveTimestamp:CaptchaResponse' :: Maybe Integer
solveTimestamp = Maybe Integer
a} :: CaptchaResponse)
instance Data.FromJSON CaptchaResponse where
parseJSON :: Value -> Parser CaptchaResponse
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CaptchaResponse"
( \Object
x ->
Maybe FailureReason
-> Maybe Int -> Maybe Integer -> CaptchaResponse
CaptchaResponse'
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
"FailureReason")
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
"ResponseCode")
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
"SolveTimestamp")
)
instance Prelude.Hashable CaptchaResponse where
hashWithSalt :: Int -> CaptchaResponse -> Int
hashWithSalt Int
_salt CaptchaResponse' {Maybe Int
Maybe Integer
Maybe FailureReason
solveTimestamp :: Maybe Integer
responseCode :: Maybe Int
failureReason :: Maybe FailureReason
$sel:solveTimestamp:CaptchaResponse' :: CaptchaResponse -> Maybe Integer
$sel:responseCode:CaptchaResponse' :: CaptchaResponse -> Maybe Int
$sel:failureReason:CaptchaResponse' :: CaptchaResponse -> Maybe FailureReason
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FailureReason
failureReason
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
responseCode
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
solveTimestamp
instance Prelude.NFData CaptchaResponse where
rnf :: CaptchaResponse -> ()
rnf CaptchaResponse' {Maybe Int
Maybe Integer
Maybe FailureReason
solveTimestamp :: Maybe Integer
responseCode :: Maybe Int
failureReason :: Maybe FailureReason
$sel:solveTimestamp:CaptchaResponse' :: CaptchaResponse -> Maybe Integer
$sel:responseCode:CaptchaResponse' :: CaptchaResponse -> Maybe Int
$sel:failureReason:CaptchaResponse' :: CaptchaResponse -> Maybe FailureReason
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe FailureReason
failureReason
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
responseCode
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
solveTimestamp