{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 (HashMap Text Bool)
responseParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Bool),
MethodResponse -> Maybe Text
statusCode :: Prelude.Maybe Prelude.Text
}
deriving (MethodResponse -> MethodResponse -> Bool
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]
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
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. 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'
{ $sel:responseModels:MethodResponse' :: Maybe (HashMap Text Text)
responseModels = forall a. Maybe a
Prelude.Nothing,
$sel:responseParameters:MethodResponse' :: Maybe (HashMap Text Bool)
responseParameters = forall a. Maybe a
Prelude.Nothing,
$sel:statusCode:MethodResponse' :: Maybe Text
statusCode = forall a. Maybe a
Prelude.Nothing
}
methodResponse_responseModels :: Lens.Lens' MethodResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
methodResponse_responseModels :: Lens' MethodResponse (Maybe (HashMap Text Text))
methodResponse_responseModels = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
methodResponse_responseParameters :: Lens.Lens' MethodResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Bool))
methodResponse_responseParameters :: Lens' MethodResponse (Maybe (HashMap Text Bool))
methodResponse_responseParameters = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' MethodResponse (Maybe Text)
methodResponse_statusCode = 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)
instance Data.FromJSON MethodResponse where
parseJSON :: Value -> Parser MethodResponse
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"MethodResponse"
( \Object
x ->
Maybe (HashMap Text Text)
-> Maybe (HashMap Text Bool) -> Maybe Text -> MethodResponse
MethodResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"responseModels" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"responseParameters"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"statusCode")
)
instance Prelude.Hashable MethodResponse where
hashWithSalt :: Int -> MethodResponse -> Int
hashWithSalt Int
_salt MethodResponse' {Maybe Text
Maybe (HashMap Text Bool)
Maybe (HashMap Text Text)
statusCode :: Maybe Text
responseParameters :: Maybe (HashMap Text Bool)
responseModels :: Maybe (HashMap Text Text)
$sel:statusCode:MethodResponse' :: MethodResponse -> Maybe Text
$sel:responseParameters:MethodResponse' :: MethodResponse -> Maybe (HashMap Text Bool)
$sel:responseModels:MethodResponse' :: MethodResponse -> Maybe (HashMap Text Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
responseModels
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Bool)
responseParameters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusCode
instance Prelude.NFData MethodResponse where
rnf :: MethodResponse -> ()
rnf MethodResponse' {Maybe Text
Maybe (HashMap Text Bool)
Maybe (HashMap Text Text)
statusCode :: Maybe Text
responseParameters :: Maybe (HashMap Text Bool)
responseModels :: Maybe (HashMap Text Text)
$sel:statusCode:MethodResponse' :: MethodResponse -> Maybe Text
$sel:responseParameters:MethodResponse' :: MethodResponse -> Maybe (HashMap Text Bool)
$sel:responseModels:MethodResponse' :: MethodResponse -> Maybe (HashMap Text Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
responseModels
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Bool)
responseParameters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusCode