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