{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CodePipeline.Types.StopExecutionTrigger where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:reason:StopExecutionTrigger' :: Maybe Text
reason = 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 :: Lens' StopExecutionTrigger (Maybe Text)
stopExecutionTrigger_reason = 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 Data.FromJSON StopExecutionTrigger where
  parseJSON :: Value -> Parser StopExecutionTrigger
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StopExecutionTrigger"
      ( \Object
x ->
          Maybe Text -> StopExecutionTrigger
StopExecutionTrigger'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"reason")
      )

instance Prelude.Hashable StopExecutionTrigger where
  hashWithSalt :: Int -> StopExecutionTrigger -> Int
hashWithSalt Int
_salt StopExecutionTrigger' {Maybe Text
reason :: Maybe Text
$sel:reason:StopExecutionTrigger' :: StopExecutionTrigger -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reason

instance Prelude.NFData StopExecutionTrigger where
  rnf :: StopExecutionTrigger -> ()
rnf StopExecutionTrigger' {Maybe Text
reason :: Maybe Text
$sel:reason:StopExecutionTrigger' :: StopExecutionTrigger -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reason