{-# 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.PutMethodResponse
(
PutMethodResponse (..),
newPutMethodResponse,
putMethodResponse_responseModels,
putMethodResponse_responseParameters,
putMethodResponse_restApiId,
putMethodResponse_resourceId,
putMethodResponse_httpMethod,
putMethodResponse_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 PutMethodResponse = PutMethodResponse'
{
PutMethodResponse -> Maybe (HashMap Text Text)
responseModels :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
PutMethodResponse -> Maybe (HashMap Text Bool)
responseParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Bool),
PutMethodResponse -> Text
restApiId :: Prelude.Text,
PutMethodResponse -> Text
resourceId :: Prelude.Text,
PutMethodResponse -> Text
httpMethod :: Prelude.Text,
PutMethodResponse -> Text
statusCode :: Prelude.Text
}
deriving (PutMethodResponse -> PutMethodResponse -> Bool
(PutMethodResponse -> PutMethodResponse -> Bool)
-> (PutMethodResponse -> PutMethodResponse -> Bool)
-> Eq PutMethodResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutMethodResponse -> PutMethodResponse -> Bool
$c/= :: PutMethodResponse -> PutMethodResponse -> Bool
== :: PutMethodResponse -> PutMethodResponse -> Bool
$c== :: PutMethodResponse -> PutMethodResponse -> Bool
Prelude.Eq, ReadPrec [PutMethodResponse]
ReadPrec PutMethodResponse
Int -> ReadS PutMethodResponse
ReadS [PutMethodResponse]
(Int -> ReadS PutMethodResponse)
-> ReadS [PutMethodResponse]
-> ReadPrec PutMethodResponse
-> ReadPrec [PutMethodResponse]
-> Read PutMethodResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutMethodResponse]
$creadListPrec :: ReadPrec [PutMethodResponse]
readPrec :: ReadPrec PutMethodResponse
$creadPrec :: ReadPrec PutMethodResponse
readList :: ReadS [PutMethodResponse]
$creadList :: ReadS [PutMethodResponse]
readsPrec :: Int -> ReadS PutMethodResponse
$creadsPrec :: Int -> ReadS PutMethodResponse
Prelude.Read, Int -> PutMethodResponse -> ShowS
[PutMethodResponse] -> ShowS
PutMethodResponse -> String
(Int -> PutMethodResponse -> ShowS)
-> (PutMethodResponse -> String)
-> ([PutMethodResponse] -> ShowS)
-> Show PutMethodResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutMethodResponse] -> ShowS
$cshowList :: [PutMethodResponse] -> ShowS
show :: PutMethodResponse -> String
$cshow :: PutMethodResponse -> String
showsPrec :: Int -> PutMethodResponse -> ShowS
$cshowsPrec :: Int -> PutMethodResponse -> ShowS
Prelude.Show, (forall x. PutMethodResponse -> Rep PutMethodResponse x)
-> (forall x. Rep PutMethodResponse x -> PutMethodResponse)
-> Generic PutMethodResponse
forall x. Rep PutMethodResponse x -> PutMethodResponse
forall x. PutMethodResponse -> Rep PutMethodResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutMethodResponse x -> PutMethodResponse
$cfrom :: forall x. PutMethodResponse -> Rep PutMethodResponse x
Prelude.Generic)
newPutMethodResponse ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
PutMethodResponse
newPutMethodResponse :: Text -> Text -> Text -> Text -> PutMethodResponse
newPutMethodResponse
Text
pRestApiId_
Text
pResourceId_
Text
pHttpMethod_
Text
pStatusCode_ =
PutMethodResponse' :: Maybe (HashMap Text Text)
-> Maybe (HashMap Text Bool)
-> Text
-> Text
-> Text
-> Text
-> PutMethodResponse
PutMethodResponse'
{ $sel:responseModels:PutMethodResponse' :: Maybe (HashMap Text Text)
responseModels =
Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:responseParameters:PutMethodResponse' :: Maybe (HashMap Text Bool)
responseParameters = Maybe (HashMap Text Bool)
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:PutMethodResponse' :: Text
restApiId = Text
pRestApiId_,
$sel:resourceId:PutMethodResponse' :: Text
resourceId = Text
pResourceId_,
$sel:httpMethod:PutMethodResponse' :: Text
httpMethod = Text
pHttpMethod_,
$sel:statusCode:PutMethodResponse' :: Text
statusCode = Text
pStatusCode_
}
putMethodResponse_responseModels :: Lens.Lens' PutMethodResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
putMethodResponse_responseModels :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PutMethodResponse -> f PutMethodResponse
putMethodResponse_responseModels = (PutMethodResponse -> Maybe (HashMap Text Text))
-> (PutMethodResponse
-> Maybe (HashMap Text Text) -> PutMethodResponse)
-> Lens
PutMethodResponse
PutMethodResponse
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethodResponse' {Maybe (HashMap Text Text)
responseModels :: Maybe (HashMap Text Text)
$sel:responseModels:PutMethodResponse' :: PutMethodResponse -> Maybe (HashMap Text Text)
responseModels} -> Maybe (HashMap Text Text)
responseModels) (\s :: PutMethodResponse
s@PutMethodResponse' {} Maybe (HashMap Text Text)
a -> PutMethodResponse
s {$sel:responseModels:PutMethodResponse' :: Maybe (HashMap Text Text)
responseModels = Maybe (HashMap Text Text)
a} :: PutMethodResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PutMethodResponse -> f PutMethodResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PutMethodResponse
-> f PutMethodResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putMethodResponse_responseParameters :: Lens.Lens' PutMethodResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Bool))
putMethodResponse_responseParameters :: (Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
-> PutMethodResponse -> f PutMethodResponse
putMethodResponse_responseParameters = (PutMethodResponse -> Maybe (HashMap Text Bool))
-> (PutMethodResponse
-> Maybe (HashMap Text Bool) -> PutMethodResponse)
-> Lens
PutMethodResponse
PutMethodResponse
(Maybe (HashMap Text Bool))
(Maybe (HashMap Text Bool))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethodResponse' {Maybe (HashMap Text Bool)
responseParameters :: Maybe (HashMap Text Bool)
$sel:responseParameters:PutMethodResponse' :: PutMethodResponse -> Maybe (HashMap Text Bool)
responseParameters} -> Maybe (HashMap Text Bool)
responseParameters) (\s :: PutMethodResponse
s@PutMethodResponse' {} Maybe (HashMap Text Bool)
a -> PutMethodResponse
s {$sel:responseParameters:PutMethodResponse' :: Maybe (HashMap Text Bool)
responseParameters = Maybe (HashMap Text Bool)
a} :: PutMethodResponse) ((Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
-> PutMethodResponse -> f PutMethodResponse)
-> ((Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
-> Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
-> (Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
-> PutMethodResponse
-> f PutMethodResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Bool)
(HashMap Text Bool)
(HashMap Text Bool)
(HashMap Text Bool)
-> Iso
(Maybe (HashMap Text Bool))
(Maybe (HashMap Text Bool))
(Maybe (HashMap Text Bool))
(Maybe (HashMap Text Bool))
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
(HashMap Text Bool)
(HashMap Text Bool)
(HashMap Text Bool)
(HashMap Text Bool)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putMethodResponse_restApiId :: Lens.Lens' PutMethodResponse Prelude.Text
putMethodResponse_restApiId :: (Text -> f Text) -> PutMethodResponse -> f PutMethodResponse
putMethodResponse_restApiId = (PutMethodResponse -> Text)
-> (PutMethodResponse -> Text -> PutMethodResponse)
-> Lens PutMethodResponse PutMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethodResponse' {Text
restApiId :: Text
$sel:restApiId:PutMethodResponse' :: PutMethodResponse -> Text
restApiId} -> Text
restApiId) (\s :: PutMethodResponse
s@PutMethodResponse' {} Text
a -> PutMethodResponse
s {$sel:restApiId:PutMethodResponse' :: Text
restApiId = Text
a} :: PutMethodResponse)
putMethodResponse_resourceId :: Lens.Lens' PutMethodResponse Prelude.Text
putMethodResponse_resourceId :: (Text -> f Text) -> PutMethodResponse -> f PutMethodResponse
putMethodResponse_resourceId = (PutMethodResponse -> Text)
-> (PutMethodResponse -> Text -> PutMethodResponse)
-> Lens PutMethodResponse PutMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethodResponse' {Text
resourceId :: Text
$sel:resourceId:PutMethodResponse' :: PutMethodResponse -> Text
resourceId} -> Text
resourceId) (\s :: PutMethodResponse
s@PutMethodResponse' {} Text
a -> PutMethodResponse
s {$sel:resourceId:PutMethodResponse' :: Text
resourceId = Text
a} :: PutMethodResponse)
putMethodResponse_httpMethod :: Lens.Lens' PutMethodResponse Prelude.Text
putMethodResponse_httpMethod :: (Text -> f Text) -> PutMethodResponse -> f PutMethodResponse
putMethodResponse_httpMethod = (PutMethodResponse -> Text)
-> (PutMethodResponse -> Text -> PutMethodResponse)
-> Lens PutMethodResponse PutMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethodResponse' {Text
httpMethod :: Text
$sel:httpMethod:PutMethodResponse' :: PutMethodResponse -> Text
httpMethod} -> Text
httpMethod) (\s :: PutMethodResponse
s@PutMethodResponse' {} Text
a -> PutMethodResponse
s {$sel:httpMethod:PutMethodResponse' :: Text
httpMethod = Text
a} :: PutMethodResponse)
putMethodResponse_statusCode :: Lens.Lens' PutMethodResponse Prelude.Text
putMethodResponse_statusCode :: (Text -> f Text) -> PutMethodResponse -> f PutMethodResponse
putMethodResponse_statusCode = (PutMethodResponse -> Text)
-> (PutMethodResponse -> Text -> PutMethodResponse)
-> Lens PutMethodResponse PutMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethodResponse' {Text
statusCode :: Text
$sel:statusCode:PutMethodResponse' :: PutMethodResponse -> Text
statusCode} -> Text
statusCode) (\s :: PutMethodResponse
s@PutMethodResponse' {} Text
a -> PutMethodResponse
s {$sel:statusCode:PutMethodResponse' :: Text
statusCode = Text
a} :: PutMethodResponse)
instance Core.AWSRequest PutMethodResponse where
type AWSResponse PutMethodResponse = MethodResponse
request :: PutMethodResponse -> Request PutMethodResponse
request = Service -> PutMethodResponse -> Request PutMethodResponse
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutMethodResponse
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutMethodResponse)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutMethodResponse))
-> Logger
-> Service
-> Proxy PutMethodResponse
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutMethodResponse)))
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 PutMethodResponse
instance Prelude.NFData PutMethodResponse
instance Core.ToHeaders PutMethodResponse where
toHeaders :: PutMethodResponse -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutMethodResponse -> 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 PutMethodResponse where
toJSON :: PutMethodResponse -> Value
toJSON PutMethodResponse' {Maybe (HashMap Text Bool)
Maybe (HashMap Text Text)
Text
statusCode :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
responseParameters :: Maybe (HashMap Text Bool)
responseModels :: Maybe (HashMap Text Text)
$sel:statusCode:PutMethodResponse' :: PutMethodResponse -> Text
$sel:httpMethod:PutMethodResponse' :: PutMethodResponse -> Text
$sel:resourceId:PutMethodResponse' :: PutMethodResponse -> Text
$sel:restApiId:PutMethodResponse' :: PutMethodResponse -> Text
$sel:responseParameters:PutMethodResponse' :: PutMethodResponse -> Maybe (HashMap Text Bool)
$sel:responseModels:PutMethodResponse' :: PutMethodResponse -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"responseModels" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
responseModels,
(Text
"responseParameters" Text -> HashMap Text Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Bool -> Pair)
-> Maybe (HashMap Text Bool) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Bool)
responseParameters
]
)
instance Core.ToPath PutMethodResponse where
toPath :: PutMethodResponse -> ByteString
toPath PutMethodResponse' {Maybe (HashMap Text Bool)
Maybe (HashMap Text Text)
Text
statusCode :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
responseParameters :: Maybe (HashMap Text Bool)
responseModels :: Maybe (HashMap Text Text)
$sel:statusCode:PutMethodResponse' :: PutMethodResponse -> Text
$sel:httpMethod:PutMethodResponse' :: PutMethodResponse -> Text
$sel:resourceId:PutMethodResponse' :: PutMethodResponse -> Text
$sel:restApiId:PutMethodResponse' :: PutMethodResponse -> Text
$sel:responseParameters:PutMethodResponse' :: PutMethodResponse -> Maybe (HashMap Text Bool)
$sel:responseModels:PutMethodResponse' :: PutMethodResponse -> Maybe (HashMap Text Text)
..} =
[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 PutMethodResponse where
toQuery :: PutMethodResponse -> QueryString
toQuery = QueryString -> PutMethodResponse -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty