{-# 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.CreateExperimentTemplateStopConditionInput
-- 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.CreateExperimentTemplateStopConditionInput 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 template.
--
-- /See:/ 'newCreateExperimentTemplateStopConditionInput' smart constructor.
data CreateExperimentTemplateStopConditionInput = CreateExperimentTemplateStopConditionInput'
  { -- | The Amazon Resource Name (ARN) of the CloudWatch alarm. This is required
    -- if the source is a CloudWatch alarm.
    CreateExperimentTemplateStopConditionInput -> 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.
    CreateExperimentTemplateStopConditionInput -> Text
source :: Prelude.Text
  }
  deriving (CreateExperimentTemplateStopConditionInput
-> CreateExperimentTemplateStopConditionInput -> Bool
(CreateExperimentTemplateStopConditionInput
 -> CreateExperimentTemplateStopConditionInput -> Bool)
-> (CreateExperimentTemplateStopConditionInput
    -> CreateExperimentTemplateStopConditionInput -> Bool)
-> Eq CreateExperimentTemplateStopConditionInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateExperimentTemplateStopConditionInput
-> CreateExperimentTemplateStopConditionInput -> Bool
$c/= :: CreateExperimentTemplateStopConditionInput
-> CreateExperimentTemplateStopConditionInput -> Bool
== :: CreateExperimentTemplateStopConditionInput
-> CreateExperimentTemplateStopConditionInput -> Bool
$c== :: CreateExperimentTemplateStopConditionInput
-> CreateExperimentTemplateStopConditionInput -> Bool
Prelude.Eq, ReadPrec [CreateExperimentTemplateStopConditionInput]
ReadPrec CreateExperimentTemplateStopConditionInput
Int -> ReadS CreateExperimentTemplateStopConditionInput
ReadS [CreateExperimentTemplateStopConditionInput]
(Int -> ReadS CreateExperimentTemplateStopConditionInput)
-> ReadS [CreateExperimentTemplateStopConditionInput]
-> ReadPrec CreateExperimentTemplateStopConditionInput
-> ReadPrec [CreateExperimentTemplateStopConditionInput]
-> Read CreateExperimentTemplateStopConditionInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateExperimentTemplateStopConditionInput]
$creadListPrec :: ReadPrec [CreateExperimentTemplateStopConditionInput]
readPrec :: ReadPrec CreateExperimentTemplateStopConditionInput
$creadPrec :: ReadPrec CreateExperimentTemplateStopConditionInput
readList :: ReadS [CreateExperimentTemplateStopConditionInput]
$creadList :: ReadS [CreateExperimentTemplateStopConditionInput]
readsPrec :: Int -> ReadS CreateExperimentTemplateStopConditionInput
$creadsPrec :: Int -> ReadS CreateExperimentTemplateStopConditionInput
Prelude.Read, Int -> CreateExperimentTemplateStopConditionInput -> ShowS
[CreateExperimentTemplateStopConditionInput] -> ShowS
CreateExperimentTemplateStopConditionInput -> String
(Int -> CreateExperimentTemplateStopConditionInput -> ShowS)
-> (CreateExperimentTemplateStopConditionInput -> String)
-> ([CreateExperimentTemplateStopConditionInput] -> ShowS)
-> Show CreateExperimentTemplateStopConditionInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateExperimentTemplateStopConditionInput] -> ShowS
$cshowList :: [CreateExperimentTemplateStopConditionInput] -> ShowS
show :: CreateExperimentTemplateStopConditionInput -> String
$cshow :: CreateExperimentTemplateStopConditionInput -> String
showsPrec :: Int -> CreateExperimentTemplateStopConditionInput -> ShowS
$cshowsPrec :: Int -> CreateExperimentTemplateStopConditionInput -> ShowS
Prelude.Show, (forall x.
 CreateExperimentTemplateStopConditionInput
 -> Rep CreateExperimentTemplateStopConditionInput x)
-> (forall x.
    Rep CreateExperimentTemplateStopConditionInput x
    -> CreateExperimentTemplateStopConditionInput)
-> Generic CreateExperimentTemplateStopConditionInput
forall x.
Rep CreateExperimentTemplateStopConditionInput x
-> CreateExperimentTemplateStopConditionInput
forall x.
CreateExperimentTemplateStopConditionInput
-> Rep CreateExperimentTemplateStopConditionInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateExperimentTemplateStopConditionInput x
-> CreateExperimentTemplateStopConditionInput
$cfrom :: forall x.
CreateExperimentTemplateStopConditionInput
-> Rep CreateExperimentTemplateStopConditionInput x
Prelude.Generic)

-- |
-- Create a value of 'CreateExperimentTemplateStopConditionInput' 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', 'createExperimentTemplateStopConditionInput_value' - The Amazon Resource Name (ARN) of the CloudWatch alarm. This is required
-- if the source is a CloudWatch alarm.
--
-- 'source', 'createExperimentTemplateStopConditionInput_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.
newCreateExperimentTemplateStopConditionInput ::
  -- | 'source'
  Prelude.Text ->
  CreateExperimentTemplateStopConditionInput
newCreateExperimentTemplateStopConditionInput :: Text -> CreateExperimentTemplateStopConditionInput
newCreateExperimentTemplateStopConditionInput
  Text
pSource_ =
    CreateExperimentTemplateStopConditionInput' :: Maybe Text -> Text -> CreateExperimentTemplateStopConditionInput
CreateExperimentTemplateStopConditionInput'
      { $sel:value:CreateExperimentTemplateStopConditionInput' :: Maybe Text
value =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:source:CreateExperimentTemplateStopConditionInput' :: Text
source = Text
pSource_
      }

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

-- | 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.
createExperimentTemplateStopConditionInput_source :: Lens.Lens' CreateExperimentTemplateStopConditionInput Prelude.Text
createExperimentTemplateStopConditionInput_source :: (Text -> f Text)
-> CreateExperimentTemplateStopConditionInput
-> f CreateExperimentTemplateStopConditionInput
createExperimentTemplateStopConditionInput_source = (CreateExperimentTemplateStopConditionInput -> Text)
-> (CreateExperimentTemplateStopConditionInput
    -> Text -> CreateExperimentTemplateStopConditionInput)
-> Lens
     CreateExperimentTemplateStopConditionInput
     CreateExperimentTemplateStopConditionInput
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExperimentTemplateStopConditionInput' {Text
source :: Text
$sel:source:CreateExperimentTemplateStopConditionInput' :: CreateExperimentTemplateStopConditionInput -> Text
source} -> Text
source) (\s :: CreateExperimentTemplateStopConditionInput
s@CreateExperimentTemplateStopConditionInput' {} Text
a -> CreateExperimentTemplateStopConditionInput
s {$sel:source:CreateExperimentTemplateStopConditionInput' :: Text
source = Text
a} :: CreateExperimentTemplateStopConditionInput)

instance
  Prelude.Hashable
    CreateExperimentTemplateStopConditionInput

instance
  Prelude.NFData
    CreateExperimentTemplateStopConditionInput

instance
  Core.ToJSON
    CreateExperimentTemplateStopConditionInput
  where
  toJSON :: CreateExperimentTemplateStopConditionInput -> Value
toJSON
    CreateExperimentTemplateStopConditionInput' {Maybe Text
Text
source :: Text
value :: Maybe Text
$sel:source:CreateExperimentTemplateStopConditionInput' :: CreateExperimentTemplateStopConditionInput -> Text
$sel:value:CreateExperimentTemplateStopConditionInput' :: CreateExperimentTemplateStopConditionInput -> 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)
            ]
        )