{-# 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.CreatePullRequestApprovalRule
-- 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)
--
-- Creates an approval rule for a pull request.
module Amazonka.CodeCommit.CreatePullRequestApprovalRule
  ( -- * Creating a Request
    CreatePullRequestApprovalRule (..),
    newCreatePullRequestApprovalRule,

    -- * Request Lenses
    createPullRequestApprovalRule_pullRequestId,
    createPullRequestApprovalRule_approvalRuleName,
    createPullRequestApprovalRule_approvalRuleContent,

    -- * Destructuring the Response
    CreatePullRequestApprovalRuleResponse (..),
    newCreatePullRequestApprovalRuleResponse,

    -- * Response Lenses
    createPullRequestApprovalRuleResponse_httpStatus,
    createPullRequestApprovalRuleResponse_approvalRule,
  )
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:/ 'newCreatePullRequestApprovalRule' smart constructor.
data CreatePullRequestApprovalRule = CreatePullRequestApprovalRule'
  { -- | The system-generated ID of the pull request for which you want to create
    -- the approval rule.
    CreatePullRequestApprovalRule -> Text
pullRequestId :: Prelude.Text,
    -- | The name for the approval rule.
    CreatePullRequestApprovalRule -> Text
approvalRuleName :: Prelude.Text,
    -- | The content of the approval rule, including the number of approvals
    -- needed and the structure of an approval pool defined for approvals, if
    -- any. For more information about approval pools, see the AWS CodeCommit
    -- User Guide.
    --
    -- When you create the content of the approval rule, you can specify
    -- approvers in an approval pool in one of two ways:
    --
    -- -   __CodeCommitApprovers__: This option only requires an AWS account
    --     and a resource. It can be used for both IAM users and federated
    --     access users whose name matches the provided resource name. This is
    --     a very powerful option that offers a great deal of flexibility. For
    --     example, if you specify the AWS account /123456789012/ and
    --     /Mary_Major/, all of the following would be counted as approvals
    --     coming from that user:
    --
    --     -   An IAM user in the account
    --         (arn:aws:iam::/123456789012/:user\//Mary_Major/)
    --
    --     -   A federated user identified in IAM as Mary_Major
    --         (arn:aws:sts::/123456789012/:federated-user\//Mary_Major/)
    --
    --     This option does not recognize an active session of someone assuming
    --     the role of CodeCommitReview with a role session name of
    --     /Mary_Major/
    --     (arn:aws:sts::/123456789012/:assumed-role\/CodeCommitReview\//Mary_Major/)
    --     unless you include a wildcard (*Mary_Major).
    --
    -- -   __Fully qualified ARN__: This option allows you to specify the fully
    --     qualified Amazon Resource Name (ARN) of the IAM user or role.
    --
    -- For more information about IAM ARNs, wildcards, and formats, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html IAM Identifiers>
    -- in the /IAM User Guide/.
    CreatePullRequestApprovalRule -> Text
approvalRuleContent :: Prelude.Text
  }
  deriving (CreatePullRequestApprovalRule
-> CreatePullRequestApprovalRule -> Bool
(CreatePullRequestApprovalRule
 -> CreatePullRequestApprovalRule -> Bool)
-> (CreatePullRequestApprovalRule
    -> CreatePullRequestApprovalRule -> Bool)
-> Eq CreatePullRequestApprovalRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePullRequestApprovalRule
-> CreatePullRequestApprovalRule -> Bool
$c/= :: CreatePullRequestApprovalRule
-> CreatePullRequestApprovalRule -> Bool
== :: CreatePullRequestApprovalRule
-> CreatePullRequestApprovalRule -> Bool
$c== :: CreatePullRequestApprovalRule
-> CreatePullRequestApprovalRule -> Bool
Prelude.Eq, ReadPrec [CreatePullRequestApprovalRule]
ReadPrec CreatePullRequestApprovalRule
Int -> ReadS CreatePullRequestApprovalRule
ReadS [CreatePullRequestApprovalRule]
(Int -> ReadS CreatePullRequestApprovalRule)
-> ReadS [CreatePullRequestApprovalRule]
-> ReadPrec CreatePullRequestApprovalRule
-> ReadPrec [CreatePullRequestApprovalRule]
-> Read CreatePullRequestApprovalRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePullRequestApprovalRule]
$creadListPrec :: ReadPrec [CreatePullRequestApprovalRule]
readPrec :: ReadPrec CreatePullRequestApprovalRule
$creadPrec :: ReadPrec CreatePullRequestApprovalRule
readList :: ReadS [CreatePullRequestApprovalRule]
$creadList :: ReadS [CreatePullRequestApprovalRule]
readsPrec :: Int -> ReadS CreatePullRequestApprovalRule
$creadsPrec :: Int -> ReadS CreatePullRequestApprovalRule
Prelude.Read, Int -> CreatePullRequestApprovalRule -> ShowS
[CreatePullRequestApprovalRule] -> ShowS
CreatePullRequestApprovalRule -> String
(Int -> CreatePullRequestApprovalRule -> ShowS)
-> (CreatePullRequestApprovalRule -> String)
-> ([CreatePullRequestApprovalRule] -> ShowS)
-> Show CreatePullRequestApprovalRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePullRequestApprovalRule] -> ShowS
$cshowList :: [CreatePullRequestApprovalRule] -> ShowS
show :: CreatePullRequestApprovalRule -> String
$cshow :: CreatePullRequestApprovalRule -> String
showsPrec :: Int -> CreatePullRequestApprovalRule -> ShowS
$cshowsPrec :: Int -> CreatePullRequestApprovalRule -> ShowS
Prelude.Show, (forall x.
 CreatePullRequestApprovalRule
 -> Rep CreatePullRequestApprovalRule x)
-> (forall x.
    Rep CreatePullRequestApprovalRule x
    -> CreatePullRequestApprovalRule)
-> Generic CreatePullRequestApprovalRule
forall x.
Rep CreatePullRequestApprovalRule x
-> CreatePullRequestApprovalRule
forall x.
CreatePullRequestApprovalRule
-> Rep CreatePullRequestApprovalRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePullRequestApprovalRule x
-> CreatePullRequestApprovalRule
$cfrom :: forall x.
CreatePullRequestApprovalRule
-> Rep CreatePullRequestApprovalRule x
Prelude.Generic)

-- |
-- Create a value of 'CreatePullRequestApprovalRule' 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:
--
-- 'pullRequestId', 'createPullRequestApprovalRule_pullRequestId' - The system-generated ID of the pull request for which you want to create
-- the approval rule.
--
-- 'approvalRuleName', 'createPullRequestApprovalRule_approvalRuleName' - The name for the approval rule.
--
-- 'approvalRuleContent', 'createPullRequestApprovalRule_approvalRuleContent' - The content of the approval rule, including the number of approvals
-- needed and the structure of an approval pool defined for approvals, if
-- any. For more information about approval pools, see the AWS CodeCommit
-- User Guide.
--
-- When you create the content of the approval rule, you can specify
-- approvers in an approval pool in one of two ways:
--
-- -   __CodeCommitApprovers__: This option only requires an AWS account
--     and a resource. It can be used for both IAM users and federated
--     access users whose name matches the provided resource name. This is
--     a very powerful option that offers a great deal of flexibility. For
--     example, if you specify the AWS account /123456789012/ and
--     /Mary_Major/, all of the following would be counted as approvals
--     coming from that user:
--
--     -   An IAM user in the account
--         (arn:aws:iam::/123456789012/:user\//Mary_Major/)
--
--     -   A federated user identified in IAM as Mary_Major
--         (arn:aws:sts::/123456789012/:federated-user\//Mary_Major/)
--
--     This option does not recognize an active session of someone assuming
--     the role of CodeCommitReview with a role session name of
--     /Mary_Major/
--     (arn:aws:sts::/123456789012/:assumed-role\/CodeCommitReview\//Mary_Major/)
--     unless you include a wildcard (*Mary_Major).
--
-- -   __Fully qualified ARN__: This option allows you to specify the fully
--     qualified Amazon Resource Name (ARN) of the IAM user or role.
--
-- For more information about IAM ARNs, wildcards, and formats, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html IAM Identifiers>
-- in the /IAM User Guide/.
newCreatePullRequestApprovalRule ::
  -- | 'pullRequestId'
  Prelude.Text ->
  -- | 'approvalRuleName'
  Prelude.Text ->
  -- | 'approvalRuleContent'
  Prelude.Text ->
  CreatePullRequestApprovalRule
newCreatePullRequestApprovalRule :: Text -> Text -> Text -> CreatePullRequestApprovalRule
newCreatePullRequestApprovalRule
  Text
pPullRequestId_
  Text
pApprovalRuleName_
  Text
pApprovalRuleContent_ =
    CreatePullRequestApprovalRule' :: Text -> Text -> Text -> CreatePullRequestApprovalRule
CreatePullRequestApprovalRule'
      { $sel:pullRequestId:CreatePullRequestApprovalRule' :: Text
pullRequestId =
          Text
pPullRequestId_,
        $sel:approvalRuleName:CreatePullRequestApprovalRule' :: Text
approvalRuleName = Text
pApprovalRuleName_,
        $sel:approvalRuleContent:CreatePullRequestApprovalRule' :: Text
approvalRuleContent = Text
pApprovalRuleContent_
      }

-- | The system-generated ID of the pull request for which you want to create
-- the approval rule.
createPullRequestApprovalRule_pullRequestId :: Lens.Lens' CreatePullRequestApprovalRule Prelude.Text
createPullRequestApprovalRule_pullRequestId :: (Text -> f Text)
-> CreatePullRequestApprovalRule -> f CreatePullRequestApprovalRule
createPullRequestApprovalRule_pullRequestId = (CreatePullRequestApprovalRule -> Text)
-> (CreatePullRequestApprovalRule
    -> Text -> CreatePullRequestApprovalRule)
-> Lens
     CreatePullRequestApprovalRule
     CreatePullRequestApprovalRule
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePullRequestApprovalRule' {Text
pullRequestId :: Text
$sel:pullRequestId:CreatePullRequestApprovalRule' :: CreatePullRequestApprovalRule -> Text
pullRequestId} -> Text
pullRequestId) (\s :: CreatePullRequestApprovalRule
s@CreatePullRequestApprovalRule' {} Text
a -> CreatePullRequestApprovalRule
s {$sel:pullRequestId:CreatePullRequestApprovalRule' :: Text
pullRequestId = Text
a} :: CreatePullRequestApprovalRule)

-- | The name for the approval rule.
createPullRequestApprovalRule_approvalRuleName :: Lens.Lens' CreatePullRequestApprovalRule Prelude.Text
createPullRequestApprovalRule_approvalRuleName :: (Text -> f Text)
-> CreatePullRequestApprovalRule -> f CreatePullRequestApprovalRule
createPullRequestApprovalRule_approvalRuleName = (CreatePullRequestApprovalRule -> Text)
-> (CreatePullRequestApprovalRule
    -> Text -> CreatePullRequestApprovalRule)
-> Lens
     CreatePullRequestApprovalRule
     CreatePullRequestApprovalRule
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePullRequestApprovalRule' {Text
approvalRuleName :: Text
$sel:approvalRuleName:CreatePullRequestApprovalRule' :: CreatePullRequestApprovalRule -> Text
approvalRuleName} -> Text
approvalRuleName) (\s :: CreatePullRequestApprovalRule
s@CreatePullRequestApprovalRule' {} Text
a -> CreatePullRequestApprovalRule
s {$sel:approvalRuleName:CreatePullRequestApprovalRule' :: Text
approvalRuleName = Text
a} :: CreatePullRequestApprovalRule)

-- | The content of the approval rule, including the number of approvals
-- needed and the structure of an approval pool defined for approvals, if
-- any. For more information about approval pools, see the AWS CodeCommit
-- User Guide.
--
-- When you create the content of the approval rule, you can specify
-- approvers in an approval pool in one of two ways:
--
-- -   __CodeCommitApprovers__: This option only requires an AWS account
--     and a resource. It can be used for both IAM users and federated
--     access users whose name matches the provided resource name. This is
--     a very powerful option that offers a great deal of flexibility. For
--     example, if you specify the AWS account /123456789012/ and
--     /Mary_Major/, all of the following would be counted as approvals
--     coming from that user:
--
--     -   An IAM user in the account
--         (arn:aws:iam::/123456789012/:user\//Mary_Major/)
--
--     -   A federated user identified in IAM as Mary_Major
--         (arn:aws:sts::/123456789012/:federated-user\//Mary_Major/)
--
--     This option does not recognize an active session of someone assuming
--     the role of CodeCommitReview with a role session name of
--     /Mary_Major/
--     (arn:aws:sts::/123456789012/:assumed-role\/CodeCommitReview\//Mary_Major/)
--     unless you include a wildcard (*Mary_Major).
--
-- -   __Fully qualified ARN__: This option allows you to specify the fully
--     qualified Amazon Resource Name (ARN) of the IAM user or role.
--
-- For more information about IAM ARNs, wildcards, and formats, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html IAM Identifiers>
-- in the /IAM User Guide/.
createPullRequestApprovalRule_approvalRuleContent :: Lens.Lens' CreatePullRequestApprovalRule Prelude.Text
createPullRequestApprovalRule_approvalRuleContent :: (Text -> f Text)
-> CreatePullRequestApprovalRule -> f CreatePullRequestApprovalRule
createPullRequestApprovalRule_approvalRuleContent = (CreatePullRequestApprovalRule -> Text)
-> (CreatePullRequestApprovalRule
    -> Text -> CreatePullRequestApprovalRule)
-> Lens
     CreatePullRequestApprovalRule
     CreatePullRequestApprovalRule
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePullRequestApprovalRule' {Text
approvalRuleContent :: Text
$sel:approvalRuleContent:CreatePullRequestApprovalRule' :: CreatePullRequestApprovalRule -> Text
approvalRuleContent} -> Text
approvalRuleContent) (\s :: CreatePullRequestApprovalRule
s@CreatePullRequestApprovalRule' {} Text
a -> CreatePullRequestApprovalRule
s {$sel:approvalRuleContent:CreatePullRequestApprovalRule' :: Text
approvalRuleContent = Text
a} :: CreatePullRequestApprovalRule)

instance
  Core.AWSRequest
    CreatePullRequestApprovalRule
  where
  type
    AWSResponse CreatePullRequestApprovalRule =
      CreatePullRequestApprovalRuleResponse
  request :: CreatePullRequestApprovalRule
-> Request CreatePullRequestApprovalRule
request = Service
-> CreatePullRequestApprovalRule
-> Request CreatePullRequestApprovalRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreatePullRequestApprovalRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreatePullRequestApprovalRule)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreatePullRequestApprovalRule))
-> Logger
-> Service
-> Proxy CreatePullRequestApprovalRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreatePullRequestApprovalRule)))
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 -> ApprovalRule -> CreatePullRequestApprovalRuleResponse
CreatePullRequestApprovalRuleResponse'
            (Int -> ApprovalRule -> CreatePullRequestApprovalRuleResponse)
-> Either String Int
-> Either
     String (ApprovalRule -> CreatePullRequestApprovalRuleResponse)
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 (ApprovalRule -> CreatePullRequestApprovalRuleResponse)
-> Either String ApprovalRule
-> Either String CreatePullRequestApprovalRuleResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ApprovalRule
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"approvalRule")
      )

instance
  Prelude.Hashable
    CreatePullRequestApprovalRule

instance Prelude.NFData CreatePullRequestApprovalRule

instance Core.ToHeaders CreatePullRequestApprovalRule where
  toHeaders :: CreatePullRequestApprovalRule -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreatePullRequestApprovalRule -> 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.CreatePullRequestApprovalRule" ::
                          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 CreatePullRequestApprovalRule where
  toJSON :: CreatePullRequestApprovalRule -> Value
toJSON CreatePullRequestApprovalRule' {Text
approvalRuleContent :: Text
approvalRuleName :: Text
pullRequestId :: Text
$sel:approvalRuleContent:CreatePullRequestApprovalRule' :: CreatePullRequestApprovalRule -> Text
$sel:approvalRuleName:CreatePullRequestApprovalRule' :: CreatePullRequestApprovalRule -> Text
$sel:pullRequestId:CreatePullRequestApprovalRule' :: CreatePullRequestApprovalRule -> 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
"pullRequestId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pullRequestId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"approvalRuleName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
approvalRuleName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"approvalRuleContent" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
approvalRuleContent)
          ]
      )

instance Core.ToPath CreatePullRequestApprovalRule where
  toPath :: CreatePullRequestApprovalRule -> ByteString
toPath = ByteString -> CreatePullRequestApprovalRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newCreatePullRequestApprovalRuleResponse' smart constructor.
data CreatePullRequestApprovalRuleResponse = CreatePullRequestApprovalRuleResponse'
  { -- | The response's http status code.
    CreatePullRequestApprovalRuleResponse -> Int
httpStatus :: Prelude.Int,
    -- | Information about the created approval rule.
    CreatePullRequestApprovalRuleResponse -> ApprovalRule
approvalRule :: ApprovalRule
  }
  deriving (CreatePullRequestApprovalRuleResponse
-> CreatePullRequestApprovalRuleResponse -> Bool
(CreatePullRequestApprovalRuleResponse
 -> CreatePullRequestApprovalRuleResponse -> Bool)
-> (CreatePullRequestApprovalRuleResponse
    -> CreatePullRequestApprovalRuleResponse -> Bool)
-> Eq CreatePullRequestApprovalRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePullRequestApprovalRuleResponse
-> CreatePullRequestApprovalRuleResponse -> Bool
$c/= :: CreatePullRequestApprovalRuleResponse
-> CreatePullRequestApprovalRuleResponse -> Bool
== :: CreatePullRequestApprovalRuleResponse
-> CreatePullRequestApprovalRuleResponse -> Bool
$c== :: CreatePullRequestApprovalRuleResponse
-> CreatePullRequestApprovalRuleResponse -> Bool
Prelude.Eq, ReadPrec [CreatePullRequestApprovalRuleResponse]
ReadPrec CreatePullRequestApprovalRuleResponse
Int -> ReadS CreatePullRequestApprovalRuleResponse
ReadS [CreatePullRequestApprovalRuleResponse]
(Int -> ReadS CreatePullRequestApprovalRuleResponse)
-> ReadS [CreatePullRequestApprovalRuleResponse]
-> ReadPrec CreatePullRequestApprovalRuleResponse
-> ReadPrec [CreatePullRequestApprovalRuleResponse]
-> Read CreatePullRequestApprovalRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePullRequestApprovalRuleResponse]
$creadListPrec :: ReadPrec [CreatePullRequestApprovalRuleResponse]
readPrec :: ReadPrec CreatePullRequestApprovalRuleResponse
$creadPrec :: ReadPrec CreatePullRequestApprovalRuleResponse
readList :: ReadS [CreatePullRequestApprovalRuleResponse]
$creadList :: ReadS [CreatePullRequestApprovalRuleResponse]
readsPrec :: Int -> ReadS CreatePullRequestApprovalRuleResponse
$creadsPrec :: Int -> ReadS CreatePullRequestApprovalRuleResponse
Prelude.Read, Int -> CreatePullRequestApprovalRuleResponse -> ShowS
[CreatePullRequestApprovalRuleResponse] -> ShowS
CreatePullRequestApprovalRuleResponse -> String
(Int -> CreatePullRequestApprovalRuleResponse -> ShowS)
-> (CreatePullRequestApprovalRuleResponse -> String)
-> ([CreatePullRequestApprovalRuleResponse] -> ShowS)
-> Show CreatePullRequestApprovalRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePullRequestApprovalRuleResponse] -> ShowS
$cshowList :: [CreatePullRequestApprovalRuleResponse] -> ShowS
show :: CreatePullRequestApprovalRuleResponse -> String
$cshow :: CreatePullRequestApprovalRuleResponse -> String
showsPrec :: Int -> CreatePullRequestApprovalRuleResponse -> ShowS
$cshowsPrec :: Int -> CreatePullRequestApprovalRuleResponse -> ShowS
Prelude.Show, (forall x.
 CreatePullRequestApprovalRuleResponse
 -> Rep CreatePullRequestApprovalRuleResponse x)
-> (forall x.
    Rep CreatePullRequestApprovalRuleResponse x
    -> CreatePullRequestApprovalRuleResponse)
-> Generic CreatePullRequestApprovalRuleResponse
forall x.
Rep CreatePullRequestApprovalRuleResponse x
-> CreatePullRequestApprovalRuleResponse
forall x.
CreatePullRequestApprovalRuleResponse
-> Rep CreatePullRequestApprovalRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePullRequestApprovalRuleResponse x
-> CreatePullRequestApprovalRuleResponse
$cfrom :: forall x.
CreatePullRequestApprovalRuleResponse
-> Rep CreatePullRequestApprovalRuleResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreatePullRequestApprovalRuleResponse' 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:
--
-- 'httpStatus', 'createPullRequestApprovalRuleResponse_httpStatus' - The response's http status code.
--
-- 'approvalRule', 'createPullRequestApprovalRuleResponse_approvalRule' - Information about the created approval rule.
newCreatePullRequestApprovalRuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'approvalRule'
  ApprovalRule ->
  CreatePullRequestApprovalRuleResponse
newCreatePullRequestApprovalRuleResponse :: Int -> ApprovalRule -> CreatePullRequestApprovalRuleResponse
newCreatePullRequestApprovalRuleResponse
  Int
pHttpStatus_
  ApprovalRule
pApprovalRule_ =
    CreatePullRequestApprovalRuleResponse' :: Int -> ApprovalRule -> CreatePullRequestApprovalRuleResponse
CreatePullRequestApprovalRuleResponse'
      { $sel:httpStatus:CreatePullRequestApprovalRuleResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:approvalRule:CreatePullRequestApprovalRuleResponse' :: ApprovalRule
approvalRule = ApprovalRule
pApprovalRule_
      }

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

-- | Information about the created approval rule.
createPullRequestApprovalRuleResponse_approvalRule :: Lens.Lens' CreatePullRequestApprovalRuleResponse ApprovalRule
createPullRequestApprovalRuleResponse_approvalRule :: (ApprovalRule -> f ApprovalRule)
-> CreatePullRequestApprovalRuleResponse
-> f CreatePullRequestApprovalRuleResponse
createPullRequestApprovalRuleResponse_approvalRule = (CreatePullRequestApprovalRuleResponse -> ApprovalRule)
-> (CreatePullRequestApprovalRuleResponse
    -> ApprovalRule -> CreatePullRequestApprovalRuleResponse)
-> Lens
     CreatePullRequestApprovalRuleResponse
     CreatePullRequestApprovalRuleResponse
     ApprovalRule
     ApprovalRule
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePullRequestApprovalRuleResponse' {ApprovalRule
approvalRule :: ApprovalRule
$sel:approvalRule:CreatePullRequestApprovalRuleResponse' :: CreatePullRequestApprovalRuleResponse -> ApprovalRule
approvalRule} -> ApprovalRule
approvalRule) (\s :: CreatePullRequestApprovalRuleResponse
s@CreatePullRequestApprovalRuleResponse' {} ApprovalRule
a -> CreatePullRequestApprovalRuleResponse
s {$sel:approvalRule:CreatePullRequestApprovalRuleResponse' :: ApprovalRule
approvalRule = ApprovalRule
a} :: CreatePullRequestApprovalRuleResponse)

instance
  Prelude.NFData
    CreatePullRequestApprovalRuleResponse