{-# 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.APIGateway.Types.RequestValidator where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RequestValidator = RequestValidator'
{
RequestValidator -> Maybe Bool
validateRequestParameters :: Prelude.Maybe Prelude.Bool,
RequestValidator -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
RequestValidator -> Maybe Bool
validateRequestBody :: Prelude.Maybe Prelude.Bool,
RequestValidator -> Maybe Text
id :: Prelude.Maybe Prelude.Text
}
deriving (RequestValidator -> RequestValidator -> Bool
(RequestValidator -> RequestValidator -> Bool)
-> (RequestValidator -> RequestValidator -> Bool)
-> Eq RequestValidator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequestValidator -> RequestValidator -> Bool
$c/= :: RequestValidator -> RequestValidator -> Bool
== :: RequestValidator -> RequestValidator -> Bool
$c== :: RequestValidator -> RequestValidator -> Bool
Prelude.Eq, ReadPrec [RequestValidator]
ReadPrec RequestValidator
Int -> ReadS RequestValidator
ReadS [RequestValidator]
(Int -> ReadS RequestValidator)
-> ReadS [RequestValidator]
-> ReadPrec RequestValidator
-> ReadPrec [RequestValidator]
-> Read RequestValidator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RequestValidator]
$creadListPrec :: ReadPrec [RequestValidator]
readPrec :: ReadPrec RequestValidator
$creadPrec :: ReadPrec RequestValidator
readList :: ReadS [RequestValidator]
$creadList :: ReadS [RequestValidator]
readsPrec :: Int -> ReadS RequestValidator
$creadsPrec :: Int -> ReadS RequestValidator
Prelude.Read, Int -> RequestValidator -> ShowS
[RequestValidator] -> ShowS
RequestValidator -> String
(Int -> RequestValidator -> ShowS)
-> (RequestValidator -> String)
-> ([RequestValidator] -> ShowS)
-> Show RequestValidator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequestValidator] -> ShowS
$cshowList :: [RequestValidator] -> ShowS
show :: RequestValidator -> String
$cshow :: RequestValidator -> String
showsPrec :: Int -> RequestValidator -> ShowS
$cshowsPrec :: Int -> RequestValidator -> ShowS
Prelude.Show, (forall x. RequestValidator -> Rep RequestValidator x)
-> (forall x. Rep RequestValidator x -> RequestValidator)
-> Generic RequestValidator
forall x. Rep RequestValidator x -> RequestValidator
forall x. RequestValidator -> Rep RequestValidator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RequestValidator x -> RequestValidator
$cfrom :: forall x. RequestValidator -> Rep RequestValidator x
Prelude.Generic)
newRequestValidator ::
RequestValidator
newRequestValidator :: RequestValidator
newRequestValidator =
RequestValidator' :: Maybe Bool
-> Maybe Text -> Maybe Bool -> Maybe Text -> RequestValidator
RequestValidator'
{ $sel:validateRequestParameters:RequestValidator' :: Maybe Bool
validateRequestParameters =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:name:RequestValidator' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:validateRequestBody:RequestValidator' :: Maybe Bool
validateRequestBody = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:id:RequestValidator' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
requestValidator_validateRequestParameters :: Lens.Lens' RequestValidator (Prelude.Maybe Prelude.Bool)
requestValidator_validateRequestParameters :: (Maybe Bool -> f (Maybe Bool))
-> RequestValidator -> f RequestValidator
requestValidator_validateRequestParameters = (RequestValidator -> Maybe Bool)
-> (RequestValidator -> Maybe Bool -> RequestValidator)
-> Lens RequestValidator RequestValidator (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestValidator' {Maybe Bool
validateRequestParameters :: Maybe Bool
$sel:validateRequestParameters:RequestValidator' :: RequestValidator -> Maybe Bool
validateRequestParameters} -> Maybe Bool
validateRequestParameters) (\s :: RequestValidator
s@RequestValidator' {} Maybe Bool
a -> RequestValidator
s {$sel:validateRequestParameters:RequestValidator' :: Maybe Bool
validateRequestParameters = Maybe Bool
a} :: RequestValidator)
requestValidator_name :: Lens.Lens' RequestValidator (Prelude.Maybe Prelude.Text)
requestValidator_name :: (Maybe Text -> f (Maybe Text))
-> RequestValidator -> f RequestValidator
requestValidator_name = (RequestValidator -> Maybe Text)
-> (RequestValidator -> Maybe Text -> RequestValidator)
-> Lens RequestValidator RequestValidator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestValidator' {Maybe Text
name :: Maybe Text
$sel:name:RequestValidator' :: RequestValidator -> Maybe Text
name} -> Maybe Text
name) (\s :: RequestValidator
s@RequestValidator' {} Maybe Text
a -> RequestValidator
s {$sel:name:RequestValidator' :: Maybe Text
name = Maybe Text
a} :: RequestValidator)
requestValidator_validateRequestBody :: Lens.Lens' RequestValidator (Prelude.Maybe Prelude.Bool)
requestValidator_validateRequestBody :: (Maybe Bool -> f (Maybe Bool))
-> RequestValidator -> f RequestValidator
requestValidator_validateRequestBody = (RequestValidator -> Maybe Bool)
-> (RequestValidator -> Maybe Bool -> RequestValidator)
-> Lens RequestValidator RequestValidator (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestValidator' {Maybe Bool
validateRequestBody :: Maybe Bool
$sel:validateRequestBody:RequestValidator' :: RequestValidator -> Maybe Bool
validateRequestBody} -> Maybe Bool
validateRequestBody) (\s :: RequestValidator
s@RequestValidator' {} Maybe Bool
a -> RequestValidator
s {$sel:validateRequestBody:RequestValidator' :: Maybe Bool
validateRequestBody = Maybe Bool
a} :: RequestValidator)
requestValidator_id :: Lens.Lens' RequestValidator (Prelude.Maybe Prelude.Text)
requestValidator_id :: (Maybe Text -> f (Maybe Text))
-> RequestValidator -> f RequestValidator
requestValidator_id = (RequestValidator -> Maybe Text)
-> (RequestValidator -> Maybe Text -> RequestValidator)
-> Lens RequestValidator RequestValidator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestValidator' {Maybe Text
id :: Maybe Text
$sel:id:RequestValidator' :: RequestValidator -> Maybe Text
id} -> Maybe Text
id) (\s :: RequestValidator
s@RequestValidator' {} Maybe Text
a -> RequestValidator
s {$sel:id:RequestValidator' :: Maybe Text
id = Maybe Text
a} :: RequestValidator)
instance Core.FromJSON RequestValidator where
parseJSON :: Value -> Parser RequestValidator
parseJSON =
String
-> (Object -> Parser RequestValidator)
-> Value
-> Parser RequestValidator
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RequestValidator"
( \Object
x ->
Maybe Bool
-> Maybe Text -> Maybe Bool -> Maybe Text -> RequestValidator
RequestValidator'
(Maybe Bool
-> Maybe Text -> Maybe Bool -> Maybe Text -> RequestValidator)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text -> Maybe Bool -> Maybe Text -> RequestValidator)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"validateRequestParameters")
Parser (Maybe Text -> Maybe Bool -> Maybe Text -> RequestValidator)
-> Parser (Maybe Text)
-> Parser (Maybe Bool -> Maybe Text -> RequestValidator)
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
"name")
Parser (Maybe Bool -> Maybe Text -> RequestValidator)
-> Parser (Maybe Bool) -> Parser (Maybe Text -> RequestValidator)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"validateRequestBody")
Parser (Maybe Text -> RequestValidator)
-> Parser (Maybe Text) -> Parser RequestValidator
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
"id")
)
instance Prelude.Hashable RequestValidator
instance Prelude.NFData RequestValidator