{-# 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.CodePipeline.Types.StopExecutionTrigger
-- 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.CodePipeline.Types.StopExecutionTrigger where

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

-- | The interaction that stopped a pipeline execution.
--
-- /See:/ 'newStopExecutionTrigger' smart constructor.
data StopExecutionTrigger = StopExecutionTrigger'
  { -- | The user-specified reason the pipeline was stopped.
    StopExecutionTrigger -> Maybe Text
reason :: Prelude.Maybe Prelude.Text
  }
  deriving (StopExecutionTrigger -> StopExecutionTrigger -> Bool
(StopExecutionTrigger -> StopExecutionTrigger -> Bool)
-> (StopExecutionTrigger -> StopExecutionTrigger -> Bool)
-> Eq StopExecutionTrigger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopExecutionTrigger -> StopExecutionTrigger -> Bool
$c/= :: StopExecutionTrigger -> StopExecutionTrigger -> Bool
== :: StopExecutionTrigger -> StopExecutionTrigger -> Bool
$c== :: StopExecutionTrigger -> StopExecutionTrigger -> Bool
Prelude.Eq, ReadPrec [StopExecutionTrigger]
ReadPrec StopExecutionTrigger
Int -> ReadS StopExecutionTrigger
ReadS [StopExecutionTrigger]
(Int -> ReadS StopExecutionTrigger)
-> ReadS [StopExecutionTrigger]
-> ReadPrec StopExecutionTrigger
-> ReadPrec [StopExecutionTrigger]
-> Read StopExecutionTrigger
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopExecutionTrigger]
$creadListPrec :: ReadPrec [StopExecutionTrigger]
readPrec :: ReadPrec StopExecutionTrigger
$creadPrec :: ReadPrec StopExecutionTrigger
readList :: ReadS [StopExecutionTrigger]
$creadList :: ReadS [StopExecutionTrigger]
readsPrec :: Int -> ReadS StopExecutionTrigger
$creadsPrec :: Int -> ReadS StopExecutionTrigger
Prelude.Read, Int -> StopExecutionTrigger -> ShowS
[StopExecutionTrigger] -> ShowS
StopExecutionTrigger -> String
(Int -> StopExecutionTrigger -> ShowS)
-> (StopExecutionTrigger -> String)
-> ([StopExecutionTrigger] -> ShowS)
-> Show StopExecutionTrigger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopExecutionTrigger] -> ShowS
$cshowList :: [StopExecutionTrigger] -> ShowS
show :: StopExecutionTrigger -> String
$cshow :: StopExecutionTrigger -> String
showsPrec :: Int -> StopExecutionTrigger -> ShowS
$cshowsPrec :: Int -> StopExecutionTrigger -> ShowS
Prelude.Show, (forall x. StopExecutionTrigger -> Rep StopExecutionTrigger x)
-> (forall x. Rep StopExecutionTrigger x -> StopExecutionTrigger)
-> Generic StopExecutionTrigger
forall x. Rep StopExecutionTrigger x -> StopExecutionTrigger
forall x. StopExecutionTrigger -> Rep StopExecutionTrigger x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopExecutionTrigger x -> StopExecutionTrigger
$cfrom :: forall x. StopExecutionTrigger -> Rep StopExecutionTrigger x
Prelude.Generic)

-- |
-- Create a value of 'StopExecutionTrigger' 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:
--
-- 'reason', 'stopExecutionTrigger_reason' - The user-specified reason the pipeline was stopped.
newStopExecutionTrigger ::
  StopExecutionTrigger
newStopExecutionTrigger :: StopExecutionTrigger
newStopExecutionTrigger =
  StopExecutionTrigger' :: Maybe Text -> StopExecutionTrigger
StopExecutionTrigger' {$sel:reason:StopExecutionTrigger' :: Maybe Text
reason = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The user-specified reason the pipeline was stopped.
stopExecutionTrigger_reason :: Lens.Lens' StopExecutionTrigger (Prelude.Maybe Prelude.Text)
stopExecutionTrigger_reason :: (Maybe Text -> f (Maybe Text))
-> StopExecutionTrigger -> f StopExecutionTrigger
stopExecutionTrigger_reason = (StopExecutionTrigger -> Maybe Text)
-> (StopExecutionTrigger -> Maybe Text -> StopExecutionTrigger)
-> Lens
     StopExecutionTrigger StopExecutionTrigger (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopExecutionTrigger' {Maybe Text
reason :: Maybe Text
$sel:reason:StopExecutionTrigger' :: StopExecutionTrigger -> Maybe Text
reason} -> Maybe Text
reason) (\s :: StopExecutionTrigger
s@StopExecutionTrigger' {} Maybe Text
a -> StopExecutionTrigger
s {$sel:reason:StopExecutionTrigger' :: Maybe Text
reason = Maybe Text
a} :: StopExecutionTrigger)

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

instance Prelude.Hashable StopExecutionTrigger

instance Prelude.NFData StopExecutionTrigger