{-# 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.Amplify.GetWebhook
(
GetWebhook (..),
newGetWebhook,
getWebhook_webhookId,
GetWebhookResponse (..),
newGetWebhookResponse,
getWebhookResponse_httpStatus,
getWebhookResponse_webhook,
)
where
import Amazonka.Amplify.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 GetWebhook = GetWebhook'
{
GetWebhook -> Text
webhookId :: Prelude.Text
}
deriving (GetWebhook -> GetWebhook -> Bool
(GetWebhook -> GetWebhook -> Bool)
-> (GetWebhook -> GetWebhook -> Bool) -> Eq GetWebhook
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWebhook -> GetWebhook -> Bool
$c/= :: GetWebhook -> GetWebhook -> Bool
== :: GetWebhook -> GetWebhook -> Bool
$c== :: GetWebhook -> GetWebhook -> Bool
Prelude.Eq, ReadPrec [GetWebhook]
ReadPrec GetWebhook
Int -> ReadS GetWebhook
ReadS [GetWebhook]
(Int -> ReadS GetWebhook)
-> ReadS [GetWebhook]
-> ReadPrec GetWebhook
-> ReadPrec [GetWebhook]
-> Read GetWebhook
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWebhook]
$creadListPrec :: ReadPrec [GetWebhook]
readPrec :: ReadPrec GetWebhook
$creadPrec :: ReadPrec GetWebhook
readList :: ReadS [GetWebhook]
$creadList :: ReadS [GetWebhook]
readsPrec :: Int -> ReadS GetWebhook
$creadsPrec :: Int -> ReadS GetWebhook
Prelude.Read, Int -> GetWebhook -> ShowS
[GetWebhook] -> ShowS
GetWebhook -> String
(Int -> GetWebhook -> ShowS)
-> (GetWebhook -> String)
-> ([GetWebhook] -> ShowS)
-> Show GetWebhook
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWebhook] -> ShowS
$cshowList :: [GetWebhook] -> ShowS
show :: GetWebhook -> String
$cshow :: GetWebhook -> String
showsPrec :: Int -> GetWebhook -> ShowS
$cshowsPrec :: Int -> GetWebhook -> ShowS
Prelude.Show, (forall x. GetWebhook -> Rep GetWebhook x)
-> (forall x. Rep GetWebhook x -> GetWebhook) -> Generic GetWebhook
forall x. Rep GetWebhook x -> GetWebhook
forall x. GetWebhook -> Rep GetWebhook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetWebhook x -> GetWebhook
$cfrom :: forall x. GetWebhook -> Rep GetWebhook x
Prelude.Generic)
newGetWebhook ::
Prelude.Text ->
GetWebhook
newGetWebhook :: Text -> GetWebhook
newGetWebhook Text
pWebhookId_ =
GetWebhook' :: Text -> GetWebhook
GetWebhook' {$sel:webhookId:GetWebhook' :: Text
webhookId = Text
pWebhookId_}
getWebhook_webhookId :: Lens.Lens' GetWebhook Prelude.Text
getWebhook_webhookId :: (Text -> f Text) -> GetWebhook -> f GetWebhook
getWebhook_webhookId = (GetWebhook -> Text)
-> (GetWebhook -> Text -> GetWebhook)
-> Lens GetWebhook GetWebhook Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWebhook' {Text
webhookId :: Text
$sel:webhookId:GetWebhook' :: GetWebhook -> Text
webhookId} -> Text
webhookId) (\s :: GetWebhook
s@GetWebhook' {} Text
a -> GetWebhook
s {$sel:webhookId:GetWebhook' :: Text
webhookId = Text
a} :: GetWebhook)
instance Core.AWSRequest GetWebhook where
type AWSResponse GetWebhook = GetWebhookResponse
request :: GetWebhook -> Request GetWebhook
request = Service -> GetWebhook -> Request GetWebhook
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetWebhook
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetWebhook)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetWebhook))
-> Logger
-> Service
-> Proxy GetWebhook
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetWebhook)))
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 ->
Int -> Webhook -> GetWebhookResponse
GetWebhookResponse'
(Int -> Webhook -> GetWebhookResponse)
-> Either String Int
-> Either String (Webhook -> GetWebhookResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String (Webhook -> GetWebhookResponse)
-> Either String Webhook -> Either String GetWebhookResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Webhook
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"webhook")
)
instance Prelude.Hashable GetWebhook
instance Prelude.NFData GetWebhook
instance Core.ToHeaders GetWebhook where
toHeaders :: GetWebhook -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetWebhook -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath GetWebhook where
toPath :: GetWebhook -> ByteString
toPath GetWebhook' {Text
webhookId :: Text
$sel:webhookId:GetWebhook' :: GetWebhook -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/webhooks/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
webhookId]
instance Core.ToQuery GetWebhook where
toQuery :: GetWebhook -> QueryString
toQuery = QueryString -> GetWebhook -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetWebhookResponse = GetWebhookResponse'
{
GetWebhookResponse -> Int
httpStatus :: Prelude.Int,
GetWebhookResponse -> Webhook
webhook :: Webhook
}
deriving (GetWebhookResponse -> GetWebhookResponse -> Bool
(GetWebhookResponse -> GetWebhookResponse -> Bool)
-> (GetWebhookResponse -> GetWebhookResponse -> Bool)
-> Eq GetWebhookResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWebhookResponse -> GetWebhookResponse -> Bool
$c/= :: GetWebhookResponse -> GetWebhookResponse -> Bool
== :: GetWebhookResponse -> GetWebhookResponse -> Bool
$c== :: GetWebhookResponse -> GetWebhookResponse -> Bool
Prelude.Eq, ReadPrec [GetWebhookResponse]
ReadPrec GetWebhookResponse
Int -> ReadS GetWebhookResponse
ReadS [GetWebhookResponse]
(Int -> ReadS GetWebhookResponse)
-> ReadS [GetWebhookResponse]
-> ReadPrec GetWebhookResponse
-> ReadPrec [GetWebhookResponse]
-> Read GetWebhookResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWebhookResponse]
$creadListPrec :: ReadPrec [GetWebhookResponse]
readPrec :: ReadPrec GetWebhookResponse
$creadPrec :: ReadPrec GetWebhookResponse
readList :: ReadS [GetWebhookResponse]
$creadList :: ReadS [GetWebhookResponse]
readsPrec :: Int -> ReadS GetWebhookResponse
$creadsPrec :: Int -> ReadS GetWebhookResponse
Prelude.Read, Int -> GetWebhookResponse -> ShowS
[GetWebhookResponse] -> ShowS
GetWebhookResponse -> String
(Int -> GetWebhookResponse -> ShowS)
-> (GetWebhookResponse -> String)
-> ([GetWebhookResponse] -> ShowS)
-> Show GetWebhookResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWebhookResponse] -> ShowS
$cshowList :: [GetWebhookResponse] -> ShowS
show :: GetWebhookResponse -> String
$cshow :: GetWebhookResponse -> String
showsPrec :: Int -> GetWebhookResponse -> ShowS
$cshowsPrec :: Int -> GetWebhookResponse -> ShowS
Prelude.Show, (forall x. GetWebhookResponse -> Rep GetWebhookResponse x)
-> (forall x. Rep GetWebhookResponse x -> GetWebhookResponse)
-> Generic GetWebhookResponse
forall x. Rep GetWebhookResponse x -> GetWebhookResponse
forall x. GetWebhookResponse -> Rep GetWebhookResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetWebhookResponse x -> GetWebhookResponse
$cfrom :: forall x. GetWebhookResponse -> Rep GetWebhookResponse x
Prelude.Generic)
newGetWebhookResponse ::
Prelude.Int ->
Webhook ->
GetWebhookResponse
newGetWebhookResponse :: Int -> Webhook -> GetWebhookResponse
newGetWebhookResponse Int
pHttpStatus_ Webhook
pWebhook_ =
GetWebhookResponse' :: Int -> Webhook -> GetWebhookResponse
GetWebhookResponse'
{ $sel:httpStatus:GetWebhookResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:webhook:GetWebhookResponse' :: Webhook
webhook = Webhook
pWebhook_
}
getWebhookResponse_httpStatus :: Lens.Lens' GetWebhookResponse Prelude.Int
getWebhookResponse_httpStatus :: (Int -> f Int) -> GetWebhookResponse -> f GetWebhookResponse
getWebhookResponse_httpStatus = (GetWebhookResponse -> Int)
-> (GetWebhookResponse -> Int -> GetWebhookResponse)
-> Lens GetWebhookResponse GetWebhookResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWebhookResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetWebhookResponse' :: GetWebhookResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetWebhookResponse
s@GetWebhookResponse' {} Int
a -> GetWebhookResponse
s {$sel:httpStatus:GetWebhookResponse' :: Int
httpStatus = Int
a} :: GetWebhookResponse)
getWebhookResponse_webhook :: Lens.Lens' GetWebhookResponse Webhook
getWebhookResponse_webhook :: (Webhook -> f Webhook)
-> GetWebhookResponse -> f GetWebhookResponse
getWebhookResponse_webhook = (GetWebhookResponse -> Webhook)
-> (GetWebhookResponse -> Webhook -> GetWebhookResponse)
-> Lens GetWebhookResponse GetWebhookResponse Webhook Webhook
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWebhookResponse' {Webhook
webhook :: Webhook
$sel:webhook:GetWebhookResponse' :: GetWebhookResponse -> Webhook
webhook} -> Webhook
webhook) (\s :: GetWebhookResponse
s@GetWebhookResponse' {} Webhook
a -> GetWebhookResponse
s {$sel:webhook:GetWebhookResponse' :: Webhook
webhook = Webhook
a} :: GetWebhookResponse)
instance Prelude.NFData GetWebhookResponse