{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CodeCommit.PostCommentForComparedCommit
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Posts a comment on the comparison between two commits.
module Amazonka.CodeCommit.PostCommentForComparedCommit
  ( -- * Creating a Request
    PostCommentForComparedCommit (..),
    newPostCommentForComparedCommit,

    -- * Request Lenses
    postCommentForComparedCommit_location,
    postCommentForComparedCommit_beforeCommitId,
    postCommentForComparedCommit_clientRequestToken,
    postCommentForComparedCommit_repositoryName,
    postCommentForComparedCommit_afterCommitId,
    postCommentForComparedCommit_content,

    -- * Destructuring the Response
    PostCommentForComparedCommitResponse (..),
    newPostCommentForComparedCommitResponse,

    -- * Response Lenses
    postCommentForComparedCommitResponse_beforeBlobId,
    postCommentForComparedCommitResponse_location,
    postCommentForComparedCommitResponse_afterCommitId,
    postCommentForComparedCommitResponse_afterBlobId,
    postCommentForComparedCommitResponse_beforeCommitId,
    postCommentForComparedCommitResponse_repositoryName,
    postCommentForComparedCommitResponse_comment,
    postCommentForComparedCommitResponse_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

-- | /See:/ 'newPostCommentForComparedCommit' smart constructor.
data PostCommentForComparedCommit = PostCommentForComparedCommit'
  { -- | The location of the comparison where you want to comment.
    PostCommentForComparedCommit -> Maybe Location
location :: Prelude.Maybe Location,
    -- | To establish the directionality of the comparison, the full commit ID of
    -- the before commit. Required for commenting on any commit unless that
    -- commit is the initial commit.
    PostCommentForComparedCommit -> Maybe Text
beforeCommitId :: Prelude.Maybe Prelude.Text,
    -- | A unique, client-generated idempotency token that, when provided in a
    -- request, ensures the request cannot be repeated with a changed
    -- parameter. If a request is received with the same parameters and a token
    -- is included, the request returns information about the initial request
    -- that used that token.
    PostCommentForComparedCommit -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the repository where you want to post a comment on the
    -- comparison between commits.
    PostCommentForComparedCommit -> Text
repositoryName :: Prelude.Text,
    -- | To establish the directionality of the comparison, the full commit ID of
    -- the after commit.
    PostCommentForComparedCommit -> Text
afterCommitId :: Prelude.Text,
    -- | The content of the comment you want to make.
    PostCommentForComparedCommit -> Text
content :: Prelude.Text
  }
  deriving (PostCommentForComparedCommit
-> PostCommentForComparedCommit -> Bool
(PostCommentForComparedCommit
 -> PostCommentForComparedCommit -> Bool)
-> (PostCommentForComparedCommit
    -> PostCommentForComparedCommit -> Bool)
-> Eq PostCommentForComparedCommit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostCommentForComparedCommit
-> PostCommentForComparedCommit -> Bool
$c/= :: PostCommentForComparedCommit
-> PostCommentForComparedCommit -> Bool
== :: PostCommentForComparedCommit
-> PostCommentForComparedCommit -> Bool
$c== :: PostCommentForComparedCommit
-> PostCommentForComparedCommit -> Bool
Prelude.Eq, ReadPrec [PostCommentForComparedCommit]
ReadPrec PostCommentForComparedCommit
Int -> ReadS PostCommentForComparedCommit
ReadS [PostCommentForComparedCommit]
(Int -> ReadS PostCommentForComparedCommit)
-> ReadS [PostCommentForComparedCommit]
-> ReadPrec PostCommentForComparedCommit
-> ReadPrec [PostCommentForComparedCommit]
-> Read PostCommentForComparedCommit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostCommentForComparedCommit]
$creadListPrec :: ReadPrec [PostCommentForComparedCommit]
readPrec :: ReadPrec PostCommentForComparedCommit
$creadPrec :: ReadPrec PostCommentForComparedCommit
readList :: ReadS [PostCommentForComparedCommit]
$creadList :: ReadS [PostCommentForComparedCommit]
readsPrec :: Int -> ReadS PostCommentForComparedCommit
$creadsPrec :: Int -> ReadS PostCommentForComparedCommit
Prelude.Read, Int -> PostCommentForComparedCommit -> ShowS
[PostCommentForComparedCommit] -> ShowS
PostCommentForComparedCommit -> String
(Int -> PostCommentForComparedCommit -> ShowS)
-> (PostCommentForComparedCommit -> String)
-> ([PostCommentForComparedCommit] -> ShowS)
-> Show PostCommentForComparedCommit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostCommentForComparedCommit] -> ShowS
$cshowList :: [PostCommentForComparedCommit] -> ShowS
show :: PostCommentForComparedCommit -> String
$cshow :: PostCommentForComparedCommit -> String
showsPrec :: Int -> PostCommentForComparedCommit -> ShowS
$cshowsPrec :: Int -> PostCommentForComparedCommit -> ShowS
Prelude.Show, (forall x.
 PostCommentForComparedCommit -> Rep PostCommentForComparedCommit x)
-> (forall x.
    Rep PostCommentForComparedCommit x -> PostCommentForComparedCommit)
-> Generic PostCommentForComparedCommit
forall x.
Rep PostCommentForComparedCommit x -> PostCommentForComparedCommit
forall x.
PostCommentForComparedCommit -> Rep PostCommentForComparedCommit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PostCommentForComparedCommit x -> PostCommentForComparedCommit
$cfrom :: forall x.
PostCommentForComparedCommit -> Rep PostCommentForComparedCommit x
Prelude.Generic)

-- |
-- Create a value of 'PostCommentForComparedCommit' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'location', 'postCommentForComparedCommit_location' - The location of the comparison where you want to comment.
--
-- 'beforeCommitId', 'postCommentForComparedCommit_beforeCommitId' - To establish the directionality of the comparison, the full commit ID of
-- the before commit. Required for commenting on any commit unless that
-- commit is the initial commit.
--
-- 'clientRequestToken', 'postCommentForComparedCommit_clientRequestToken' - A unique, client-generated idempotency token that, when provided in a
-- request, ensures the request cannot be repeated with a changed
-- parameter. If a request is received with the same parameters and a token
-- is included, the request returns information about the initial request
-- that used that token.
--
-- 'repositoryName', 'postCommentForComparedCommit_repositoryName' - The name of the repository where you want to post a comment on the
-- comparison between commits.
--
-- 'afterCommitId', 'postCommentForComparedCommit_afterCommitId' - To establish the directionality of the comparison, the full commit ID of
-- the after commit.
--
-- 'content', 'postCommentForComparedCommit_content' - The content of the comment you want to make.
newPostCommentForComparedCommit ::
  -- | 'repositoryName'
  Prelude.Text ->
  -- | 'afterCommitId'
  Prelude.Text ->
  -- | 'content'
  Prelude.Text ->
  PostCommentForComparedCommit
newPostCommentForComparedCommit :: Text -> Text -> Text -> PostCommentForComparedCommit
newPostCommentForComparedCommit
  Text
pRepositoryName_
  Text
pAfterCommitId_
  Text
pContent_ =
    PostCommentForComparedCommit' :: Maybe Location
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> PostCommentForComparedCommit
PostCommentForComparedCommit'
      { $sel:location:PostCommentForComparedCommit' :: Maybe Location
location =
          Maybe Location
forall a. Maybe a
Prelude.Nothing,
        $sel:beforeCommitId:PostCommentForComparedCommit' :: Maybe Text
beforeCommitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:clientRequestToken:PostCommentForComparedCommit' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:repositoryName:PostCommentForComparedCommit' :: Text
repositoryName = Text
pRepositoryName_,
        $sel:afterCommitId:PostCommentForComparedCommit' :: Text
afterCommitId = Text
pAfterCommitId_,
        $sel:content:PostCommentForComparedCommit' :: Text
content = Text
pContent_
      }

-- | The location of the comparison where you want to comment.
postCommentForComparedCommit_location :: Lens.Lens' PostCommentForComparedCommit (Prelude.Maybe Location)
postCommentForComparedCommit_location :: (Maybe Location -> f (Maybe Location))
-> PostCommentForComparedCommit -> f PostCommentForComparedCommit
postCommentForComparedCommit_location = (PostCommentForComparedCommit -> Maybe Location)
-> (PostCommentForComparedCommit
    -> Maybe Location -> PostCommentForComparedCommit)
-> Lens
     PostCommentForComparedCommit
     PostCommentForComparedCommit
     (Maybe Location)
     (Maybe Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommit' {Maybe Location
location :: Maybe Location
$sel:location:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Maybe Location
location} -> Maybe Location
location) (\s :: PostCommentForComparedCommit
s@PostCommentForComparedCommit' {} Maybe Location
a -> PostCommentForComparedCommit
s {$sel:location:PostCommentForComparedCommit' :: Maybe Location
location = Maybe Location
a} :: PostCommentForComparedCommit)

-- | To establish the directionality of the comparison, the full commit ID of
-- the before commit. Required for commenting on any commit unless that
-- commit is the initial commit.
postCommentForComparedCommit_beforeCommitId :: Lens.Lens' PostCommentForComparedCommit (Prelude.Maybe Prelude.Text)
postCommentForComparedCommit_beforeCommitId :: (Maybe Text -> f (Maybe Text))
-> PostCommentForComparedCommit -> f PostCommentForComparedCommit
postCommentForComparedCommit_beforeCommitId = (PostCommentForComparedCommit -> Maybe Text)
-> (PostCommentForComparedCommit
    -> Maybe Text -> PostCommentForComparedCommit)
-> Lens
     PostCommentForComparedCommit
     PostCommentForComparedCommit
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommit' {Maybe Text
beforeCommitId :: Maybe Text
$sel:beforeCommitId:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Maybe Text
beforeCommitId} -> Maybe Text
beforeCommitId) (\s :: PostCommentForComparedCommit
s@PostCommentForComparedCommit' {} Maybe Text
a -> PostCommentForComparedCommit
s {$sel:beforeCommitId:PostCommentForComparedCommit' :: Maybe Text
beforeCommitId = Maybe Text
a} :: PostCommentForComparedCommit)

-- | A unique, client-generated idempotency token that, when provided in a
-- request, ensures the request cannot be repeated with a changed
-- parameter. If a request is received with the same parameters and a token
-- is included, the request returns information about the initial request
-- that used that token.
postCommentForComparedCommit_clientRequestToken :: Lens.Lens' PostCommentForComparedCommit (Prelude.Maybe Prelude.Text)
postCommentForComparedCommit_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> PostCommentForComparedCommit -> f PostCommentForComparedCommit
postCommentForComparedCommit_clientRequestToken = (PostCommentForComparedCommit -> Maybe Text)
-> (PostCommentForComparedCommit
    -> Maybe Text -> PostCommentForComparedCommit)
-> Lens
     PostCommentForComparedCommit
     PostCommentForComparedCommit
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommit' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: PostCommentForComparedCommit
s@PostCommentForComparedCommit' {} Maybe Text
a -> PostCommentForComparedCommit
s {$sel:clientRequestToken:PostCommentForComparedCommit' :: Maybe Text
clientRequestToken = Maybe Text
a} :: PostCommentForComparedCommit)

-- | The name of the repository where you want to post a comment on the
-- comparison between commits.
postCommentForComparedCommit_repositoryName :: Lens.Lens' PostCommentForComparedCommit Prelude.Text
postCommentForComparedCommit_repositoryName :: (Text -> f Text)
-> PostCommentForComparedCommit -> f PostCommentForComparedCommit
postCommentForComparedCommit_repositoryName = (PostCommentForComparedCommit -> Text)
-> (PostCommentForComparedCommit
    -> Text -> PostCommentForComparedCommit)
-> Lens
     PostCommentForComparedCommit PostCommentForComparedCommit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommit' {Text
repositoryName :: Text
$sel:repositoryName:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Text
repositoryName} -> Text
repositoryName) (\s :: PostCommentForComparedCommit
s@PostCommentForComparedCommit' {} Text
a -> PostCommentForComparedCommit
s {$sel:repositoryName:PostCommentForComparedCommit' :: Text
repositoryName = Text
a} :: PostCommentForComparedCommit)

-- | To establish the directionality of the comparison, the full commit ID of
-- the after commit.
postCommentForComparedCommit_afterCommitId :: Lens.Lens' PostCommentForComparedCommit Prelude.Text
postCommentForComparedCommit_afterCommitId :: (Text -> f Text)
-> PostCommentForComparedCommit -> f PostCommentForComparedCommit
postCommentForComparedCommit_afterCommitId = (PostCommentForComparedCommit -> Text)
-> (PostCommentForComparedCommit
    -> Text -> PostCommentForComparedCommit)
-> Lens
     PostCommentForComparedCommit PostCommentForComparedCommit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommit' {Text
afterCommitId :: Text
$sel:afterCommitId:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Text
afterCommitId} -> Text
afterCommitId) (\s :: PostCommentForComparedCommit
s@PostCommentForComparedCommit' {} Text
a -> PostCommentForComparedCommit
s {$sel:afterCommitId:PostCommentForComparedCommit' :: Text
afterCommitId = Text
a} :: PostCommentForComparedCommit)

-- | The content of the comment you want to make.
postCommentForComparedCommit_content :: Lens.Lens' PostCommentForComparedCommit Prelude.Text
postCommentForComparedCommit_content :: (Text -> f Text)
-> PostCommentForComparedCommit -> f PostCommentForComparedCommit
postCommentForComparedCommit_content = (PostCommentForComparedCommit -> Text)
-> (PostCommentForComparedCommit
    -> Text -> PostCommentForComparedCommit)
-> Lens
     PostCommentForComparedCommit PostCommentForComparedCommit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommit' {Text
content :: Text
$sel:content:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Text
content} -> Text
content) (\s :: PostCommentForComparedCommit
s@PostCommentForComparedCommit' {} Text
a -> PostCommentForComparedCommit
s {$sel:content:PostCommentForComparedCommit' :: Text
content = Text
a} :: PostCommentForComparedCommit)

instance Core.AWSRequest PostCommentForComparedCommit where
  type
    AWSResponse PostCommentForComparedCommit =
      PostCommentForComparedCommitResponse
  request :: PostCommentForComparedCommit
-> Request PostCommentForComparedCommit
request = Service
-> PostCommentForComparedCommit
-> Request PostCommentForComparedCommit
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PostCommentForComparedCommit
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PostCommentForComparedCommit)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PostCommentForComparedCommit))
-> Logger
-> Service
-> Proxy PostCommentForComparedCommit
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PostCommentForComparedCommit)))
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 Text
-> Maybe Location
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Comment
-> Int
-> PostCommentForComparedCommitResponse
PostCommentForComparedCommitResponse'
            (Maybe Text
 -> Maybe Location
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Comment
 -> Int
 -> PostCommentForComparedCommitResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Location
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Comment
      -> Int
      -> PostCommentForComparedCommitResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"beforeBlobId")
            Either
  String
  (Maybe Location
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Comment
   -> Int
   -> PostCommentForComparedCommitResponse)
-> Either String (Maybe Location)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Comment
      -> Int
      -> PostCommentForComparedCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Location)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"location")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Comment
   -> Int
   -> PostCommentForComparedCommitResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Comment
      -> Int
      -> PostCommentForComparedCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"afterCommitId")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Comment
   -> Int
   -> PostCommentForComparedCommitResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Comment
      -> Int
      -> PostCommentForComparedCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"afterBlobId")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Comment
   -> Int
   -> PostCommentForComparedCommitResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Comment -> Int -> PostCommentForComparedCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"beforeCommitId")
            Either
  String
  (Maybe Text
   -> Maybe Comment -> Int -> PostCommentForComparedCommitResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Comment -> Int -> PostCommentForComparedCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"repositoryName")
            Either
  String
  (Maybe Comment -> Int -> PostCommentForComparedCommitResponse)
-> Either String (Maybe Comment)
-> Either String (Int -> PostCommentForComparedCommitResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> PostCommentForComparedCommitResponse)
-> Either String Int
-> Either String PostCommentForComparedCommitResponse
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
    PostCommentForComparedCommit

instance Prelude.NFData PostCommentForComparedCommit

instance Core.ToHeaders PostCommentForComparedCommit where
  toHeaders :: PostCommentForComparedCommit -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PostCommentForComparedCommit -> 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.PostCommentForComparedCommit" ::
                          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 PostCommentForComparedCommit where
  toJSON :: PostCommentForComparedCommit -> Value
toJSON PostCommentForComparedCommit' {Maybe Text
Maybe Location
Text
content :: Text
afterCommitId :: Text
repositoryName :: Text
clientRequestToken :: Maybe Text
beforeCommitId :: Maybe Text
location :: Maybe Location
$sel:content:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Text
$sel:afterCommitId:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Text
$sel:repositoryName:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Text
$sel:clientRequestToken:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Maybe Text
$sel:beforeCommitId:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Maybe Text
$sel:location:PostCommentForComparedCommit' :: PostCommentForComparedCommit -> Maybe Location
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"location" Text -> Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Location -> Pair) -> Maybe Location -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Location
location,
            (Text
"beforeCommitId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
beforeCommitId,
            (Text
"clientRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientRequestToken,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"repositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"afterCommitId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
afterCommitId),
            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 PostCommentForComparedCommit where
  toPath :: PostCommentForComparedCommit -> ByteString
toPath = ByteString -> PostCommentForComparedCommit -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery PostCommentForComparedCommit where
  toQuery :: PostCommentForComparedCommit -> QueryString
toQuery = QueryString -> PostCommentForComparedCommit -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newPostCommentForComparedCommitResponse' smart constructor.
data PostCommentForComparedCommitResponse = PostCommentForComparedCommitResponse'
  { -- | In the directionality you established, the blob ID of the before blob.
    PostCommentForComparedCommitResponse -> Maybe Text
beforeBlobId :: Prelude.Maybe Prelude.Text,
    -- | The location of the comment in the comparison between the two commits.
    PostCommentForComparedCommitResponse -> Maybe Location
location :: Prelude.Maybe Location,
    -- | In the directionality you established, the full commit ID of the after
    -- commit.
    PostCommentForComparedCommitResponse -> Maybe Text
afterCommitId :: Prelude.Maybe Prelude.Text,
    -- | In the directionality you established, the blob ID of the after blob.
    PostCommentForComparedCommitResponse -> Maybe Text
afterBlobId :: Prelude.Maybe Prelude.Text,
    -- | In the directionality you established, the full commit ID of the before
    -- commit.
    PostCommentForComparedCommitResponse -> Maybe Text
beforeCommitId :: Prelude.Maybe Prelude.Text,
    -- | The name of the repository where you posted a comment on the comparison
    -- between commits.
    PostCommentForComparedCommitResponse -> Maybe Text
repositoryName :: Prelude.Maybe Prelude.Text,
    -- | The content of the comment you posted.
    PostCommentForComparedCommitResponse -> Maybe Comment
comment :: Prelude.Maybe Comment,
    -- | The response's http status code.
    PostCommentForComparedCommitResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PostCommentForComparedCommitResponse
-> PostCommentForComparedCommitResponse -> Bool
(PostCommentForComparedCommitResponse
 -> PostCommentForComparedCommitResponse -> Bool)
-> (PostCommentForComparedCommitResponse
    -> PostCommentForComparedCommitResponse -> Bool)
-> Eq PostCommentForComparedCommitResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostCommentForComparedCommitResponse
-> PostCommentForComparedCommitResponse -> Bool
$c/= :: PostCommentForComparedCommitResponse
-> PostCommentForComparedCommitResponse -> Bool
== :: PostCommentForComparedCommitResponse
-> PostCommentForComparedCommitResponse -> Bool
$c== :: PostCommentForComparedCommitResponse
-> PostCommentForComparedCommitResponse -> Bool
Prelude.Eq, ReadPrec [PostCommentForComparedCommitResponse]
ReadPrec PostCommentForComparedCommitResponse
Int -> ReadS PostCommentForComparedCommitResponse
ReadS [PostCommentForComparedCommitResponse]
(Int -> ReadS PostCommentForComparedCommitResponse)
-> ReadS [PostCommentForComparedCommitResponse]
-> ReadPrec PostCommentForComparedCommitResponse
-> ReadPrec [PostCommentForComparedCommitResponse]
-> Read PostCommentForComparedCommitResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostCommentForComparedCommitResponse]
$creadListPrec :: ReadPrec [PostCommentForComparedCommitResponse]
readPrec :: ReadPrec PostCommentForComparedCommitResponse
$creadPrec :: ReadPrec PostCommentForComparedCommitResponse
readList :: ReadS [PostCommentForComparedCommitResponse]
$creadList :: ReadS [PostCommentForComparedCommitResponse]
readsPrec :: Int -> ReadS PostCommentForComparedCommitResponse
$creadsPrec :: Int -> ReadS PostCommentForComparedCommitResponse
Prelude.Read, Int -> PostCommentForComparedCommitResponse -> ShowS
[PostCommentForComparedCommitResponse] -> ShowS
PostCommentForComparedCommitResponse -> String
(Int -> PostCommentForComparedCommitResponse -> ShowS)
-> (PostCommentForComparedCommitResponse -> String)
-> ([PostCommentForComparedCommitResponse] -> ShowS)
-> Show PostCommentForComparedCommitResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostCommentForComparedCommitResponse] -> ShowS
$cshowList :: [PostCommentForComparedCommitResponse] -> ShowS
show :: PostCommentForComparedCommitResponse -> String
$cshow :: PostCommentForComparedCommitResponse -> String
showsPrec :: Int -> PostCommentForComparedCommitResponse -> ShowS
$cshowsPrec :: Int -> PostCommentForComparedCommitResponse -> ShowS
Prelude.Show, (forall x.
 PostCommentForComparedCommitResponse
 -> Rep PostCommentForComparedCommitResponse x)
-> (forall x.
    Rep PostCommentForComparedCommitResponse x
    -> PostCommentForComparedCommitResponse)
-> Generic PostCommentForComparedCommitResponse
forall x.
Rep PostCommentForComparedCommitResponse x
-> PostCommentForComparedCommitResponse
forall x.
PostCommentForComparedCommitResponse
-> Rep PostCommentForComparedCommitResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PostCommentForComparedCommitResponse x
-> PostCommentForComparedCommitResponse
$cfrom :: forall x.
PostCommentForComparedCommitResponse
-> Rep PostCommentForComparedCommitResponse x
Prelude.Generic)

-- |
-- Create a value of 'PostCommentForComparedCommitResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'beforeBlobId', 'postCommentForComparedCommitResponse_beforeBlobId' - In the directionality you established, the blob ID of the before blob.
--
-- 'location', 'postCommentForComparedCommitResponse_location' - The location of the comment in the comparison between the two commits.
--
-- 'afterCommitId', 'postCommentForComparedCommitResponse_afterCommitId' - In the directionality you established, the full commit ID of the after
-- commit.
--
-- 'afterBlobId', 'postCommentForComparedCommitResponse_afterBlobId' - In the directionality you established, the blob ID of the after blob.
--
-- 'beforeCommitId', 'postCommentForComparedCommitResponse_beforeCommitId' - In the directionality you established, the full commit ID of the before
-- commit.
--
-- 'repositoryName', 'postCommentForComparedCommitResponse_repositoryName' - The name of the repository where you posted a comment on the comparison
-- between commits.
--
-- 'comment', 'postCommentForComparedCommitResponse_comment' - The content of the comment you posted.
--
-- 'httpStatus', 'postCommentForComparedCommitResponse_httpStatus' - The response's http status code.
newPostCommentForComparedCommitResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PostCommentForComparedCommitResponse
newPostCommentForComparedCommitResponse :: Int -> PostCommentForComparedCommitResponse
newPostCommentForComparedCommitResponse Int
pHttpStatus_ =
  PostCommentForComparedCommitResponse' :: Maybe Text
-> Maybe Location
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Comment
-> Int
-> PostCommentForComparedCommitResponse
PostCommentForComparedCommitResponse'
    { $sel:beforeBlobId:PostCommentForComparedCommitResponse' :: Maybe Text
beforeBlobId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:location:PostCommentForComparedCommitResponse' :: Maybe Location
location = Maybe Location
forall a. Maybe a
Prelude.Nothing,
      $sel:afterCommitId:PostCommentForComparedCommitResponse' :: Maybe Text
afterCommitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:afterBlobId:PostCommentForComparedCommitResponse' :: Maybe Text
afterBlobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:beforeCommitId:PostCommentForComparedCommitResponse' :: Maybe Text
beforeCommitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:PostCommentForComparedCommitResponse' :: Maybe Text
repositoryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:comment:PostCommentForComparedCommitResponse' :: Maybe Comment
comment = Maybe Comment
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PostCommentForComparedCommitResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | In the directionality you established, the blob ID of the before blob.
postCommentForComparedCommitResponse_beforeBlobId :: Lens.Lens' PostCommentForComparedCommitResponse (Prelude.Maybe Prelude.Text)
postCommentForComparedCommitResponse_beforeBlobId :: (Maybe Text -> f (Maybe Text))
-> PostCommentForComparedCommitResponse
-> f PostCommentForComparedCommitResponse
postCommentForComparedCommitResponse_beforeBlobId = (PostCommentForComparedCommitResponse -> Maybe Text)
-> (PostCommentForComparedCommitResponse
    -> Maybe Text -> PostCommentForComparedCommitResponse)
-> Lens
     PostCommentForComparedCommitResponse
     PostCommentForComparedCommitResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommitResponse' {Maybe Text
beforeBlobId :: Maybe Text
$sel:beforeBlobId:PostCommentForComparedCommitResponse' :: PostCommentForComparedCommitResponse -> Maybe Text
beforeBlobId} -> Maybe Text
beforeBlobId) (\s :: PostCommentForComparedCommitResponse
s@PostCommentForComparedCommitResponse' {} Maybe Text
a -> PostCommentForComparedCommitResponse
s {$sel:beforeBlobId:PostCommentForComparedCommitResponse' :: Maybe Text
beforeBlobId = Maybe Text
a} :: PostCommentForComparedCommitResponse)

-- | The location of the comment in the comparison between the two commits.
postCommentForComparedCommitResponse_location :: Lens.Lens' PostCommentForComparedCommitResponse (Prelude.Maybe Location)
postCommentForComparedCommitResponse_location :: (Maybe Location -> f (Maybe Location))
-> PostCommentForComparedCommitResponse
-> f PostCommentForComparedCommitResponse
postCommentForComparedCommitResponse_location = (PostCommentForComparedCommitResponse -> Maybe Location)
-> (PostCommentForComparedCommitResponse
    -> Maybe Location -> PostCommentForComparedCommitResponse)
-> Lens
     PostCommentForComparedCommitResponse
     PostCommentForComparedCommitResponse
     (Maybe Location)
     (Maybe Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommitResponse' {Maybe Location
location :: Maybe Location
$sel:location:PostCommentForComparedCommitResponse' :: PostCommentForComparedCommitResponse -> Maybe Location
location} -> Maybe Location
location) (\s :: PostCommentForComparedCommitResponse
s@PostCommentForComparedCommitResponse' {} Maybe Location
a -> PostCommentForComparedCommitResponse
s {$sel:location:PostCommentForComparedCommitResponse' :: Maybe Location
location = Maybe Location
a} :: PostCommentForComparedCommitResponse)

-- | In the directionality you established, the full commit ID of the after
-- commit.
postCommentForComparedCommitResponse_afterCommitId :: Lens.Lens' PostCommentForComparedCommitResponse (Prelude.Maybe Prelude.Text)
postCommentForComparedCommitResponse_afterCommitId :: (Maybe Text -> f (Maybe Text))
-> PostCommentForComparedCommitResponse
-> f PostCommentForComparedCommitResponse
postCommentForComparedCommitResponse_afterCommitId = (PostCommentForComparedCommitResponse -> Maybe Text)
-> (PostCommentForComparedCommitResponse
    -> Maybe Text -> PostCommentForComparedCommitResponse)
-> Lens
     PostCommentForComparedCommitResponse
     PostCommentForComparedCommitResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommitResponse' {Maybe Text
afterCommitId :: Maybe Text
$sel:afterCommitId:PostCommentForComparedCommitResponse' :: PostCommentForComparedCommitResponse -> Maybe Text
afterCommitId} -> Maybe Text
afterCommitId) (\s :: PostCommentForComparedCommitResponse
s@PostCommentForComparedCommitResponse' {} Maybe Text
a -> PostCommentForComparedCommitResponse
s {$sel:afterCommitId:PostCommentForComparedCommitResponse' :: Maybe Text
afterCommitId = Maybe Text
a} :: PostCommentForComparedCommitResponse)

-- | In the directionality you established, the blob ID of the after blob.
postCommentForComparedCommitResponse_afterBlobId :: Lens.Lens' PostCommentForComparedCommitResponse (Prelude.Maybe Prelude.Text)
postCommentForComparedCommitResponse_afterBlobId :: (Maybe Text -> f (Maybe Text))
-> PostCommentForComparedCommitResponse
-> f PostCommentForComparedCommitResponse
postCommentForComparedCommitResponse_afterBlobId = (PostCommentForComparedCommitResponse -> Maybe Text)
-> (PostCommentForComparedCommitResponse
    -> Maybe Text -> PostCommentForComparedCommitResponse)
-> Lens
     PostCommentForComparedCommitResponse
     PostCommentForComparedCommitResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommitResponse' {Maybe Text
afterBlobId :: Maybe Text
$sel:afterBlobId:PostCommentForComparedCommitResponse' :: PostCommentForComparedCommitResponse -> Maybe Text
afterBlobId} -> Maybe Text
afterBlobId) (\s :: PostCommentForComparedCommitResponse
s@PostCommentForComparedCommitResponse' {} Maybe Text
a -> PostCommentForComparedCommitResponse
s {$sel:afterBlobId:PostCommentForComparedCommitResponse' :: Maybe Text
afterBlobId = Maybe Text
a} :: PostCommentForComparedCommitResponse)

-- | In the directionality you established, the full commit ID of the before
-- commit.
postCommentForComparedCommitResponse_beforeCommitId :: Lens.Lens' PostCommentForComparedCommitResponse (Prelude.Maybe Prelude.Text)
postCommentForComparedCommitResponse_beforeCommitId :: (Maybe Text -> f (Maybe Text))
-> PostCommentForComparedCommitResponse
-> f PostCommentForComparedCommitResponse
postCommentForComparedCommitResponse_beforeCommitId = (PostCommentForComparedCommitResponse -> Maybe Text)
-> (PostCommentForComparedCommitResponse
    -> Maybe Text -> PostCommentForComparedCommitResponse)
-> Lens
     PostCommentForComparedCommitResponse
     PostCommentForComparedCommitResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommitResponse' {Maybe Text
beforeCommitId :: Maybe Text
$sel:beforeCommitId:PostCommentForComparedCommitResponse' :: PostCommentForComparedCommitResponse -> Maybe Text
beforeCommitId} -> Maybe Text
beforeCommitId) (\s :: PostCommentForComparedCommitResponse
s@PostCommentForComparedCommitResponse' {} Maybe Text
a -> PostCommentForComparedCommitResponse
s {$sel:beforeCommitId:PostCommentForComparedCommitResponse' :: Maybe Text
beforeCommitId = Maybe Text
a} :: PostCommentForComparedCommitResponse)

-- | The name of the repository where you posted a comment on the comparison
-- between commits.
postCommentForComparedCommitResponse_repositoryName :: Lens.Lens' PostCommentForComparedCommitResponse (Prelude.Maybe Prelude.Text)
postCommentForComparedCommitResponse_repositoryName :: (Maybe Text -> f (Maybe Text))
-> PostCommentForComparedCommitResponse
-> f PostCommentForComparedCommitResponse
postCommentForComparedCommitResponse_repositoryName = (PostCommentForComparedCommitResponse -> Maybe Text)
-> (PostCommentForComparedCommitResponse
    -> Maybe Text -> PostCommentForComparedCommitResponse)
-> Lens
     PostCommentForComparedCommitResponse
     PostCommentForComparedCommitResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommitResponse' {Maybe Text
repositoryName :: Maybe Text
$sel:repositoryName:PostCommentForComparedCommitResponse' :: PostCommentForComparedCommitResponse -> Maybe Text
repositoryName} -> Maybe Text
repositoryName) (\s :: PostCommentForComparedCommitResponse
s@PostCommentForComparedCommitResponse' {} Maybe Text
a -> PostCommentForComparedCommitResponse
s {$sel:repositoryName:PostCommentForComparedCommitResponse' :: Maybe Text
repositoryName = Maybe Text
a} :: PostCommentForComparedCommitResponse)

-- | The content of the comment you posted.
postCommentForComparedCommitResponse_comment :: Lens.Lens' PostCommentForComparedCommitResponse (Prelude.Maybe Comment)
postCommentForComparedCommitResponse_comment :: (Maybe Comment -> f (Maybe Comment))
-> PostCommentForComparedCommitResponse
-> f PostCommentForComparedCommitResponse
postCommentForComparedCommitResponse_comment = (PostCommentForComparedCommitResponse -> Maybe Comment)
-> (PostCommentForComparedCommitResponse
    -> Maybe Comment -> PostCommentForComparedCommitResponse)
-> Lens
     PostCommentForComparedCommitResponse
     PostCommentForComparedCommitResponse
     (Maybe Comment)
     (Maybe Comment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommitResponse' {Maybe Comment
comment :: Maybe Comment
$sel:comment:PostCommentForComparedCommitResponse' :: PostCommentForComparedCommitResponse -> Maybe Comment
comment} -> Maybe Comment
comment) (\s :: PostCommentForComparedCommitResponse
s@PostCommentForComparedCommitResponse' {} Maybe Comment
a -> PostCommentForComparedCommitResponse
s {$sel:comment:PostCommentForComparedCommitResponse' :: Maybe Comment
comment = Maybe Comment
a} :: PostCommentForComparedCommitResponse)

-- | The response's http status code.
postCommentForComparedCommitResponse_httpStatus :: Lens.Lens' PostCommentForComparedCommitResponse Prelude.Int
postCommentForComparedCommitResponse_httpStatus :: (Int -> f Int)
-> PostCommentForComparedCommitResponse
-> f PostCommentForComparedCommitResponse
postCommentForComparedCommitResponse_httpStatus = (PostCommentForComparedCommitResponse -> Int)
-> (PostCommentForComparedCommitResponse
    -> Int -> PostCommentForComparedCommitResponse)
-> Lens
     PostCommentForComparedCommitResponse
     PostCommentForComparedCommitResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentForComparedCommitResponse' {Int
httpStatus :: Int
$sel:httpStatus:PostCommentForComparedCommitResponse' :: PostCommentForComparedCommitResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PostCommentForComparedCommitResponse
s@PostCommentForComparedCommitResponse' {} Int
a -> PostCommentForComparedCommitResponse
s {$sel:httpStatus:PostCommentForComparedCommitResponse' :: Int
httpStatus = Int
a} :: PostCommentForComparedCommitResponse)

instance
  Prelude.NFData
    PostCommentForComparedCommitResponse