{-# 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.LexModels.Types.CodeHook where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CodeHook = CodeHook'
{
CodeHook -> Text
uri :: Prelude.Text,
CodeHook -> Text
messageVersion :: Prelude.Text
}
deriving (CodeHook -> CodeHook -> Bool
(CodeHook -> CodeHook -> Bool)
-> (CodeHook -> CodeHook -> Bool) -> Eq CodeHook
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeHook -> CodeHook -> Bool
$c/= :: CodeHook -> CodeHook -> Bool
== :: CodeHook -> CodeHook -> Bool
$c== :: CodeHook -> CodeHook -> Bool
Prelude.Eq, ReadPrec [CodeHook]
ReadPrec CodeHook
Int -> ReadS CodeHook
ReadS [CodeHook]
(Int -> ReadS CodeHook)
-> ReadS [CodeHook]
-> ReadPrec CodeHook
-> ReadPrec [CodeHook]
-> Read CodeHook
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeHook]
$creadListPrec :: ReadPrec [CodeHook]
readPrec :: ReadPrec CodeHook
$creadPrec :: ReadPrec CodeHook
readList :: ReadS [CodeHook]
$creadList :: ReadS [CodeHook]
readsPrec :: Int -> ReadS CodeHook
$creadsPrec :: Int -> ReadS CodeHook
Prelude.Read, Int -> CodeHook -> ShowS
[CodeHook] -> ShowS
CodeHook -> String
(Int -> CodeHook -> ShowS)
-> (CodeHook -> String) -> ([CodeHook] -> ShowS) -> Show CodeHook
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeHook] -> ShowS
$cshowList :: [CodeHook] -> ShowS
show :: CodeHook -> String
$cshow :: CodeHook -> String
showsPrec :: Int -> CodeHook -> ShowS
$cshowsPrec :: Int -> CodeHook -> ShowS
Prelude.Show, (forall x. CodeHook -> Rep CodeHook x)
-> (forall x. Rep CodeHook x -> CodeHook) -> Generic CodeHook
forall x. Rep CodeHook x -> CodeHook
forall x. CodeHook -> Rep CodeHook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeHook x -> CodeHook
$cfrom :: forall x. CodeHook -> Rep CodeHook x
Prelude.Generic)
newCodeHook ::
Prelude.Text ->
Prelude.Text ->
CodeHook
newCodeHook :: Text -> Text -> CodeHook
newCodeHook Text
pUri_ Text
pMessageVersion_ =
CodeHook' :: Text -> Text -> CodeHook
CodeHook'
{ $sel:uri:CodeHook' :: Text
uri = Text
pUri_,
$sel:messageVersion:CodeHook' :: Text
messageVersion = Text
pMessageVersion_
}
codeHook_uri :: Lens.Lens' CodeHook Prelude.Text
codeHook_uri :: (Text -> f Text) -> CodeHook -> f CodeHook
codeHook_uri = (CodeHook -> Text)
-> (CodeHook -> Text -> CodeHook)
-> Lens CodeHook CodeHook Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeHook' {Text
uri :: Text
$sel:uri:CodeHook' :: CodeHook -> Text
uri} -> Text
uri) (\s :: CodeHook
s@CodeHook' {} Text
a -> CodeHook
s {$sel:uri:CodeHook' :: Text
uri = Text
a} :: CodeHook)
codeHook_messageVersion :: Lens.Lens' CodeHook Prelude.Text
codeHook_messageVersion :: (Text -> f Text) -> CodeHook -> f CodeHook
codeHook_messageVersion = (CodeHook -> Text)
-> (CodeHook -> Text -> CodeHook)
-> Lens CodeHook CodeHook Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeHook' {Text
messageVersion :: Text
$sel:messageVersion:CodeHook' :: CodeHook -> Text
messageVersion} -> Text
messageVersion) (\s :: CodeHook
s@CodeHook' {} Text
a -> CodeHook
s {$sel:messageVersion:CodeHook' :: Text
messageVersion = Text
a} :: CodeHook)
instance Core.FromJSON CodeHook where
parseJSON :: Value -> Parser CodeHook
parseJSON =
String -> (Object -> Parser CodeHook) -> Value -> Parser CodeHook
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CodeHook"
( \Object
x ->
Text -> Text -> CodeHook
CodeHook'
(Text -> Text -> CodeHook)
-> Parser Text -> Parser (Text -> CodeHook)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"uri")
Parser (Text -> CodeHook) -> Parser Text -> Parser CodeHook
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"messageVersion")
)
instance Prelude.Hashable CodeHook
instance Prelude.NFData CodeHook
instance Core.ToJSON CodeHook where
toJSON :: CodeHook -> Value
toJSON CodeHook' {Text
messageVersion :: Text
uri :: Text
$sel:messageVersion:CodeHook' :: CodeHook -> Text
$sel:uri:CodeHook' :: CodeHook -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
uri),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"messageVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
messageVersion)
]
)