{-# 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.RepositoryTriggerExecutionFailure
-- 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.RepositoryTriggerExecutionFailure where

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

-- | A trigger failed to run.
--
-- /See:/ 'newRepositoryTriggerExecutionFailure' smart constructor.
data RepositoryTriggerExecutionFailure = RepositoryTriggerExecutionFailure'
  { -- | Message information about the trigger that did not run.
    RepositoryTriggerExecutionFailure -> Maybe Text
failureMessage :: Prelude.Maybe Prelude.Text,
    -- | The name of the trigger that did not run.
    RepositoryTriggerExecutionFailure -> Maybe Text
trigger :: Prelude.Maybe Prelude.Text
  }
  deriving (RepositoryTriggerExecutionFailure
-> RepositoryTriggerExecutionFailure -> Bool
(RepositoryTriggerExecutionFailure
 -> RepositoryTriggerExecutionFailure -> Bool)
-> (RepositoryTriggerExecutionFailure
    -> RepositoryTriggerExecutionFailure -> Bool)
-> Eq RepositoryTriggerExecutionFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepositoryTriggerExecutionFailure
-> RepositoryTriggerExecutionFailure -> Bool
$c/= :: RepositoryTriggerExecutionFailure
-> RepositoryTriggerExecutionFailure -> Bool
== :: RepositoryTriggerExecutionFailure
-> RepositoryTriggerExecutionFailure -> Bool
$c== :: RepositoryTriggerExecutionFailure
-> RepositoryTriggerExecutionFailure -> Bool
Prelude.Eq, ReadPrec [RepositoryTriggerExecutionFailure]
ReadPrec RepositoryTriggerExecutionFailure
Int -> ReadS RepositoryTriggerExecutionFailure
ReadS [RepositoryTriggerExecutionFailure]
(Int -> ReadS RepositoryTriggerExecutionFailure)
-> ReadS [RepositoryTriggerExecutionFailure]
-> ReadPrec RepositoryTriggerExecutionFailure
-> ReadPrec [RepositoryTriggerExecutionFailure]
-> Read RepositoryTriggerExecutionFailure
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RepositoryTriggerExecutionFailure]
$creadListPrec :: ReadPrec [RepositoryTriggerExecutionFailure]
readPrec :: ReadPrec RepositoryTriggerExecutionFailure
$creadPrec :: ReadPrec RepositoryTriggerExecutionFailure
readList :: ReadS [RepositoryTriggerExecutionFailure]
$creadList :: ReadS [RepositoryTriggerExecutionFailure]
readsPrec :: Int -> ReadS RepositoryTriggerExecutionFailure
$creadsPrec :: Int -> ReadS RepositoryTriggerExecutionFailure
Prelude.Read, Int -> RepositoryTriggerExecutionFailure -> ShowS
[RepositoryTriggerExecutionFailure] -> ShowS
RepositoryTriggerExecutionFailure -> String
(Int -> RepositoryTriggerExecutionFailure -> ShowS)
-> (RepositoryTriggerExecutionFailure -> String)
-> ([RepositoryTriggerExecutionFailure] -> ShowS)
-> Show RepositoryTriggerExecutionFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RepositoryTriggerExecutionFailure] -> ShowS
$cshowList :: [RepositoryTriggerExecutionFailure] -> ShowS
show :: RepositoryTriggerExecutionFailure -> String
$cshow :: RepositoryTriggerExecutionFailure -> String
showsPrec :: Int -> RepositoryTriggerExecutionFailure -> ShowS
$cshowsPrec :: Int -> RepositoryTriggerExecutionFailure -> ShowS
Prelude.Show, (forall x.
 RepositoryTriggerExecutionFailure
 -> Rep RepositoryTriggerExecutionFailure x)
-> (forall x.
    Rep RepositoryTriggerExecutionFailure x
    -> RepositoryTriggerExecutionFailure)
-> Generic RepositoryTriggerExecutionFailure
forall x.
Rep RepositoryTriggerExecutionFailure x
-> RepositoryTriggerExecutionFailure
forall x.
RepositoryTriggerExecutionFailure
-> Rep RepositoryTriggerExecutionFailure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RepositoryTriggerExecutionFailure x
-> RepositoryTriggerExecutionFailure
$cfrom :: forall x.
RepositoryTriggerExecutionFailure
-> Rep RepositoryTriggerExecutionFailure x
Prelude.Generic)

-- |
-- Create a value of 'RepositoryTriggerExecutionFailure' 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:
--
-- 'failureMessage', 'repositoryTriggerExecutionFailure_failureMessage' - Message information about the trigger that did not run.
--
-- 'trigger', 'repositoryTriggerExecutionFailure_trigger' - The name of the trigger that did not run.
newRepositoryTriggerExecutionFailure ::
  RepositoryTriggerExecutionFailure
newRepositoryTriggerExecutionFailure :: RepositoryTriggerExecutionFailure
newRepositoryTriggerExecutionFailure =
  RepositoryTriggerExecutionFailure' :: Maybe Text -> Maybe Text -> RepositoryTriggerExecutionFailure
RepositoryTriggerExecutionFailure'
    { $sel:failureMessage:RepositoryTriggerExecutionFailure' :: Maybe Text
failureMessage =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:trigger:RepositoryTriggerExecutionFailure' :: Maybe Text
trigger = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Message information about the trigger that did not run.
repositoryTriggerExecutionFailure_failureMessage :: Lens.Lens' RepositoryTriggerExecutionFailure (Prelude.Maybe Prelude.Text)
repositoryTriggerExecutionFailure_failureMessage :: (Maybe Text -> f (Maybe Text))
-> RepositoryTriggerExecutionFailure
-> f RepositoryTriggerExecutionFailure
repositoryTriggerExecutionFailure_failureMessage = (RepositoryTriggerExecutionFailure -> Maybe Text)
-> (RepositoryTriggerExecutionFailure
    -> Maybe Text -> RepositoryTriggerExecutionFailure)
-> Lens
     RepositoryTriggerExecutionFailure
     RepositoryTriggerExecutionFailure
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryTriggerExecutionFailure' {Maybe Text
failureMessage :: Maybe Text
$sel:failureMessage:RepositoryTriggerExecutionFailure' :: RepositoryTriggerExecutionFailure -> Maybe Text
failureMessage} -> Maybe Text
failureMessage) (\s :: RepositoryTriggerExecutionFailure
s@RepositoryTriggerExecutionFailure' {} Maybe Text
a -> RepositoryTriggerExecutionFailure
s {$sel:failureMessage:RepositoryTriggerExecutionFailure' :: Maybe Text
failureMessage = Maybe Text
a} :: RepositoryTriggerExecutionFailure)

-- | The name of the trigger that did not run.
repositoryTriggerExecutionFailure_trigger :: Lens.Lens' RepositoryTriggerExecutionFailure (Prelude.Maybe Prelude.Text)
repositoryTriggerExecutionFailure_trigger :: (Maybe Text -> f (Maybe Text))
-> RepositoryTriggerExecutionFailure
-> f RepositoryTriggerExecutionFailure
repositoryTriggerExecutionFailure_trigger = (RepositoryTriggerExecutionFailure -> Maybe Text)
-> (RepositoryTriggerExecutionFailure
    -> Maybe Text -> RepositoryTriggerExecutionFailure)
-> Lens
     RepositoryTriggerExecutionFailure
     RepositoryTriggerExecutionFailure
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryTriggerExecutionFailure' {Maybe Text
trigger :: Maybe Text
$sel:trigger:RepositoryTriggerExecutionFailure' :: RepositoryTriggerExecutionFailure -> Maybe Text
trigger} -> Maybe Text
trigger) (\s :: RepositoryTriggerExecutionFailure
s@RepositoryTriggerExecutionFailure' {} Maybe Text
a -> RepositoryTriggerExecutionFailure
s {$sel:trigger:RepositoryTriggerExecutionFailure' :: Maybe Text
trigger = Maybe Text
a} :: RepositoryTriggerExecutionFailure)

instance
  Core.FromJSON
    RepositoryTriggerExecutionFailure
  where
  parseJSON :: Value -> Parser RepositoryTriggerExecutionFailure
parseJSON =
    String
-> (Object -> Parser RepositoryTriggerExecutionFailure)
-> Value
-> Parser RepositoryTriggerExecutionFailure
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RepositoryTriggerExecutionFailure"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> RepositoryTriggerExecutionFailure
RepositoryTriggerExecutionFailure'
            (Maybe Text -> Maybe Text -> RepositoryTriggerExecutionFailure)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> RepositoryTriggerExecutionFailure)
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
"failureMessage")
            Parser (Maybe Text -> RepositoryTriggerExecutionFailure)
-> Parser (Maybe Text) -> Parser RepositoryTriggerExecutionFailure
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
"trigger")
      )

instance
  Prelude.Hashable
    RepositoryTriggerExecutionFailure

instance
  Prelude.NFData
    RepositoryTriggerExecutionFailure