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

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

-- | Describes a stop condition for an experiment template.
--
-- /See:/ 'newExperimentTemplateStopCondition' smart constructor.
data ExperimentTemplateStopCondition = ExperimentTemplateStopCondition'
  { -- | The Amazon Resource Name (ARN) of the CloudWatch alarm, if applicable.
    ExperimentTemplateStopCondition -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The source for the stop condition.
    ExperimentTemplateStopCondition -> Maybe Text
source :: Prelude.Maybe Prelude.Text
  }
  deriving (ExperimentTemplateStopCondition
-> ExperimentTemplateStopCondition -> Bool
(ExperimentTemplateStopCondition
 -> ExperimentTemplateStopCondition -> Bool)
-> (ExperimentTemplateStopCondition
    -> ExperimentTemplateStopCondition -> Bool)
-> Eq ExperimentTemplateStopCondition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExperimentTemplateStopCondition
-> ExperimentTemplateStopCondition -> Bool
$c/= :: ExperimentTemplateStopCondition
-> ExperimentTemplateStopCondition -> Bool
== :: ExperimentTemplateStopCondition
-> ExperimentTemplateStopCondition -> Bool
$c== :: ExperimentTemplateStopCondition
-> ExperimentTemplateStopCondition -> Bool
Prelude.Eq, ReadPrec [ExperimentTemplateStopCondition]
ReadPrec ExperimentTemplateStopCondition
Int -> ReadS ExperimentTemplateStopCondition
ReadS [ExperimentTemplateStopCondition]
(Int -> ReadS ExperimentTemplateStopCondition)
-> ReadS [ExperimentTemplateStopCondition]
-> ReadPrec ExperimentTemplateStopCondition
-> ReadPrec [ExperimentTemplateStopCondition]
-> Read ExperimentTemplateStopCondition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExperimentTemplateStopCondition]
$creadListPrec :: ReadPrec [ExperimentTemplateStopCondition]
readPrec :: ReadPrec ExperimentTemplateStopCondition
$creadPrec :: ReadPrec ExperimentTemplateStopCondition
readList :: ReadS [ExperimentTemplateStopCondition]
$creadList :: ReadS [ExperimentTemplateStopCondition]
readsPrec :: Int -> ReadS ExperimentTemplateStopCondition
$creadsPrec :: Int -> ReadS ExperimentTemplateStopCondition
Prelude.Read, Int -> ExperimentTemplateStopCondition -> ShowS
[ExperimentTemplateStopCondition] -> ShowS
ExperimentTemplateStopCondition -> String
(Int -> ExperimentTemplateStopCondition -> ShowS)
-> (ExperimentTemplateStopCondition -> String)
-> ([ExperimentTemplateStopCondition] -> ShowS)
-> Show ExperimentTemplateStopCondition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExperimentTemplateStopCondition] -> ShowS
$cshowList :: [ExperimentTemplateStopCondition] -> ShowS
show :: ExperimentTemplateStopCondition -> String
$cshow :: ExperimentTemplateStopCondition -> String
showsPrec :: Int -> ExperimentTemplateStopCondition -> ShowS
$cshowsPrec :: Int -> ExperimentTemplateStopCondition -> ShowS
Prelude.Show, (forall x.
 ExperimentTemplateStopCondition
 -> Rep ExperimentTemplateStopCondition x)
-> (forall x.
    Rep ExperimentTemplateStopCondition x
    -> ExperimentTemplateStopCondition)
-> Generic ExperimentTemplateStopCondition
forall x.
Rep ExperimentTemplateStopCondition x
-> ExperimentTemplateStopCondition
forall x.
ExperimentTemplateStopCondition
-> Rep ExperimentTemplateStopCondition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExperimentTemplateStopCondition x
-> ExperimentTemplateStopCondition
$cfrom :: forall x.
ExperimentTemplateStopCondition
-> Rep ExperimentTemplateStopCondition x
Prelude.Generic)

-- |
-- Create a value of 'ExperimentTemplateStopCondition' 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', 'experimentTemplateStopCondition_value' - The Amazon Resource Name (ARN) of the CloudWatch alarm, if applicable.
--
-- 'source', 'experimentTemplateStopCondition_source' - The source for the stop condition.
newExperimentTemplateStopCondition ::
  ExperimentTemplateStopCondition
newExperimentTemplateStopCondition :: ExperimentTemplateStopCondition
newExperimentTemplateStopCondition =
  ExperimentTemplateStopCondition' :: Maybe Text -> Maybe Text -> ExperimentTemplateStopCondition
ExperimentTemplateStopCondition'
    { $sel:value:ExperimentTemplateStopCondition' :: Maybe Text
value =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:source:ExperimentTemplateStopCondition' :: Maybe Text
source = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The source for the stop condition.
experimentTemplateStopCondition_source :: Lens.Lens' ExperimentTemplateStopCondition (Prelude.Maybe Prelude.Text)
experimentTemplateStopCondition_source :: (Maybe Text -> f (Maybe Text))
-> ExperimentTemplateStopCondition
-> f ExperimentTemplateStopCondition
experimentTemplateStopCondition_source = (ExperimentTemplateStopCondition -> Maybe Text)
-> (ExperimentTemplateStopCondition
    -> Maybe Text -> ExperimentTemplateStopCondition)
-> Lens
     ExperimentTemplateStopCondition
     ExperimentTemplateStopCondition
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentTemplateStopCondition' {Maybe Text
source :: Maybe Text
$sel:source:ExperimentTemplateStopCondition' :: ExperimentTemplateStopCondition -> Maybe Text
source} -> Maybe Text
source) (\s :: ExperimentTemplateStopCondition
s@ExperimentTemplateStopCondition' {} Maybe Text
a -> ExperimentTemplateStopCondition
s {$sel:source:ExperimentTemplateStopCondition' :: Maybe Text
source = Maybe Text
a} :: ExperimentTemplateStopCondition)

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

instance
  Prelude.Hashable
    ExperimentTemplateStopCondition

instance
  Prelude.NFData
    ExperimentTemplateStopCondition