{-# 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.CodeCommit.GetComment
(
GetComment (..),
newGetComment,
getComment_commentId,
GetCommentResponse (..),
newGetCommentResponse,
getCommentResponse_comment,
getCommentResponse_httpStatus,
)
where
import Amazonka.CodeCommit.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 =
{
:: Prelude.Text
}
deriving (GetComment -> GetComment -> Bool
(GetComment -> GetComment -> Bool)
-> (GetComment -> GetComment -> Bool) -> Eq GetComment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetComment -> GetComment -> Bool
$c/= :: GetComment -> GetComment -> Bool
== :: GetComment -> GetComment -> Bool
$c== :: GetComment -> GetComment -> Bool
Prelude.Eq, ReadPrec [GetComment]
ReadPrec GetComment
Int -> ReadS GetComment
ReadS [GetComment]
(Int -> ReadS GetComment)
-> ReadS [GetComment]
-> ReadPrec GetComment
-> ReadPrec [GetComment]
-> Read GetComment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetComment]
$creadListPrec :: ReadPrec [GetComment]
readPrec :: ReadPrec GetComment
$creadPrec :: ReadPrec GetComment
readList :: ReadS [GetComment]
$creadList :: ReadS [GetComment]
readsPrec :: Int -> ReadS GetComment
$creadsPrec :: Int -> ReadS GetComment
Prelude.Read, Int -> GetComment -> ShowS
[GetComment] -> ShowS
GetComment -> String
(Int -> GetComment -> ShowS)
-> (GetComment -> String)
-> ([GetComment] -> ShowS)
-> Show GetComment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetComment] -> ShowS
$cshowList :: [GetComment] -> ShowS
show :: GetComment -> String
$cshow :: GetComment -> String
showsPrec :: Int -> GetComment -> ShowS
$cshowsPrec :: Int -> GetComment -> ShowS
Prelude.Show, (forall x. GetComment -> Rep GetComment x)
-> (forall x. Rep GetComment x -> GetComment) -> Generic GetComment
forall x. Rep GetComment x -> GetComment
forall x. GetComment -> Rep GetComment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetComment x -> GetComment
$cfrom :: forall x. GetComment -> Rep GetComment x
Prelude.Generic)
newGetComment ::
Prelude.Text ->
GetComment
Text
pCommentId_ =
GetComment' :: Text -> GetComment
GetComment' {$sel:commentId:GetComment' :: Text
commentId = Text
pCommentId_}
getComment_commentId :: Lens.Lens' GetComment Prelude.Text
= (GetComment -> Text)
-> (GetComment -> Text -> GetComment)
-> Lens GetComment GetComment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComment' {Text
commentId :: Text
$sel:commentId:GetComment' :: GetComment -> Text
commentId} -> Text
commentId) (\s :: GetComment
s@GetComment' {} Text
a -> GetComment
s {$sel:commentId:GetComment' :: Text
commentId = Text
a} :: GetComment)
instance Core.AWSRequest GetComment where
type AWSResponse GetComment = GetCommentResponse
request :: GetComment -> Request GetComment
request = Service -> GetComment -> Request GetComment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetComment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetComment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetComment))
-> Logger
-> Service
-> Proxy GetComment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetComment)))
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 ->
Maybe Comment -> Int -> GetCommentResponse
GetCommentResponse'
(Maybe Comment -> Int -> GetCommentResponse)
-> Either String (Maybe Comment)
-> Either String (Int -> GetCommentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Comment)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"comment")
Either String (Int -> GetCommentResponse)
-> Either String Int -> Either String GetCommentResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetComment
instance Prelude.NFData GetComment
instance Core.ToHeaders GetComment where
toHeaders :: GetComment -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetComment -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodeCommit_20150413.GetComment" ::
Prelude.ByteString
),
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.ToJSON GetComment where
toJSON :: GetComment -> Value
toJSON GetComment' {Text
commentId :: Text
$sel:commentId:GetComment' :: GetComment -> 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
"commentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
commentId)]
)
instance Core.ToPath GetComment where
toPath :: GetComment -> ByteString
toPath = ByteString -> GetComment -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetComment where
toQuery :: GetComment -> QueryString
toQuery = QueryString -> GetComment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data =
{
:: Prelude.Maybe Comment,
:: Prelude.Int
}
deriving (GetCommentResponse -> GetCommentResponse -> Bool
(GetCommentResponse -> GetCommentResponse -> Bool)
-> (GetCommentResponse -> GetCommentResponse -> Bool)
-> Eq GetCommentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCommentResponse -> GetCommentResponse -> Bool
$c/= :: GetCommentResponse -> GetCommentResponse -> Bool
== :: GetCommentResponse -> GetCommentResponse -> Bool
$c== :: GetCommentResponse -> GetCommentResponse -> Bool
Prelude.Eq, ReadPrec [GetCommentResponse]
ReadPrec GetCommentResponse
Int -> ReadS GetCommentResponse
ReadS [GetCommentResponse]
(Int -> ReadS GetCommentResponse)
-> ReadS [GetCommentResponse]
-> ReadPrec GetCommentResponse
-> ReadPrec [GetCommentResponse]
-> Read GetCommentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCommentResponse]
$creadListPrec :: ReadPrec [GetCommentResponse]
readPrec :: ReadPrec GetCommentResponse
$creadPrec :: ReadPrec GetCommentResponse
readList :: ReadS [GetCommentResponse]
$creadList :: ReadS [GetCommentResponse]
readsPrec :: Int -> ReadS GetCommentResponse
$creadsPrec :: Int -> ReadS GetCommentResponse
Prelude.Read, Int -> GetCommentResponse -> ShowS
[GetCommentResponse] -> ShowS
GetCommentResponse -> String
(Int -> GetCommentResponse -> ShowS)
-> (GetCommentResponse -> String)
-> ([GetCommentResponse] -> ShowS)
-> Show GetCommentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCommentResponse] -> ShowS
$cshowList :: [GetCommentResponse] -> ShowS
show :: GetCommentResponse -> String
$cshow :: GetCommentResponse -> String
showsPrec :: Int -> GetCommentResponse -> ShowS
$cshowsPrec :: Int -> GetCommentResponse -> ShowS
Prelude.Show, (forall x. GetCommentResponse -> Rep GetCommentResponse x)
-> (forall x. Rep GetCommentResponse x -> GetCommentResponse)
-> Generic GetCommentResponse
forall x. Rep GetCommentResponse x -> GetCommentResponse
forall x. GetCommentResponse -> Rep GetCommentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCommentResponse x -> GetCommentResponse
$cfrom :: forall x. GetCommentResponse -> Rep GetCommentResponse x
Prelude.Generic)
newGetCommentResponse ::
Prelude.Int ->
GetCommentResponse
Int
pHttpStatus_ =
GetCommentResponse' :: Maybe Comment -> Int -> GetCommentResponse
GetCommentResponse'
{ $sel:comment:GetCommentResponse' :: Maybe Comment
comment = Maybe Comment
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCommentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCommentResponse_comment :: Lens.Lens' GetCommentResponse (Prelude.Maybe Comment)
= (GetCommentResponse -> Maybe Comment)
-> (GetCommentResponse -> Maybe Comment -> GetCommentResponse)
-> Lens
GetCommentResponse
GetCommentResponse
(Maybe Comment)
(Maybe Comment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCommentResponse' {Maybe Comment
comment :: Maybe Comment
$sel:comment:GetCommentResponse' :: GetCommentResponse -> Maybe Comment
comment} -> Maybe Comment
comment) (\s :: GetCommentResponse
s@GetCommentResponse' {} Maybe Comment
a -> GetCommentResponse
s {$sel:comment:GetCommentResponse' :: Maybe Comment
comment = Maybe Comment
a} :: GetCommentResponse)
getCommentResponse_httpStatus :: Lens.Lens' GetCommentResponse Prelude.Int
= (GetCommentResponse -> Int)
-> (GetCommentResponse -> Int -> GetCommentResponse)
-> Lens GetCommentResponse GetCommentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCommentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCommentResponse' :: GetCommentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCommentResponse
s@GetCommentResponse' {} Int
a -> GetCommentResponse
s {$sel:httpStatus:GetCommentResponse' :: Int
httpStatus = Int
a} :: GetCommentResponse)
instance Prelude.NFData GetCommentResponse