{-# 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.MethodResponse where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data MethodResponse = MethodResponse'
{
MethodResponse -> Maybe (HashMap Text Text)
responseModels :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
MethodResponse -> Maybe Text
statusCode :: Prelude.Maybe Prelude.Text,
MethodResponse -> Maybe (HashMap Text Bool)
responseParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Bool)
}
deriving (MethodResponse -> MethodResponse -> Bool
(MethodResponse -> MethodResponse -> Bool)
-> (MethodResponse -> MethodResponse -> Bool) -> Eq MethodResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MethodResponse -> MethodResponse -> Bool
$c/= :: MethodResponse -> MethodResponse -> Bool
== :: MethodResponse -> MethodResponse -> Bool
$c== :: MethodResponse -> MethodResponse -> Bool
Prelude.Eq, ReadPrec [MethodResponse]
ReadPrec MethodResponse
Int -> ReadS MethodResponse
ReadS [MethodResponse]
(Int -> ReadS MethodResponse)
-> ReadS [MethodResponse]
-> ReadPrec MethodResponse
-> ReadPrec [MethodResponse]
-> Read MethodResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MethodResponse]
$creadListPrec :: ReadPrec [MethodResponse]
readPrec :: ReadPrec MethodResponse
$creadPrec :: ReadPrec MethodResponse
readList :: ReadS [MethodResponse]
$creadList :: ReadS [MethodResponse]
readsPrec :: Int -> ReadS MethodResponse
$creadsPrec :: Int -> ReadS MethodResponse
Prelude.Read, Int -> MethodResponse -> ShowS
[MethodResponse] -> ShowS
MethodResponse -> String
(Int -> MethodResponse -> ShowS)
-> (MethodResponse -> String)
-> ([MethodResponse] -> ShowS)
-> Show MethodResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MethodResponse] -> ShowS
$cshowList :: [MethodResponse] -> ShowS
show :: MethodResponse -> String
$cshow :: MethodResponse -> String
showsPrec :: Int -> MethodResponse -> ShowS
$cshowsPrec :: Int -> MethodResponse -> ShowS
Prelude.Show, (forall x. MethodResponse -> Rep MethodResponse x)
-> (forall x. Rep MethodResponse x -> MethodResponse)
-> Generic MethodResponse
forall x. Rep MethodResponse x -> MethodResponse
forall x. MethodResponse -> Rep MethodResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MethodResponse x -> MethodResponse
$cfrom :: forall x. MethodResponse -> Rep MethodResponse x
Prelude.Generic)
newMethodResponse ::
MethodResponse
newMethodResponse :: MethodResponse
newMethodResponse =
MethodResponse' :: Maybe (HashMap Text Text)
-> Maybe Text -> Maybe (HashMap Text Bool) -> MethodResponse
MethodResponse'
{ $sel:responseModels:MethodResponse' :: Maybe (HashMap Text Text)
responseModels = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:statusCode:MethodResponse' :: Maybe Text
statusCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:responseParameters:MethodResponse' :: Maybe (HashMap Text Bool)
responseParameters = Maybe (HashMap Text Bool)
forall a. Maybe a
Prelude.Nothing
}
methodResponse_responseModels :: Lens.Lens' MethodResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
methodResponse_responseModels :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> MethodResponse -> f MethodResponse
methodResponse_responseModels = (MethodResponse -> Maybe (HashMap Text Text))
-> (MethodResponse -> Maybe (HashMap Text Text) -> MethodResponse)
-> Lens
MethodResponse
MethodResponse
(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 (\MethodResponse' {Maybe (HashMap Text Text)
responseModels :: Maybe (HashMap Text Text)
$sel:responseModels:MethodResponse' :: MethodResponse -> Maybe (HashMap Text Text)
responseModels} -> Maybe (HashMap Text Text)
responseModels) (\s :: MethodResponse
s@MethodResponse' {} Maybe (HashMap Text Text)
a -> MethodResponse
s {$sel:responseModels:MethodResponse' :: Maybe (HashMap Text Text)
responseModels = Maybe (HashMap Text Text)
a} :: MethodResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> MethodResponse -> f MethodResponse)
-> ((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)))
-> MethodResponse
-> f MethodResponse
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
methodResponse_statusCode :: Lens.Lens' MethodResponse (Prelude.Maybe Prelude.Text)
methodResponse_statusCode :: (Maybe Text -> f (Maybe Text))
-> MethodResponse -> f MethodResponse
methodResponse_statusCode = (MethodResponse -> Maybe Text)
-> (MethodResponse -> Maybe Text -> MethodResponse)
-> Lens MethodResponse MethodResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodResponse' {Maybe Text
statusCode :: Maybe Text
$sel:statusCode:MethodResponse' :: MethodResponse -> Maybe Text
statusCode} -> Maybe Text
statusCode) (\s :: MethodResponse
s@MethodResponse' {} Maybe Text
a -> MethodResponse
s {$sel:statusCode:MethodResponse' :: Maybe Text
statusCode = Maybe Text
a} :: MethodResponse)
methodResponse_responseParameters :: Lens.Lens' MethodResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Bool))
methodResponse_responseParameters :: (Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
-> MethodResponse -> f MethodResponse
methodResponse_responseParameters = (MethodResponse -> Maybe (HashMap Text Bool))
-> (MethodResponse -> Maybe (HashMap Text Bool) -> MethodResponse)
-> Lens
MethodResponse
MethodResponse
(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 (\MethodResponse' {Maybe (HashMap Text Bool)
responseParameters :: Maybe (HashMap Text Bool)
$sel:responseParameters:MethodResponse' :: MethodResponse -> Maybe (HashMap Text Bool)
responseParameters} -> Maybe (HashMap Text Bool)
responseParameters) (\s :: MethodResponse
s@MethodResponse' {} Maybe (HashMap Text Bool)
a -> MethodResponse
s {$sel:responseParameters:MethodResponse' :: Maybe (HashMap Text Bool)
responseParameters = Maybe (HashMap Text Bool)
a} :: MethodResponse) ((Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
-> MethodResponse -> f MethodResponse)
-> ((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)))
-> MethodResponse
-> f MethodResponse
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
instance Core.FromJSON MethodResponse where
parseJSON :: Value -> Parser MethodResponse
parseJSON =
String
-> (Object -> Parser MethodResponse)
-> Value
-> Parser MethodResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"MethodResponse"
( \Object
x ->
Maybe (HashMap Text Text)
-> Maybe Text -> Maybe (HashMap Text Bool) -> MethodResponse
MethodResponse'
(Maybe (HashMap Text Text)
-> Maybe Text -> Maybe (HashMap Text Bool) -> MethodResponse)
-> Parser (Maybe (HashMap Text Text))
-> Parser
(Maybe Text -> Maybe (HashMap Text Bool) -> MethodResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"responseModels" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> Maybe (HashMap Text Bool) -> MethodResponse)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Bool) -> MethodResponse)
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
"statusCode")
Parser (Maybe (HashMap Text Bool) -> MethodResponse)
-> Parser (Maybe (HashMap Text Bool)) -> Parser MethodResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Bool)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"responseParameters"
Parser (Maybe (Maybe (HashMap Text Bool)))
-> Maybe (HashMap Text Bool) -> Parser (Maybe (HashMap Text Bool))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Bool)
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable MethodResponse
instance Prelude.NFData MethodResponse