{-# 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.UpdateMethodResponse
(
UpdateMethodResponse (..),
newUpdateMethodResponse,
updateMethodResponse_patchOperations,
updateMethodResponse_restApiId,
updateMethodResponse_resourceId,
updateMethodResponse_httpMethod,
updateMethodResponse_statusCode,
MethodResponse (..),
newMethodResponse,
methodResponse_responseModels,
methodResponse_statusCode,
methodResponse_responseParameters,
)
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 UpdateMethodResponse = UpdateMethodResponse'
{
UpdateMethodResponse -> Maybe [PatchOperation]
patchOperations :: Prelude.Maybe [PatchOperation],
UpdateMethodResponse -> Text
restApiId :: Prelude.Text,
UpdateMethodResponse -> Text
resourceId :: Prelude.Text,
UpdateMethodResponse -> Text
httpMethod :: Prelude.Text,
UpdateMethodResponse -> Text
statusCode :: Prelude.Text
}
deriving (UpdateMethodResponse -> UpdateMethodResponse -> Bool
(UpdateMethodResponse -> UpdateMethodResponse -> Bool)
-> (UpdateMethodResponse -> UpdateMethodResponse -> Bool)
-> Eq UpdateMethodResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateMethodResponse -> UpdateMethodResponse -> Bool
$c/= :: UpdateMethodResponse -> UpdateMethodResponse -> Bool
== :: UpdateMethodResponse -> UpdateMethodResponse -> Bool
$c== :: UpdateMethodResponse -> UpdateMethodResponse -> Bool
Prelude.Eq, ReadPrec [UpdateMethodResponse]
ReadPrec UpdateMethodResponse
Int -> ReadS UpdateMethodResponse
ReadS [UpdateMethodResponse]
(Int -> ReadS UpdateMethodResponse)
-> ReadS [UpdateMethodResponse]
-> ReadPrec UpdateMethodResponse
-> ReadPrec [UpdateMethodResponse]
-> Read UpdateMethodResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateMethodResponse]
$creadListPrec :: ReadPrec [UpdateMethodResponse]
readPrec :: ReadPrec UpdateMethodResponse
$creadPrec :: ReadPrec UpdateMethodResponse
readList :: ReadS [UpdateMethodResponse]
$creadList :: ReadS [UpdateMethodResponse]
readsPrec :: Int -> ReadS UpdateMethodResponse
$creadsPrec :: Int -> ReadS UpdateMethodResponse
Prelude.Read, Int -> UpdateMethodResponse -> ShowS
[UpdateMethodResponse] -> ShowS
UpdateMethodResponse -> String
(Int -> UpdateMethodResponse -> ShowS)
-> (UpdateMethodResponse -> String)
-> ([UpdateMethodResponse] -> ShowS)
-> Show UpdateMethodResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateMethodResponse] -> ShowS
$cshowList :: [UpdateMethodResponse] -> ShowS
show :: UpdateMethodResponse -> String
$cshow :: UpdateMethodResponse -> String
showsPrec :: Int -> UpdateMethodResponse -> ShowS
$cshowsPrec :: Int -> UpdateMethodResponse -> ShowS
Prelude.Show, (forall x. UpdateMethodResponse -> Rep UpdateMethodResponse x)
-> (forall x. Rep UpdateMethodResponse x -> UpdateMethodResponse)
-> Generic UpdateMethodResponse
forall x. Rep UpdateMethodResponse x -> UpdateMethodResponse
forall x. UpdateMethodResponse -> Rep UpdateMethodResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateMethodResponse x -> UpdateMethodResponse
$cfrom :: forall x. UpdateMethodResponse -> Rep UpdateMethodResponse x
Prelude.Generic)
newUpdateMethodResponse ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
UpdateMethodResponse
newUpdateMethodResponse :: Text -> Text -> Text -> Text -> UpdateMethodResponse
newUpdateMethodResponse
Text
pRestApiId_
Text
pResourceId_
Text
pHttpMethod_
Text
pStatusCode_ =
UpdateMethodResponse' :: Maybe [PatchOperation]
-> Text -> Text -> Text -> Text -> UpdateMethodResponse
UpdateMethodResponse'
{ $sel:patchOperations:UpdateMethodResponse' :: Maybe [PatchOperation]
patchOperations =
Maybe [PatchOperation]
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:UpdateMethodResponse' :: Text
restApiId = Text
pRestApiId_,
$sel:resourceId:UpdateMethodResponse' :: Text
resourceId = Text
pResourceId_,
$sel:httpMethod:UpdateMethodResponse' :: Text
httpMethod = Text
pHttpMethod_,
$sel:statusCode:UpdateMethodResponse' :: Text
statusCode = Text
pStatusCode_
}
updateMethodResponse_patchOperations :: Lens.Lens' UpdateMethodResponse (Prelude.Maybe [PatchOperation])
updateMethodResponse_patchOperations :: (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateMethodResponse -> f UpdateMethodResponse
updateMethodResponse_patchOperations = (UpdateMethodResponse -> Maybe [PatchOperation])
-> (UpdateMethodResponse
-> Maybe [PatchOperation] -> UpdateMethodResponse)
-> Lens
UpdateMethodResponse
UpdateMethodResponse
(Maybe [PatchOperation])
(Maybe [PatchOperation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateMethodResponse' {Maybe [PatchOperation]
patchOperations :: Maybe [PatchOperation]
$sel:patchOperations:UpdateMethodResponse' :: UpdateMethodResponse -> Maybe [PatchOperation]
patchOperations} -> Maybe [PatchOperation]
patchOperations) (\s :: UpdateMethodResponse
s@UpdateMethodResponse' {} Maybe [PatchOperation]
a -> UpdateMethodResponse
s {$sel:patchOperations:UpdateMethodResponse' :: Maybe [PatchOperation]
patchOperations = Maybe [PatchOperation]
a} :: UpdateMethodResponse) ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateMethodResponse -> f UpdateMethodResponse)
-> ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateMethodResponse
-> f UpdateMethodResponse
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
updateMethodResponse_restApiId :: Lens.Lens' UpdateMethodResponse Prelude.Text
updateMethodResponse_restApiId :: (Text -> f Text) -> UpdateMethodResponse -> f UpdateMethodResponse
updateMethodResponse_restApiId = (UpdateMethodResponse -> Text)
-> (UpdateMethodResponse -> Text -> UpdateMethodResponse)
-> Lens UpdateMethodResponse UpdateMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateMethodResponse' {Text
restApiId :: Text
$sel:restApiId:UpdateMethodResponse' :: UpdateMethodResponse -> Text
restApiId} -> Text
restApiId) (\s :: UpdateMethodResponse
s@UpdateMethodResponse' {} Text
a -> UpdateMethodResponse
s {$sel:restApiId:UpdateMethodResponse' :: Text
restApiId = Text
a} :: UpdateMethodResponse)
updateMethodResponse_resourceId :: Lens.Lens' UpdateMethodResponse Prelude.Text
updateMethodResponse_resourceId :: (Text -> f Text) -> UpdateMethodResponse -> f UpdateMethodResponse
updateMethodResponse_resourceId = (UpdateMethodResponse -> Text)
-> (UpdateMethodResponse -> Text -> UpdateMethodResponse)
-> Lens UpdateMethodResponse UpdateMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateMethodResponse' {Text
resourceId :: Text
$sel:resourceId:UpdateMethodResponse' :: UpdateMethodResponse -> Text
resourceId} -> Text
resourceId) (\s :: UpdateMethodResponse
s@UpdateMethodResponse' {} Text
a -> UpdateMethodResponse
s {$sel:resourceId:UpdateMethodResponse' :: Text
resourceId = Text
a} :: UpdateMethodResponse)
updateMethodResponse_httpMethod :: Lens.Lens' UpdateMethodResponse Prelude.Text
updateMethodResponse_httpMethod :: (Text -> f Text) -> UpdateMethodResponse -> f UpdateMethodResponse
updateMethodResponse_httpMethod = (UpdateMethodResponse -> Text)
-> (UpdateMethodResponse -> Text -> UpdateMethodResponse)
-> Lens UpdateMethodResponse UpdateMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateMethodResponse' {Text
httpMethod :: Text
$sel:httpMethod:UpdateMethodResponse' :: UpdateMethodResponse -> Text
httpMethod} -> Text
httpMethod) (\s :: UpdateMethodResponse
s@UpdateMethodResponse' {} Text
a -> UpdateMethodResponse
s {$sel:httpMethod:UpdateMethodResponse' :: Text
httpMethod = Text
a} :: UpdateMethodResponse)
updateMethodResponse_statusCode :: Lens.Lens' UpdateMethodResponse Prelude.Text
updateMethodResponse_statusCode :: (Text -> f Text) -> UpdateMethodResponse -> f UpdateMethodResponse
updateMethodResponse_statusCode = (UpdateMethodResponse -> Text)
-> (UpdateMethodResponse -> Text -> UpdateMethodResponse)
-> Lens UpdateMethodResponse UpdateMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateMethodResponse' {Text
statusCode :: Text
$sel:statusCode:UpdateMethodResponse' :: UpdateMethodResponse -> Text
statusCode} -> Text
statusCode) (\s :: UpdateMethodResponse
s@UpdateMethodResponse' {} Text
a -> UpdateMethodResponse
s {$sel:statusCode:UpdateMethodResponse' :: Text
statusCode = Text
a} :: UpdateMethodResponse)
instance Core.AWSRequest UpdateMethodResponse where
type
AWSResponse UpdateMethodResponse =
MethodResponse
request :: UpdateMethodResponse -> Request UpdateMethodResponse
request = Service -> UpdateMethodResponse -> Request UpdateMethodResponse
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateMethodResponse
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateMethodResponse)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateMethodResponse))
-> Logger
-> Service
-> Proxy UpdateMethodResponse
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateMethodResponse)))
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 MethodResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateMethodResponse
instance Prelude.NFData UpdateMethodResponse
instance Core.ToHeaders UpdateMethodResponse where
toHeaders :: UpdateMethodResponse -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateMethodResponse -> 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 UpdateMethodResponse where
toJSON :: UpdateMethodResponse -> Value
toJSON UpdateMethodResponse' {Maybe [PatchOperation]
Text
statusCode :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:statusCode:UpdateMethodResponse' :: UpdateMethodResponse -> Text
$sel:httpMethod:UpdateMethodResponse' :: UpdateMethodResponse -> Text
$sel:resourceId:UpdateMethodResponse' :: UpdateMethodResponse -> Text
$sel:restApiId:UpdateMethodResponse' :: UpdateMethodResponse -> Text
$sel:patchOperations:UpdateMethodResponse' :: UpdateMethodResponse -> 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 UpdateMethodResponse where
toPath :: UpdateMethodResponse -> ByteString
toPath UpdateMethodResponse' {Maybe [PatchOperation]
Text
statusCode :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:statusCode:UpdateMethodResponse' :: UpdateMethodResponse -> Text
$sel:httpMethod:UpdateMethodResponse' :: UpdateMethodResponse -> Text
$sel:resourceId:UpdateMethodResponse' :: UpdateMethodResponse -> Text
$sel:restApiId:UpdateMethodResponse' :: UpdateMethodResponse -> Text
$sel:patchOperations:UpdateMethodResponse' :: UpdateMethodResponse -> 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
"/resources/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceId,
ByteString
"/methods/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
httpMethod,
ByteString
"/responses/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
statusCode
]
instance Core.ToQuery UpdateMethodResponse where
toQuery :: UpdateMethodResponse -> QueryString
toQuery = QueryString -> UpdateMethodResponse -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty