{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.APIGateway.UpdateRequestValidator
(
UpdateRequestValidator (..),
newUpdateRequestValidator,
updateRequestValidator_patchOperations,
updateRequestValidator_restApiId,
updateRequestValidator_requestValidatorId,
RequestValidator (..),
newRequestValidator,
requestValidator_validateRequestParameters,
requestValidator_name,
requestValidator_validateRequestBody,
requestValidator_id,
)
where
import Amazonka.APIGateway.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateRequestValidator = UpdateRequestValidator'
{
UpdateRequestValidator -> Maybe [PatchOperation]
patchOperations :: Prelude.Maybe [PatchOperation],
UpdateRequestValidator -> Text
restApiId :: Prelude.Text,
UpdateRequestValidator -> Text
requestValidatorId :: Prelude.Text
}
deriving (UpdateRequestValidator -> UpdateRequestValidator -> Bool
(UpdateRequestValidator -> UpdateRequestValidator -> Bool)
-> (UpdateRequestValidator -> UpdateRequestValidator -> Bool)
-> Eq UpdateRequestValidator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRequestValidator -> UpdateRequestValidator -> Bool
$c/= :: UpdateRequestValidator -> UpdateRequestValidator -> Bool
== :: UpdateRequestValidator -> UpdateRequestValidator -> Bool
$c== :: UpdateRequestValidator -> UpdateRequestValidator -> Bool
Prelude.Eq, ReadPrec [UpdateRequestValidator]
ReadPrec UpdateRequestValidator
Int -> ReadS UpdateRequestValidator
ReadS [UpdateRequestValidator]
(Int -> ReadS UpdateRequestValidator)
-> ReadS [UpdateRequestValidator]
-> ReadPrec UpdateRequestValidator
-> ReadPrec [UpdateRequestValidator]
-> Read UpdateRequestValidator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRequestValidator]
$creadListPrec :: ReadPrec [UpdateRequestValidator]
readPrec :: ReadPrec UpdateRequestValidator
$creadPrec :: ReadPrec UpdateRequestValidator
readList :: ReadS [UpdateRequestValidator]
$creadList :: ReadS [UpdateRequestValidator]
readsPrec :: Int -> ReadS UpdateRequestValidator
$creadsPrec :: Int -> ReadS UpdateRequestValidator
Prelude.Read, Int -> UpdateRequestValidator -> ShowS
[UpdateRequestValidator] -> ShowS
UpdateRequestValidator -> String
(Int -> UpdateRequestValidator -> ShowS)
-> (UpdateRequestValidator -> String)
-> ([UpdateRequestValidator] -> ShowS)
-> Show UpdateRequestValidator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRequestValidator] -> ShowS
$cshowList :: [UpdateRequestValidator] -> ShowS
show :: UpdateRequestValidator -> String
$cshow :: UpdateRequestValidator -> String
showsPrec :: Int -> UpdateRequestValidator -> ShowS
$cshowsPrec :: Int -> UpdateRequestValidator -> ShowS
Prelude.Show, (forall x. UpdateRequestValidator -> Rep UpdateRequestValidator x)
-> (forall x.
Rep UpdateRequestValidator x -> UpdateRequestValidator)
-> Generic UpdateRequestValidator
forall x. Rep UpdateRequestValidator x -> UpdateRequestValidator
forall x. UpdateRequestValidator -> Rep UpdateRequestValidator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRequestValidator x -> UpdateRequestValidator
$cfrom :: forall x. UpdateRequestValidator -> Rep UpdateRequestValidator x
Prelude.Generic)
newUpdateRequestValidator ::
Prelude.Text ->
Prelude.Text ->
UpdateRequestValidator
newUpdateRequestValidator :: Text -> Text -> UpdateRequestValidator
newUpdateRequestValidator
Text
pRestApiId_
Text
pRequestValidatorId_ =
UpdateRequestValidator' :: Maybe [PatchOperation] -> Text -> Text -> UpdateRequestValidator
UpdateRequestValidator'
{ $sel:patchOperations:UpdateRequestValidator' :: Maybe [PatchOperation]
patchOperations =
Maybe [PatchOperation]
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:UpdateRequestValidator' :: Text
restApiId = Text
pRestApiId_,
$sel:requestValidatorId:UpdateRequestValidator' :: Text
requestValidatorId = Text
pRequestValidatorId_
}
updateRequestValidator_patchOperations :: Lens.Lens' UpdateRequestValidator (Prelude.Maybe [PatchOperation])
updateRequestValidator_patchOperations :: (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateRequestValidator -> f UpdateRequestValidator
updateRequestValidator_patchOperations = (UpdateRequestValidator -> Maybe [PatchOperation])
-> (UpdateRequestValidator
-> Maybe [PatchOperation] -> UpdateRequestValidator)
-> Lens
UpdateRequestValidator
UpdateRequestValidator
(Maybe [PatchOperation])
(Maybe [PatchOperation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRequestValidator' {Maybe [PatchOperation]
patchOperations :: Maybe [PatchOperation]
$sel:patchOperations:UpdateRequestValidator' :: UpdateRequestValidator -> Maybe [PatchOperation]
patchOperations} -> Maybe [PatchOperation]
patchOperations) (\s :: UpdateRequestValidator
s@UpdateRequestValidator' {} Maybe [PatchOperation]
a -> UpdateRequestValidator
s {$sel:patchOperations:UpdateRequestValidator' :: Maybe [PatchOperation]
patchOperations = Maybe [PatchOperation]
a} :: UpdateRequestValidator) ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateRequestValidator -> f UpdateRequestValidator)
-> ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateRequestValidator
-> f UpdateRequestValidator
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PatchOperation] [PatchOperation] [PatchOperation] [PatchOperation]
-> Iso
(Maybe [PatchOperation])
(Maybe [PatchOperation])
(Maybe [PatchOperation])
(Maybe [PatchOperation])
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
[PatchOperation] [PatchOperation] [PatchOperation] [PatchOperation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateRequestValidator_restApiId :: Lens.Lens' UpdateRequestValidator Prelude.Text
updateRequestValidator_restApiId :: (Text -> f Text)
-> UpdateRequestValidator -> f UpdateRequestValidator
updateRequestValidator_restApiId = (UpdateRequestValidator -> Text)
-> (UpdateRequestValidator -> Text -> UpdateRequestValidator)
-> Lens UpdateRequestValidator UpdateRequestValidator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRequestValidator' {Text
restApiId :: Text
$sel:restApiId:UpdateRequestValidator' :: UpdateRequestValidator -> Text
restApiId} -> Text
restApiId) (\s :: UpdateRequestValidator
s@UpdateRequestValidator' {} Text
a -> UpdateRequestValidator
s {$sel:restApiId:UpdateRequestValidator' :: Text
restApiId = Text
a} :: UpdateRequestValidator)
updateRequestValidator_requestValidatorId :: Lens.Lens' UpdateRequestValidator Prelude.Text
updateRequestValidator_requestValidatorId :: (Text -> f Text)
-> UpdateRequestValidator -> f UpdateRequestValidator
updateRequestValidator_requestValidatorId = (UpdateRequestValidator -> Text)
-> (UpdateRequestValidator -> Text -> UpdateRequestValidator)
-> Lens UpdateRequestValidator UpdateRequestValidator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRequestValidator' {Text
requestValidatorId :: Text
$sel:requestValidatorId:UpdateRequestValidator' :: UpdateRequestValidator -> Text
requestValidatorId} -> Text
requestValidatorId) (\s :: UpdateRequestValidator
s@UpdateRequestValidator' {} Text
a -> UpdateRequestValidator
s {$sel:requestValidatorId:UpdateRequestValidator' :: Text
requestValidatorId = Text
a} :: UpdateRequestValidator)
instance Core.AWSRequest UpdateRequestValidator where
type
AWSResponse UpdateRequestValidator =
RequestValidator
request :: UpdateRequestValidator -> Request UpdateRequestValidator
request = Service -> UpdateRequestValidator -> Request UpdateRequestValidator
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateRequestValidator
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateRequestValidator)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateRequestValidator))
-> Logger
-> Service
-> Proxy UpdateRequestValidator
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateRequestValidator)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> Object -> Either String RequestValidator
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateRequestValidator
instance Prelude.NFData UpdateRequestValidator
instance Core.ToHeaders UpdateRequestValidator where
toHeaders :: UpdateRequestValidator -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateRequestValidator -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Core.ToJSON UpdateRequestValidator where
toJSON :: UpdateRequestValidator -> Value
toJSON UpdateRequestValidator' {Maybe [PatchOperation]
Text
requestValidatorId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:requestValidatorId:UpdateRequestValidator' :: UpdateRequestValidator -> Text
$sel:restApiId:UpdateRequestValidator' :: UpdateRequestValidator -> Text
$sel:patchOperations:UpdateRequestValidator' :: UpdateRequestValidator -> Maybe [PatchOperation]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"patchOperations" Text -> [PatchOperation] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([PatchOperation] -> Pair) -> Maybe [PatchOperation] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PatchOperation]
patchOperations
]
)
instance Core.ToPath UpdateRequestValidator where
toPath :: UpdateRequestValidator -> ByteString
toPath UpdateRequestValidator' {Maybe [PatchOperation]
Text
requestValidatorId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:requestValidatorId:UpdateRequestValidator' :: UpdateRequestValidator -> Text
$sel:restApiId:UpdateRequestValidator' :: UpdateRequestValidator -> Text
$sel:patchOperations:UpdateRequestValidator' :: UpdateRequestValidator -> Maybe [PatchOperation]
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/restapis/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId,
ByteString
"/requestvalidators/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
requestValidatorId
]
instance Core.ToQuery UpdateRequestValidator where
toQuery :: UpdateRequestValidator -> QueryString
toQuery = QueryString -> UpdateRequestValidator -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty