{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.ApprovalRuleEventMetadata
-- 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)
module Amazonka.CodeCommit.Types.ApprovalRuleEventMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns information about an event for an approval rule.
--
-- /See:/ 'newApprovalRuleEventMetadata' smart constructor.
data ApprovalRuleEventMetadata = ApprovalRuleEventMetadata'
  { -- | The name of the approval rule.
    ApprovalRuleEventMetadata -> Maybe Text
approvalRuleName :: Prelude.Maybe Prelude.Text,
    -- | The system-generated ID of the approval rule.
    ApprovalRuleEventMetadata -> Maybe Text
approvalRuleId :: Prelude.Maybe Prelude.Text,
    -- | The content of the approval rule.
    ApprovalRuleEventMetadata -> Maybe Text
approvalRuleContent :: Prelude.Maybe Prelude.Text
  }
  deriving (ApprovalRuleEventMetadata -> ApprovalRuleEventMetadata -> Bool
(ApprovalRuleEventMetadata -> ApprovalRuleEventMetadata -> Bool)
-> (ApprovalRuleEventMetadata -> ApprovalRuleEventMetadata -> Bool)
-> Eq ApprovalRuleEventMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApprovalRuleEventMetadata -> ApprovalRuleEventMetadata -> Bool
$c/= :: ApprovalRuleEventMetadata -> ApprovalRuleEventMetadata -> Bool
== :: ApprovalRuleEventMetadata -> ApprovalRuleEventMetadata -> Bool
$c== :: ApprovalRuleEventMetadata -> ApprovalRuleEventMetadata -> Bool
Prelude.Eq, ReadPrec [ApprovalRuleEventMetadata]
ReadPrec ApprovalRuleEventMetadata
Int -> ReadS ApprovalRuleEventMetadata
ReadS [ApprovalRuleEventMetadata]
(Int -> ReadS ApprovalRuleEventMetadata)
-> ReadS [ApprovalRuleEventMetadata]
-> ReadPrec ApprovalRuleEventMetadata
-> ReadPrec [ApprovalRuleEventMetadata]
-> Read ApprovalRuleEventMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApprovalRuleEventMetadata]
$creadListPrec :: ReadPrec [ApprovalRuleEventMetadata]
readPrec :: ReadPrec ApprovalRuleEventMetadata
$creadPrec :: ReadPrec ApprovalRuleEventMetadata
readList :: ReadS [ApprovalRuleEventMetadata]
$creadList :: ReadS [ApprovalRuleEventMetadata]
readsPrec :: Int -> ReadS ApprovalRuleEventMetadata
$creadsPrec :: Int -> ReadS ApprovalRuleEventMetadata
Prelude.Read, Int -> ApprovalRuleEventMetadata -> ShowS
[ApprovalRuleEventMetadata] -> ShowS
ApprovalRuleEventMetadata -> String
(Int -> ApprovalRuleEventMetadata -> ShowS)
-> (ApprovalRuleEventMetadata -> String)
-> ([ApprovalRuleEventMetadata] -> ShowS)
-> Show ApprovalRuleEventMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApprovalRuleEventMetadata] -> ShowS
$cshowList :: [ApprovalRuleEventMetadata] -> ShowS
show :: ApprovalRuleEventMetadata -> String
$cshow :: ApprovalRuleEventMetadata -> String
showsPrec :: Int -> ApprovalRuleEventMetadata -> ShowS
$cshowsPrec :: Int -> ApprovalRuleEventMetadata -> ShowS
Prelude.Show, (forall x.
 ApprovalRuleEventMetadata -> Rep ApprovalRuleEventMetadata x)
-> (forall x.
    Rep ApprovalRuleEventMetadata x -> ApprovalRuleEventMetadata)
-> Generic ApprovalRuleEventMetadata
forall x.
Rep ApprovalRuleEventMetadata x -> ApprovalRuleEventMetadata
forall x.
ApprovalRuleEventMetadata -> Rep ApprovalRuleEventMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ApprovalRuleEventMetadata x -> ApprovalRuleEventMetadata
$cfrom :: forall x.
ApprovalRuleEventMetadata -> Rep ApprovalRuleEventMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ApprovalRuleEventMetadata' 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:
--
-- 'approvalRuleName', 'approvalRuleEventMetadata_approvalRuleName' - The name of the approval rule.
--
-- 'approvalRuleId', 'approvalRuleEventMetadata_approvalRuleId' - The system-generated ID of the approval rule.
--
-- 'approvalRuleContent', 'approvalRuleEventMetadata_approvalRuleContent' - The content of the approval rule.
newApprovalRuleEventMetadata ::
  ApprovalRuleEventMetadata
newApprovalRuleEventMetadata :: ApprovalRuleEventMetadata
newApprovalRuleEventMetadata =
  ApprovalRuleEventMetadata' :: Maybe Text -> Maybe Text -> Maybe Text -> ApprovalRuleEventMetadata
ApprovalRuleEventMetadata'
    { $sel:approvalRuleName:ApprovalRuleEventMetadata' :: Maybe Text
approvalRuleName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:approvalRuleId:ApprovalRuleEventMetadata' :: Maybe Text
approvalRuleId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:approvalRuleContent:ApprovalRuleEventMetadata' :: Maybe Text
approvalRuleContent = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The system-generated ID of the approval rule.
approvalRuleEventMetadata_approvalRuleId :: Lens.Lens' ApprovalRuleEventMetadata (Prelude.Maybe Prelude.Text)
approvalRuleEventMetadata_approvalRuleId :: (Maybe Text -> f (Maybe Text))
-> ApprovalRuleEventMetadata -> f ApprovalRuleEventMetadata
approvalRuleEventMetadata_approvalRuleId = (ApprovalRuleEventMetadata -> Maybe Text)
-> (ApprovalRuleEventMetadata
    -> Maybe Text -> ApprovalRuleEventMetadata)
-> Lens
     ApprovalRuleEventMetadata
     ApprovalRuleEventMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApprovalRuleEventMetadata' {Maybe Text
approvalRuleId :: Maybe Text
$sel:approvalRuleId:ApprovalRuleEventMetadata' :: ApprovalRuleEventMetadata -> Maybe Text
approvalRuleId} -> Maybe Text
approvalRuleId) (\s :: ApprovalRuleEventMetadata
s@ApprovalRuleEventMetadata' {} Maybe Text
a -> ApprovalRuleEventMetadata
s {$sel:approvalRuleId:ApprovalRuleEventMetadata' :: Maybe Text
approvalRuleId = Maybe Text
a} :: ApprovalRuleEventMetadata)

-- | The content of the approval rule.
approvalRuleEventMetadata_approvalRuleContent :: Lens.Lens' ApprovalRuleEventMetadata (Prelude.Maybe Prelude.Text)
approvalRuleEventMetadata_approvalRuleContent :: (Maybe Text -> f (Maybe Text))
-> ApprovalRuleEventMetadata -> f ApprovalRuleEventMetadata
approvalRuleEventMetadata_approvalRuleContent = (ApprovalRuleEventMetadata -> Maybe Text)
-> (ApprovalRuleEventMetadata
    -> Maybe Text -> ApprovalRuleEventMetadata)
-> Lens
     ApprovalRuleEventMetadata
     ApprovalRuleEventMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApprovalRuleEventMetadata' {Maybe Text
approvalRuleContent :: Maybe Text
$sel:approvalRuleContent:ApprovalRuleEventMetadata' :: ApprovalRuleEventMetadata -> Maybe Text
approvalRuleContent} -> Maybe Text
approvalRuleContent) (\s :: ApprovalRuleEventMetadata
s@ApprovalRuleEventMetadata' {} Maybe Text
a -> ApprovalRuleEventMetadata
s {$sel:approvalRuleContent:ApprovalRuleEventMetadata' :: Maybe Text
approvalRuleContent = Maybe Text
a} :: ApprovalRuleEventMetadata)

instance Core.FromJSON ApprovalRuleEventMetadata where
  parseJSON :: Value -> Parser ApprovalRuleEventMetadata
parseJSON =
    String
-> (Object -> Parser ApprovalRuleEventMetadata)
-> Value
-> Parser ApprovalRuleEventMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ApprovalRuleEventMetadata"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> ApprovalRuleEventMetadata
ApprovalRuleEventMetadata'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> ApprovalRuleEventMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ApprovalRuleEventMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"approvalRuleName")
            Parser (Maybe Text -> Maybe Text -> ApprovalRuleEventMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ApprovalRuleEventMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"approvalRuleId")
            Parser (Maybe Text -> ApprovalRuleEventMetadata)
-> Parser (Maybe Text) -> Parser ApprovalRuleEventMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"approvalRuleContent")
      )

instance Prelude.Hashable ApprovalRuleEventMetadata

instance Prelude.NFData ApprovalRuleEventMetadata