{-# 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.CreateApprovalRuleTemplate
-- 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 a template for approval rules that can then be associated with
-- one or more repositories in your AWS account. When you associate a
-- template with a repository, AWS CodeCommit creates an approval rule that
-- matches the conditions of the template for all pull requests that meet
-- the conditions of the template. For more information, see
-- AssociateApprovalRuleTemplateWithRepository.
module Amazonka.CodeCommit.CreateApprovalRuleTemplate
  ( -- * Creating a Request
    CreateApprovalRuleTemplate (..),
    newCreateApprovalRuleTemplate,

    -- * Request Lenses
    createApprovalRuleTemplate_approvalRuleTemplateDescription,
    createApprovalRuleTemplate_approvalRuleTemplateName,
    createApprovalRuleTemplate_approvalRuleTemplateContent,

    -- * Destructuring the Response
    CreateApprovalRuleTemplateResponse (..),
    newCreateApprovalRuleTemplateResponse,

    -- * Response Lenses
    createApprovalRuleTemplateResponse_httpStatus,
    createApprovalRuleTemplateResponse_approvalRuleTemplate,
  )
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:/ 'newCreateApprovalRuleTemplate' smart constructor.
data CreateApprovalRuleTemplate = CreateApprovalRuleTemplate'
  { -- | The description of the approval rule template. Consider providing a
    -- description that explains what this template does and when it might be
    -- appropriate to associate it with repositories.
    CreateApprovalRuleTemplate -> Maybe Text
approvalRuleTemplateDescription :: Prelude.Maybe Prelude.Text,
    -- | The name of the approval rule template. Provide descriptive names,
    -- because this name is applied to the approval rules created automatically
    -- in associated repositories.
    CreateApprovalRuleTemplate -> Text
approvalRuleTemplateName :: Prelude.Text,
    -- | The content of the approval rule that is created on pull requests in
    -- associated repositories. If you specify one or more destination
    -- references (branches), approval rules are created in an associated
    -- repository only if their destination references (branches) match those
    -- specified in the template.
    --
    -- When you create the content of the approval rule template, 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 are 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/.
    CreateApprovalRuleTemplate -> Text
approvalRuleTemplateContent :: Prelude.Text
  }
  deriving (CreateApprovalRuleTemplate -> CreateApprovalRuleTemplate -> Bool
(CreateApprovalRuleTemplate -> CreateApprovalRuleTemplate -> Bool)
-> (CreateApprovalRuleTemplate
    -> CreateApprovalRuleTemplate -> Bool)
-> Eq CreateApprovalRuleTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApprovalRuleTemplate -> CreateApprovalRuleTemplate -> Bool
$c/= :: CreateApprovalRuleTemplate -> CreateApprovalRuleTemplate -> Bool
== :: CreateApprovalRuleTemplate -> CreateApprovalRuleTemplate -> Bool
$c== :: CreateApprovalRuleTemplate -> CreateApprovalRuleTemplate -> Bool
Prelude.Eq, ReadPrec [CreateApprovalRuleTemplate]
ReadPrec CreateApprovalRuleTemplate
Int -> ReadS CreateApprovalRuleTemplate
ReadS [CreateApprovalRuleTemplate]
(Int -> ReadS CreateApprovalRuleTemplate)
-> ReadS [CreateApprovalRuleTemplate]
-> ReadPrec CreateApprovalRuleTemplate
-> ReadPrec [CreateApprovalRuleTemplate]
-> Read CreateApprovalRuleTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApprovalRuleTemplate]
$creadListPrec :: ReadPrec [CreateApprovalRuleTemplate]
readPrec :: ReadPrec CreateApprovalRuleTemplate
$creadPrec :: ReadPrec CreateApprovalRuleTemplate
readList :: ReadS [CreateApprovalRuleTemplate]
$creadList :: ReadS [CreateApprovalRuleTemplate]
readsPrec :: Int -> ReadS CreateApprovalRuleTemplate
$creadsPrec :: Int -> ReadS CreateApprovalRuleTemplate
Prelude.Read, Int -> CreateApprovalRuleTemplate -> ShowS
[CreateApprovalRuleTemplate] -> ShowS
CreateApprovalRuleTemplate -> String
(Int -> CreateApprovalRuleTemplate -> ShowS)
-> (CreateApprovalRuleTemplate -> String)
-> ([CreateApprovalRuleTemplate] -> ShowS)
-> Show CreateApprovalRuleTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApprovalRuleTemplate] -> ShowS
$cshowList :: [CreateApprovalRuleTemplate] -> ShowS
show :: CreateApprovalRuleTemplate -> String
$cshow :: CreateApprovalRuleTemplate -> String
showsPrec :: Int -> CreateApprovalRuleTemplate -> ShowS
$cshowsPrec :: Int -> CreateApprovalRuleTemplate -> ShowS
Prelude.Show, (forall x.
 CreateApprovalRuleTemplate -> Rep CreateApprovalRuleTemplate x)
-> (forall x.
    Rep CreateApprovalRuleTemplate x -> CreateApprovalRuleTemplate)
-> Generic CreateApprovalRuleTemplate
forall x.
Rep CreateApprovalRuleTemplate x -> CreateApprovalRuleTemplate
forall x.
CreateApprovalRuleTemplate -> Rep CreateApprovalRuleTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateApprovalRuleTemplate x -> CreateApprovalRuleTemplate
$cfrom :: forall x.
CreateApprovalRuleTemplate -> Rep CreateApprovalRuleTemplate x
Prelude.Generic)

-- |
-- Create a value of 'CreateApprovalRuleTemplate' 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:
--
-- 'approvalRuleTemplateDescription', 'createApprovalRuleTemplate_approvalRuleTemplateDescription' - The description of the approval rule template. Consider providing a
-- description that explains what this template does and when it might be
-- appropriate to associate it with repositories.
--
-- 'approvalRuleTemplateName', 'createApprovalRuleTemplate_approvalRuleTemplateName' - The name of the approval rule template. Provide descriptive names,
-- because this name is applied to the approval rules created automatically
-- in associated repositories.
--
-- 'approvalRuleTemplateContent', 'createApprovalRuleTemplate_approvalRuleTemplateContent' - The content of the approval rule that is created on pull requests in
-- associated repositories. If you specify one or more destination
-- references (branches), approval rules are created in an associated
-- repository only if their destination references (branches) match those
-- specified in the template.
--
-- When you create the content of the approval rule template, 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 are 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/.
newCreateApprovalRuleTemplate ::
  -- | 'approvalRuleTemplateName'
  Prelude.Text ->
  -- | 'approvalRuleTemplateContent'
  Prelude.Text ->
  CreateApprovalRuleTemplate
newCreateApprovalRuleTemplate :: Text -> Text -> CreateApprovalRuleTemplate
newCreateApprovalRuleTemplate
  Text
pApprovalRuleTemplateName_
  Text
pApprovalRuleTemplateContent_ =
    CreateApprovalRuleTemplate' :: Maybe Text -> Text -> Text -> CreateApprovalRuleTemplate
CreateApprovalRuleTemplate'
      { $sel:approvalRuleTemplateDescription:CreateApprovalRuleTemplate' :: Maybe Text
approvalRuleTemplateDescription =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:approvalRuleTemplateName:CreateApprovalRuleTemplate' :: Text
approvalRuleTemplateName =
          Text
pApprovalRuleTemplateName_,
        $sel:approvalRuleTemplateContent:CreateApprovalRuleTemplate' :: Text
approvalRuleTemplateContent =
          Text
pApprovalRuleTemplateContent_
      }

-- | The description of the approval rule template. Consider providing a
-- description that explains what this template does and when it might be
-- appropriate to associate it with repositories.
createApprovalRuleTemplate_approvalRuleTemplateDescription :: Lens.Lens' CreateApprovalRuleTemplate (Prelude.Maybe Prelude.Text)
createApprovalRuleTemplate_approvalRuleTemplateDescription :: (Maybe Text -> f (Maybe Text))
-> CreateApprovalRuleTemplate -> f CreateApprovalRuleTemplate
createApprovalRuleTemplate_approvalRuleTemplateDescription = (CreateApprovalRuleTemplate -> Maybe Text)
-> (CreateApprovalRuleTemplate
    -> Maybe Text -> CreateApprovalRuleTemplate)
-> Lens
     CreateApprovalRuleTemplate
     CreateApprovalRuleTemplate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApprovalRuleTemplate' {Maybe Text
approvalRuleTemplateDescription :: Maybe Text
$sel:approvalRuleTemplateDescription:CreateApprovalRuleTemplate' :: CreateApprovalRuleTemplate -> Maybe Text
approvalRuleTemplateDescription} -> Maybe Text
approvalRuleTemplateDescription) (\s :: CreateApprovalRuleTemplate
s@CreateApprovalRuleTemplate' {} Maybe Text
a -> CreateApprovalRuleTemplate
s {$sel:approvalRuleTemplateDescription:CreateApprovalRuleTemplate' :: Maybe Text
approvalRuleTemplateDescription = Maybe Text
a} :: CreateApprovalRuleTemplate)

-- | The name of the approval rule template. Provide descriptive names,
-- because this name is applied to the approval rules created automatically
-- in associated repositories.
createApprovalRuleTemplate_approvalRuleTemplateName :: Lens.Lens' CreateApprovalRuleTemplate Prelude.Text
createApprovalRuleTemplate_approvalRuleTemplateName :: (Text -> f Text)
-> CreateApprovalRuleTemplate -> f CreateApprovalRuleTemplate
createApprovalRuleTemplate_approvalRuleTemplateName = (CreateApprovalRuleTemplate -> Text)
-> (CreateApprovalRuleTemplate
    -> Text -> CreateApprovalRuleTemplate)
-> Lens
     CreateApprovalRuleTemplate CreateApprovalRuleTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApprovalRuleTemplate' {Text
approvalRuleTemplateName :: Text
$sel:approvalRuleTemplateName:CreateApprovalRuleTemplate' :: CreateApprovalRuleTemplate -> Text
approvalRuleTemplateName} -> Text
approvalRuleTemplateName) (\s :: CreateApprovalRuleTemplate
s@CreateApprovalRuleTemplate' {} Text
a -> CreateApprovalRuleTemplate
s {$sel:approvalRuleTemplateName:CreateApprovalRuleTemplate' :: Text
approvalRuleTemplateName = Text
a} :: CreateApprovalRuleTemplate)

-- | The content of the approval rule that is created on pull requests in
-- associated repositories. If you specify one or more destination
-- references (branches), approval rules are created in an associated
-- repository only if their destination references (branches) match those
-- specified in the template.
--
-- When you create the content of the approval rule template, 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 are 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/.
createApprovalRuleTemplate_approvalRuleTemplateContent :: Lens.Lens' CreateApprovalRuleTemplate Prelude.Text
createApprovalRuleTemplate_approvalRuleTemplateContent :: (Text -> f Text)
-> CreateApprovalRuleTemplate -> f CreateApprovalRuleTemplate
createApprovalRuleTemplate_approvalRuleTemplateContent = (CreateApprovalRuleTemplate -> Text)
-> (CreateApprovalRuleTemplate
    -> Text -> CreateApprovalRuleTemplate)
-> Lens
     CreateApprovalRuleTemplate CreateApprovalRuleTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApprovalRuleTemplate' {Text
approvalRuleTemplateContent :: Text
$sel:approvalRuleTemplateContent:CreateApprovalRuleTemplate' :: CreateApprovalRuleTemplate -> Text
approvalRuleTemplateContent} -> Text
approvalRuleTemplateContent) (\s :: CreateApprovalRuleTemplate
s@CreateApprovalRuleTemplate' {} Text
a -> CreateApprovalRuleTemplate
s {$sel:approvalRuleTemplateContent:CreateApprovalRuleTemplate' :: Text
approvalRuleTemplateContent = Text
a} :: CreateApprovalRuleTemplate)

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

instance Prelude.Hashable CreateApprovalRuleTemplate

instance Prelude.NFData CreateApprovalRuleTemplate

instance Core.ToHeaders CreateApprovalRuleTemplate where
  toHeaders :: CreateApprovalRuleTemplate -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateApprovalRuleTemplate -> 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.CreateApprovalRuleTemplate" ::
                          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 CreateApprovalRuleTemplate where
  toJSON :: CreateApprovalRuleTemplate -> Value
toJSON CreateApprovalRuleTemplate' {Maybe Text
Text
approvalRuleTemplateContent :: Text
approvalRuleTemplateName :: Text
approvalRuleTemplateDescription :: Maybe Text
$sel:approvalRuleTemplateContent:CreateApprovalRuleTemplate' :: CreateApprovalRuleTemplate -> Text
$sel:approvalRuleTemplateName:CreateApprovalRuleTemplate' :: CreateApprovalRuleTemplate -> Text
$sel:approvalRuleTemplateDescription:CreateApprovalRuleTemplate' :: CreateApprovalRuleTemplate -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"approvalRuleTemplateDescription" 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
approvalRuleTemplateDescription,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"approvalRuleTemplateName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
approvalRuleTemplateName
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"approvalRuleTemplateContent"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
approvalRuleTemplateContent
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateApprovalRuleTemplateResponse' 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', 'createApprovalRuleTemplateResponse_httpStatus' - The response's http status code.
--
-- 'approvalRuleTemplate', 'createApprovalRuleTemplateResponse_approvalRuleTemplate' - The content and structure of the created approval rule template.
newCreateApprovalRuleTemplateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'approvalRuleTemplate'
  ApprovalRuleTemplate ->
  CreateApprovalRuleTemplateResponse
newCreateApprovalRuleTemplateResponse :: Int -> ApprovalRuleTemplate -> CreateApprovalRuleTemplateResponse
newCreateApprovalRuleTemplateResponse
  Int
pHttpStatus_
  ApprovalRuleTemplate
pApprovalRuleTemplate_ =
    CreateApprovalRuleTemplateResponse' :: Int -> ApprovalRuleTemplate -> CreateApprovalRuleTemplateResponse
CreateApprovalRuleTemplateResponse'
      { $sel:httpStatus:CreateApprovalRuleTemplateResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:approvalRuleTemplate:CreateApprovalRuleTemplateResponse' :: ApprovalRuleTemplate
approvalRuleTemplate =
          ApprovalRuleTemplate
pApprovalRuleTemplate_
      }

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

-- | The content and structure of the created approval rule template.
createApprovalRuleTemplateResponse_approvalRuleTemplate :: Lens.Lens' CreateApprovalRuleTemplateResponse ApprovalRuleTemplate
createApprovalRuleTemplateResponse_approvalRuleTemplate :: (ApprovalRuleTemplate -> f ApprovalRuleTemplate)
-> CreateApprovalRuleTemplateResponse
-> f CreateApprovalRuleTemplateResponse
createApprovalRuleTemplateResponse_approvalRuleTemplate = (CreateApprovalRuleTemplateResponse -> ApprovalRuleTemplate)
-> (CreateApprovalRuleTemplateResponse
    -> ApprovalRuleTemplate -> CreateApprovalRuleTemplateResponse)
-> Lens
     CreateApprovalRuleTemplateResponse
     CreateApprovalRuleTemplateResponse
     ApprovalRuleTemplate
     ApprovalRuleTemplate
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApprovalRuleTemplateResponse' {ApprovalRuleTemplate
approvalRuleTemplate :: ApprovalRuleTemplate
$sel:approvalRuleTemplate:CreateApprovalRuleTemplateResponse' :: CreateApprovalRuleTemplateResponse -> ApprovalRuleTemplate
approvalRuleTemplate} -> ApprovalRuleTemplate
approvalRuleTemplate) (\s :: CreateApprovalRuleTemplateResponse
s@CreateApprovalRuleTemplateResponse' {} ApprovalRuleTemplate
a -> CreateApprovalRuleTemplateResponse
s {$sel:approvalRuleTemplate:CreateApprovalRuleTemplateResponse' :: ApprovalRuleTemplate
approvalRuleTemplate = ApprovalRuleTemplate
a} :: CreateApprovalRuleTemplateResponse)

instance
  Prelude.NFData
    CreateApprovalRuleTemplateResponse