{-# 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.UpdateComment
(
UpdateComment (..),
newUpdateComment,
updateComment_commentId,
updateComment_content,
UpdateCommentResponse (..),
newUpdateCommentResponse,
updateCommentResponse_comment,
updateCommentResponse_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,
:: Prelude.Text
}
deriving (UpdateComment -> UpdateComment -> Bool
(UpdateComment -> UpdateComment -> Bool)
-> (UpdateComment -> UpdateComment -> Bool) -> Eq UpdateComment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateComment -> UpdateComment -> Bool
$c/= :: UpdateComment -> UpdateComment -> Bool
== :: UpdateComment -> UpdateComment -> Bool
$c== :: UpdateComment -> UpdateComment -> Bool
Prelude.Eq, ReadPrec [UpdateComment]
ReadPrec UpdateComment
Int -> ReadS UpdateComment
ReadS [UpdateComment]
(Int -> ReadS UpdateComment)
-> ReadS [UpdateComment]
-> ReadPrec UpdateComment
-> ReadPrec [UpdateComment]
-> Read UpdateComment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateComment]
$creadListPrec :: ReadPrec [UpdateComment]
readPrec :: ReadPrec UpdateComment
$creadPrec :: ReadPrec UpdateComment
readList :: ReadS [UpdateComment]
$creadList :: ReadS [UpdateComment]
readsPrec :: Int -> ReadS UpdateComment
$creadsPrec :: Int -> ReadS UpdateComment
Prelude.Read, Int -> UpdateComment -> ShowS
[UpdateComment] -> ShowS
UpdateComment -> String
(Int -> UpdateComment -> ShowS)
-> (UpdateComment -> String)
-> ([UpdateComment] -> ShowS)
-> Show UpdateComment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateComment] -> ShowS
$cshowList :: [UpdateComment] -> ShowS
show :: UpdateComment -> String
$cshow :: UpdateComment -> String
showsPrec :: Int -> UpdateComment -> ShowS
$cshowsPrec :: Int -> UpdateComment -> ShowS
Prelude.Show, (forall x. UpdateComment -> Rep UpdateComment x)
-> (forall x. Rep UpdateComment x -> UpdateComment)
-> Generic UpdateComment
forall x. Rep UpdateComment x -> UpdateComment
forall x. UpdateComment -> Rep UpdateComment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateComment x -> UpdateComment
$cfrom :: forall x. UpdateComment -> Rep UpdateComment x
Prelude.Generic)
newUpdateComment ::
Prelude.Text ->
Prelude.Text ->
UpdateComment
Text
pCommentId_ Text
pContent_ =
UpdateComment' :: Text -> Text -> UpdateComment
UpdateComment'
{ $sel:commentId:UpdateComment' :: Text
commentId = Text
pCommentId_,
$sel:content:UpdateComment' :: Text
content = Text
pContent_
}
updateComment_commentId :: Lens.Lens' UpdateComment Prelude.Text
= (UpdateComment -> Text)
-> (UpdateComment -> Text -> UpdateComment)
-> Lens UpdateComment UpdateComment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComment' {Text
commentId :: Text
$sel:commentId:UpdateComment' :: UpdateComment -> Text
commentId} -> Text
commentId) (\s :: UpdateComment
s@UpdateComment' {} Text
a -> UpdateComment
s {$sel:commentId:UpdateComment' :: Text
commentId = Text
a} :: UpdateComment)
updateComment_content :: Lens.Lens' UpdateComment Prelude.Text
= (UpdateComment -> Text)
-> (UpdateComment -> Text -> UpdateComment)
-> Lens UpdateComment UpdateComment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComment' {Text
content :: Text
$sel:content:UpdateComment' :: UpdateComment -> Text
content} -> Text
content) (\s :: UpdateComment
s@UpdateComment' {} Text
a -> UpdateComment
s {$sel:content:UpdateComment' :: Text
content = Text
a} :: UpdateComment)
instance Core.AWSRequest UpdateComment where
type
AWSResponse UpdateComment =
UpdateCommentResponse
request :: UpdateComment -> Request UpdateComment
request = Service -> UpdateComment -> Request UpdateComment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateComment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateComment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateComment))
-> Logger
-> Service
-> Proxy UpdateComment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateComment)))
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 -> UpdateCommentResponse
UpdateCommentResponse'
(Maybe Comment -> Int -> UpdateCommentResponse)
-> Either String (Maybe Comment)
-> Either String (Int -> UpdateCommentResponse)
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 -> UpdateCommentResponse)
-> Either String Int -> Either String UpdateCommentResponse
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 UpdateComment
instance Prelude.NFData UpdateComment
instance Core.ToHeaders UpdateComment where
toHeaders :: UpdateComment -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateComment -> 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.UpdateComment" ::
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 UpdateComment where
toJSON :: UpdateComment -> Value
toJSON UpdateComment' {Text
content :: Text
commentId :: Text
$sel:content:UpdateComment' :: UpdateComment -> Text
$sel:commentId:UpdateComment' :: UpdateComment -> 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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"content" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
content)
]
)
instance Core.ToPath UpdateComment where
toPath :: UpdateComment -> ByteString
toPath = ByteString -> UpdateComment -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateComment where
toQuery :: UpdateComment -> QueryString
toQuery = QueryString -> UpdateComment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data =
{
:: Prelude.Maybe Comment,
:: Prelude.Int
}
deriving (UpdateCommentResponse -> UpdateCommentResponse -> Bool
(UpdateCommentResponse -> UpdateCommentResponse -> Bool)
-> (UpdateCommentResponse -> UpdateCommentResponse -> Bool)
-> Eq UpdateCommentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCommentResponse -> UpdateCommentResponse -> Bool
$c/= :: UpdateCommentResponse -> UpdateCommentResponse -> Bool
== :: UpdateCommentResponse -> UpdateCommentResponse -> Bool
$c== :: UpdateCommentResponse -> UpdateCommentResponse -> Bool
Prelude.Eq, ReadPrec [UpdateCommentResponse]
ReadPrec UpdateCommentResponse
Int -> ReadS UpdateCommentResponse
ReadS [UpdateCommentResponse]
(Int -> ReadS UpdateCommentResponse)
-> ReadS [UpdateCommentResponse]
-> ReadPrec UpdateCommentResponse
-> ReadPrec [UpdateCommentResponse]
-> Read UpdateCommentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCommentResponse]
$creadListPrec :: ReadPrec [UpdateCommentResponse]
readPrec :: ReadPrec UpdateCommentResponse
$creadPrec :: ReadPrec UpdateCommentResponse
readList :: ReadS [UpdateCommentResponse]
$creadList :: ReadS [UpdateCommentResponse]
readsPrec :: Int -> ReadS UpdateCommentResponse
$creadsPrec :: Int -> ReadS UpdateCommentResponse
Prelude.Read, Int -> UpdateCommentResponse -> ShowS
[UpdateCommentResponse] -> ShowS
UpdateCommentResponse -> String
(Int -> UpdateCommentResponse -> ShowS)
-> (UpdateCommentResponse -> String)
-> ([UpdateCommentResponse] -> ShowS)
-> Show UpdateCommentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCommentResponse] -> ShowS
$cshowList :: [UpdateCommentResponse] -> ShowS
show :: UpdateCommentResponse -> String
$cshow :: UpdateCommentResponse -> String
showsPrec :: Int -> UpdateCommentResponse -> ShowS
$cshowsPrec :: Int -> UpdateCommentResponse -> ShowS
Prelude.Show, (forall x. UpdateCommentResponse -> Rep UpdateCommentResponse x)
-> (forall x. Rep UpdateCommentResponse x -> UpdateCommentResponse)
-> Generic UpdateCommentResponse
forall x. Rep UpdateCommentResponse x -> UpdateCommentResponse
forall x. UpdateCommentResponse -> Rep UpdateCommentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateCommentResponse x -> UpdateCommentResponse
$cfrom :: forall x. UpdateCommentResponse -> Rep UpdateCommentResponse x
Prelude.Generic)
newUpdateCommentResponse ::
Prelude.Int ->
UpdateCommentResponse
Int
pHttpStatus_ =
UpdateCommentResponse' :: Maybe Comment -> Int -> UpdateCommentResponse
UpdateCommentResponse'
{ $sel:comment:UpdateCommentResponse' :: Maybe Comment
comment = Maybe Comment
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateCommentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateCommentResponse_comment :: Lens.Lens' UpdateCommentResponse (Prelude.Maybe Comment)
= (UpdateCommentResponse -> Maybe Comment)
-> (UpdateCommentResponse
-> Maybe Comment -> UpdateCommentResponse)
-> Lens
UpdateCommentResponse
UpdateCommentResponse
(Maybe Comment)
(Maybe Comment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCommentResponse' {Maybe Comment
comment :: Maybe Comment
$sel:comment:UpdateCommentResponse' :: UpdateCommentResponse -> Maybe Comment
comment} -> Maybe Comment
comment) (\s :: UpdateCommentResponse
s@UpdateCommentResponse' {} Maybe Comment
a -> UpdateCommentResponse
s {$sel:comment:UpdateCommentResponse' :: Maybe Comment
comment = Maybe Comment
a} :: UpdateCommentResponse)
updateCommentResponse_httpStatus :: Lens.Lens' UpdateCommentResponse Prelude.Int
= (UpdateCommentResponse -> Int)
-> (UpdateCommentResponse -> Int -> UpdateCommentResponse)
-> Lens UpdateCommentResponse UpdateCommentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCommentResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateCommentResponse' :: UpdateCommentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateCommentResponse
s@UpdateCommentResponse' {} Int
a -> UpdateCommentResponse
s {$sel:httpStatus:UpdateCommentResponse' :: Int
httpStatus = Int
a} :: UpdateCommentResponse)
instance Prelude.NFData UpdateCommentResponse