{-# 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.FIS.Types.UpdateExperimentTemplateStopConditionInput
-- 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.FIS.Types.UpdateExperimentTemplateStopConditionInput where

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

-- | Specifies a stop condition for an experiment. You can define a stop
-- condition as a CloudWatch alarm.
--
-- /See:/ 'newUpdateExperimentTemplateStopConditionInput' smart constructor.
data UpdateExperimentTemplateStopConditionInput = UpdateExperimentTemplateStopConditionInput'
  { -- | The Amazon Resource Name (ARN) of the CloudWatch alarm.
    UpdateExperimentTemplateStopConditionInput -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The source for the stop condition. Specify @aws:cloudwatch:alarm@ if the
    -- stop condition is defined by a CloudWatch alarm. Specify @none@ if there
    -- is no stop condition.
    UpdateExperimentTemplateStopConditionInput -> Text
source :: Prelude.Text
  }
  deriving (UpdateExperimentTemplateStopConditionInput
-> UpdateExperimentTemplateStopConditionInput -> Bool
(UpdateExperimentTemplateStopConditionInput
 -> UpdateExperimentTemplateStopConditionInput -> Bool)
-> (UpdateExperimentTemplateStopConditionInput
    -> UpdateExperimentTemplateStopConditionInput -> Bool)
-> Eq UpdateExperimentTemplateStopConditionInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateExperimentTemplateStopConditionInput
-> UpdateExperimentTemplateStopConditionInput -> Bool
$c/= :: UpdateExperimentTemplateStopConditionInput
-> UpdateExperimentTemplateStopConditionInput -> Bool
== :: UpdateExperimentTemplateStopConditionInput
-> UpdateExperimentTemplateStopConditionInput -> Bool
$c== :: UpdateExperimentTemplateStopConditionInput
-> UpdateExperimentTemplateStopConditionInput -> Bool
Prelude.Eq, ReadPrec [UpdateExperimentTemplateStopConditionInput]
ReadPrec UpdateExperimentTemplateStopConditionInput
Int -> ReadS UpdateExperimentTemplateStopConditionInput
ReadS [UpdateExperimentTemplateStopConditionInput]
(Int -> ReadS UpdateExperimentTemplateStopConditionInput)
-> ReadS [UpdateExperimentTemplateStopConditionInput]
-> ReadPrec UpdateExperimentTemplateStopConditionInput
-> ReadPrec [UpdateExperimentTemplateStopConditionInput]
-> Read UpdateExperimentTemplateStopConditionInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateExperimentTemplateStopConditionInput]
$creadListPrec :: ReadPrec [UpdateExperimentTemplateStopConditionInput]
readPrec :: ReadPrec UpdateExperimentTemplateStopConditionInput
$creadPrec :: ReadPrec UpdateExperimentTemplateStopConditionInput
readList :: ReadS [UpdateExperimentTemplateStopConditionInput]
$creadList :: ReadS [UpdateExperimentTemplateStopConditionInput]
readsPrec :: Int -> ReadS UpdateExperimentTemplateStopConditionInput
$creadsPrec :: Int -> ReadS UpdateExperimentTemplateStopConditionInput
Prelude.Read, Int -> UpdateExperimentTemplateStopConditionInput -> ShowS
[UpdateExperimentTemplateStopConditionInput] -> ShowS
UpdateExperimentTemplateStopConditionInput -> String
(Int -> UpdateExperimentTemplateStopConditionInput -> ShowS)
-> (UpdateExperimentTemplateStopConditionInput -> String)
-> ([UpdateExperimentTemplateStopConditionInput] -> ShowS)
-> Show UpdateExperimentTemplateStopConditionInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateExperimentTemplateStopConditionInput] -> ShowS
$cshowList :: [UpdateExperimentTemplateStopConditionInput] -> ShowS
show :: UpdateExperimentTemplateStopConditionInput -> String
$cshow :: UpdateExperimentTemplateStopConditionInput -> String
showsPrec :: Int -> UpdateExperimentTemplateStopConditionInput -> ShowS
$cshowsPrec :: Int -> UpdateExperimentTemplateStopConditionInput -> ShowS
Prelude.Show, (forall x.
 UpdateExperimentTemplateStopConditionInput
 -> Rep UpdateExperimentTemplateStopConditionInput x)
-> (forall x.
    Rep UpdateExperimentTemplateStopConditionInput x
    -> UpdateExperimentTemplateStopConditionInput)
-> Generic UpdateExperimentTemplateStopConditionInput
forall x.
Rep UpdateExperimentTemplateStopConditionInput x
-> UpdateExperimentTemplateStopConditionInput
forall x.
UpdateExperimentTemplateStopConditionInput
-> Rep UpdateExperimentTemplateStopConditionInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateExperimentTemplateStopConditionInput x
-> UpdateExperimentTemplateStopConditionInput
$cfrom :: forall x.
UpdateExperimentTemplateStopConditionInput
-> Rep UpdateExperimentTemplateStopConditionInput x
Prelude.Generic)

-- |
-- Create a value of 'UpdateExperimentTemplateStopConditionInput' 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:
--
-- 'value', 'updateExperimentTemplateStopConditionInput_value' - The Amazon Resource Name (ARN) of the CloudWatch alarm.
--
-- 'source', 'updateExperimentTemplateStopConditionInput_source' - The source for the stop condition. Specify @aws:cloudwatch:alarm@ if the
-- stop condition is defined by a CloudWatch alarm. Specify @none@ if there
-- is no stop condition.
newUpdateExperimentTemplateStopConditionInput ::
  -- | 'source'
  Prelude.Text ->
  UpdateExperimentTemplateStopConditionInput
newUpdateExperimentTemplateStopConditionInput :: Text -> UpdateExperimentTemplateStopConditionInput
newUpdateExperimentTemplateStopConditionInput
  Text
pSource_ =
    UpdateExperimentTemplateStopConditionInput' :: Maybe Text -> Text -> UpdateExperimentTemplateStopConditionInput
UpdateExperimentTemplateStopConditionInput'
      { $sel:value:UpdateExperimentTemplateStopConditionInput' :: Maybe Text
value =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:source:UpdateExperimentTemplateStopConditionInput' :: Text
source = Text
pSource_
      }

-- | The Amazon Resource Name (ARN) of the CloudWatch alarm.
updateExperimentTemplateStopConditionInput_value :: Lens.Lens' UpdateExperimentTemplateStopConditionInput (Prelude.Maybe Prelude.Text)
updateExperimentTemplateStopConditionInput_value :: (Maybe Text -> f (Maybe Text))
-> UpdateExperimentTemplateStopConditionInput
-> f UpdateExperimentTemplateStopConditionInput
updateExperimentTemplateStopConditionInput_value = (UpdateExperimentTemplateStopConditionInput -> Maybe Text)
-> (UpdateExperimentTemplateStopConditionInput
    -> Maybe Text -> UpdateExperimentTemplateStopConditionInput)
-> Lens
     UpdateExperimentTemplateStopConditionInput
     UpdateExperimentTemplateStopConditionInput
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateExperimentTemplateStopConditionInput' {Maybe Text
value :: Maybe Text
$sel:value:UpdateExperimentTemplateStopConditionInput' :: UpdateExperimentTemplateStopConditionInput -> Maybe Text
value} -> Maybe Text
value) (\s :: UpdateExperimentTemplateStopConditionInput
s@UpdateExperimentTemplateStopConditionInput' {} Maybe Text
a -> UpdateExperimentTemplateStopConditionInput
s {$sel:value:UpdateExperimentTemplateStopConditionInput' :: Maybe Text
value = Maybe Text
a} :: UpdateExperimentTemplateStopConditionInput)

-- | The source for the stop condition. Specify @aws:cloudwatch:alarm@ if the
-- stop condition is defined by a CloudWatch alarm. Specify @none@ if there
-- is no stop condition.
updateExperimentTemplateStopConditionInput_source :: Lens.Lens' UpdateExperimentTemplateStopConditionInput Prelude.Text
updateExperimentTemplateStopConditionInput_source :: (Text -> f Text)
-> UpdateExperimentTemplateStopConditionInput
-> f UpdateExperimentTemplateStopConditionInput
updateExperimentTemplateStopConditionInput_source = (UpdateExperimentTemplateStopConditionInput -> Text)
-> (UpdateExperimentTemplateStopConditionInput
    -> Text -> UpdateExperimentTemplateStopConditionInput)
-> Lens
     UpdateExperimentTemplateStopConditionInput
     UpdateExperimentTemplateStopConditionInput
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateExperimentTemplateStopConditionInput' {Text
source :: Text
$sel:source:UpdateExperimentTemplateStopConditionInput' :: UpdateExperimentTemplateStopConditionInput -> Text
source} -> Text
source) (\s :: UpdateExperimentTemplateStopConditionInput
s@UpdateExperimentTemplateStopConditionInput' {} Text
a -> UpdateExperimentTemplateStopConditionInput
s {$sel:source:UpdateExperimentTemplateStopConditionInput' :: Text
source = Text
a} :: UpdateExperimentTemplateStopConditionInput)

instance
  Prelude.Hashable
    UpdateExperimentTemplateStopConditionInput

instance
  Prelude.NFData
    UpdateExperimentTemplateStopConditionInput

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