{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:commentId:GetComment' :: Text
commentId = Text
pCommentId_}
getComment_commentId :: Lens.Lens' GetComment Prelude.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 :: (Service -> Service) -> GetComment -> Request GetComment
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetComment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetComment)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Comment -> Int -> GetCommentResponse
GetCommentResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"comment")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetComment where
hashWithSalt :: Int -> GetComment -> Int
hashWithSalt Int
_salt GetComment' {Text
commentId :: Text
$sel:commentId:GetComment' :: GetComment -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
commentId
instance Prelude.NFData GetComment where
rnf :: GetComment -> ()
rnf GetComment' {Text
commentId :: Text
$sel:commentId:GetComment' :: GetComment -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
commentId
instance Data.ToHeaders GetComment where
toHeaders :: GetComment -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"CodeCommit_20150413.GetComment" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetComment where
toJSON :: GetComment -> Value
toJSON GetComment' {Text
commentId :: Text
$sel:commentId:GetComment' :: GetComment -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"commentId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
commentId)]
)
instance Data.ToPath GetComment where
toPath :: GetComment -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetComment where
toQuery :: GetComment -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data =
{
:: Prelude.Maybe Comment,
:: Prelude.Int
}
deriving (GetCommentResponse -> GetCommentResponse -> Bool
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]
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
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. 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'
{ $sel:comment:GetCommentResponse' :: Maybe Comment
comment = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCommentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCommentResponse_comment :: Lens.Lens' GetCommentResponse (Prelude.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
= 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 where
rnf :: GetCommentResponse -> ()
rnf GetCommentResponse' {Int
Maybe Comment
httpStatus :: Int
comment :: Maybe Comment
$sel:httpStatus:GetCommentResponse' :: GetCommentResponse -> Int
$sel:comment:GetCommentResponse' :: GetCommentResponse -> Maybe Comment
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Comment
comment
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus