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

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

-- | Describes an action for an experiment template.
--
-- /See:/ 'newExperimentTemplateAction' smart constructor.
data ExperimentTemplateAction = ExperimentTemplateAction'
  { -- | The name of the action that must be completed before the current action
    -- starts.
    ExperimentTemplateAction -> Maybe [Text]
startAfter :: Prelude.Maybe [Prelude.Text],
    -- | The ID of the action.
    ExperimentTemplateAction -> Maybe Text
actionId :: Prelude.Maybe Prelude.Text,
    -- | The parameters for the action.
    ExperimentTemplateAction -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The targets for the action.
    ExperimentTemplateAction -> Maybe (HashMap Text Text)
targets :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A description for the action.
    ExperimentTemplateAction -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (ExperimentTemplateAction -> ExperimentTemplateAction -> Bool
(ExperimentTemplateAction -> ExperimentTemplateAction -> Bool)
-> (ExperimentTemplateAction -> ExperimentTemplateAction -> Bool)
-> Eq ExperimentTemplateAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExperimentTemplateAction -> ExperimentTemplateAction -> Bool
$c/= :: ExperimentTemplateAction -> ExperimentTemplateAction -> Bool
== :: ExperimentTemplateAction -> ExperimentTemplateAction -> Bool
$c== :: ExperimentTemplateAction -> ExperimentTemplateAction -> Bool
Prelude.Eq, ReadPrec [ExperimentTemplateAction]
ReadPrec ExperimentTemplateAction
Int -> ReadS ExperimentTemplateAction
ReadS [ExperimentTemplateAction]
(Int -> ReadS ExperimentTemplateAction)
-> ReadS [ExperimentTemplateAction]
-> ReadPrec ExperimentTemplateAction
-> ReadPrec [ExperimentTemplateAction]
-> Read ExperimentTemplateAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExperimentTemplateAction]
$creadListPrec :: ReadPrec [ExperimentTemplateAction]
readPrec :: ReadPrec ExperimentTemplateAction
$creadPrec :: ReadPrec ExperimentTemplateAction
readList :: ReadS [ExperimentTemplateAction]
$creadList :: ReadS [ExperimentTemplateAction]
readsPrec :: Int -> ReadS ExperimentTemplateAction
$creadsPrec :: Int -> ReadS ExperimentTemplateAction
Prelude.Read, Int -> ExperimentTemplateAction -> ShowS
[ExperimentTemplateAction] -> ShowS
ExperimentTemplateAction -> String
(Int -> ExperimentTemplateAction -> ShowS)
-> (ExperimentTemplateAction -> String)
-> ([ExperimentTemplateAction] -> ShowS)
-> Show ExperimentTemplateAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExperimentTemplateAction] -> ShowS
$cshowList :: [ExperimentTemplateAction] -> ShowS
show :: ExperimentTemplateAction -> String
$cshow :: ExperimentTemplateAction -> String
showsPrec :: Int -> ExperimentTemplateAction -> ShowS
$cshowsPrec :: Int -> ExperimentTemplateAction -> ShowS
Prelude.Show, (forall x.
 ExperimentTemplateAction -> Rep ExperimentTemplateAction x)
-> (forall x.
    Rep ExperimentTemplateAction x -> ExperimentTemplateAction)
-> Generic ExperimentTemplateAction
forall x.
Rep ExperimentTemplateAction x -> ExperimentTemplateAction
forall x.
ExperimentTemplateAction -> Rep ExperimentTemplateAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExperimentTemplateAction x -> ExperimentTemplateAction
$cfrom :: forall x.
ExperimentTemplateAction -> Rep ExperimentTemplateAction x
Prelude.Generic)

-- |
-- Create a value of 'ExperimentTemplateAction' 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:
--
-- 'startAfter', 'experimentTemplateAction_startAfter' - The name of the action that must be completed before the current action
-- starts.
--
-- 'actionId', 'experimentTemplateAction_actionId' - The ID of the action.
--
-- 'parameters', 'experimentTemplateAction_parameters' - The parameters for the action.
--
-- 'targets', 'experimentTemplateAction_targets' - The targets for the action.
--
-- 'description', 'experimentTemplateAction_description' - A description for the action.
newExperimentTemplateAction ::
  ExperimentTemplateAction
newExperimentTemplateAction :: ExperimentTemplateAction
newExperimentTemplateAction =
  ExperimentTemplateAction' :: Maybe [Text]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text Text)
-> Maybe Text
-> ExperimentTemplateAction
ExperimentTemplateAction'
    { $sel:startAfter:ExperimentTemplateAction' :: Maybe [Text]
startAfter =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:actionId:ExperimentTemplateAction' :: Maybe Text
actionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:ExperimentTemplateAction' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:targets:ExperimentTemplateAction' :: Maybe (HashMap Text Text)
targets = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ExperimentTemplateAction' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the action that must be completed before the current action
-- starts.
experimentTemplateAction_startAfter :: Lens.Lens' ExperimentTemplateAction (Prelude.Maybe [Prelude.Text])
experimentTemplateAction_startAfter :: (Maybe [Text] -> f (Maybe [Text]))
-> ExperimentTemplateAction -> f ExperimentTemplateAction
experimentTemplateAction_startAfter = (ExperimentTemplateAction -> Maybe [Text])
-> (ExperimentTemplateAction
    -> Maybe [Text] -> ExperimentTemplateAction)
-> Lens
     ExperimentTemplateAction
     ExperimentTemplateAction
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentTemplateAction' {Maybe [Text]
startAfter :: Maybe [Text]
$sel:startAfter:ExperimentTemplateAction' :: ExperimentTemplateAction -> Maybe [Text]
startAfter} -> Maybe [Text]
startAfter) (\s :: ExperimentTemplateAction
s@ExperimentTemplateAction' {} Maybe [Text]
a -> ExperimentTemplateAction
s {$sel:startAfter:ExperimentTemplateAction' :: Maybe [Text]
startAfter = Maybe [Text]
a} :: ExperimentTemplateAction) ((Maybe [Text] -> f (Maybe [Text]))
 -> ExperimentTemplateAction -> f ExperimentTemplateAction)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ExperimentTemplateAction
-> f ExperimentTemplateAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the action.
experimentTemplateAction_actionId :: Lens.Lens' ExperimentTemplateAction (Prelude.Maybe Prelude.Text)
experimentTemplateAction_actionId :: (Maybe Text -> f (Maybe Text))
-> ExperimentTemplateAction -> f ExperimentTemplateAction
experimentTemplateAction_actionId = (ExperimentTemplateAction -> Maybe Text)
-> (ExperimentTemplateAction
    -> Maybe Text -> ExperimentTemplateAction)
-> Lens
     ExperimentTemplateAction
     ExperimentTemplateAction
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentTemplateAction' {Maybe Text
actionId :: Maybe Text
$sel:actionId:ExperimentTemplateAction' :: ExperimentTemplateAction -> Maybe Text
actionId} -> Maybe Text
actionId) (\s :: ExperimentTemplateAction
s@ExperimentTemplateAction' {} Maybe Text
a -> ExperimentTemplateAction
s {$sel:actionId:ExperimentTemplateAction' :: Maybe Text
actionId = Maybe Text
a} :: ExperimentTemplateAction)

-- | The parameters for the action.
experimentTemplateAction_parameters :: Lens.Lens' ExperimentTemplateAction (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
experimentTemplateAction_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ExperimentTemplateAction -> f ExperimentTemplateAction
experimentTemplateAction_parameters = (ExperimentTemplateAction -> Maybe (HashMap Text Text))
-> (ExperimentTemplateAction
    -> Maybe (HashMap Text Text) -> ExperimentTemplateAction)
-> Lens
     ExperimentTemplateAction
     ExperimentTemplateAction
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentTemplateAction' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:ExperimentTemplateAction' :: ExperimentTemplateAction -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: ExperimentTemplateAction
s@ExperimentTemplateAction' {} Maybe (HashMap Text Text)
a -> ExperimentTemplateAction
s {$sel:parameters:ExperimentTemplateAction' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: ExperimentTemplateAction) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ExperimentTemplateAction -> f ExperimentTemplateAction)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ExperimentTemplateAction
-> f ExperimentTemplateAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The targets for the action.
experimentTemplateAction_targets :: Lens.Lens' ExperimentTemplateAction (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
experimentTemplateAction_targets :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ExperimentTemplateAction -> f ExperimentTemplateAction
experimentTemplateAction_targets = (ExperimentTemplateAction -> Maybe (HashMap Text Text))
-> (ExperimentTemplateAction
    -> Maybe (HashMap Text Text) -> ExperimentTemplateAction)
-> Lens
     ExperimentTemplateAction
     ExperimentTemplateAction
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentTemplateAction' {Maybe (HashMap Text Text)
targets :: Maybe (HashMap Text Text)
$sel:targets:ExperimentTemplateAction' :: ExperimentTemplateAction -> Maybe (HashMap Text Text)
targets} -> Maybe (HashMap Text Text)
targets) (\s :: ExperimentTemplateAction
s@ExperimentTemplateAction' {} Maybe (HashMap Text Text)
a -> ExperimentTemplateAction
s {$sel:targets:ExperimentTemplateAction' :: Maybe (HashMap Text Text)
targets = Maybe (HashMap Text Text)
a} :: ExperimentTemplateAction) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ExperimentTemplateAction -> f ExperimentTemplateAction)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ExperimentTemplateAction
-> f ExperimentTemplateAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A description for the action.
experimentTemplateAction_description :: Lens.Lens' ExperimentTemplateAction (Prelude.Maybe Prelude.Text)
experimentTemplateAction_description :: (Maybe Text -> f (Maybe Text))
-> ExperimentTemplateAction -> f ExperimentTemplateAction
experimentTemplateAction_description = (ExperimentTemplateAction -> Maybe Text)
-> (ExperimentTemplateAction
    -> Maybe Text -> ExperimentTemplateAction)
-> Lens
     ExperimentTemplateAction
     ExperimentTemplateAction
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentTemplateAction' {Maybe Text
description :: Maybe Text
$sel:description:ExperimentTemplateAction' :: ExperimentTemplateAction -> Maybe Text
description} -> Maybe Text
description) (\s :: ExperimentTemplateAction
s@ExperimentTemplateAction' {} Maybe Text
a -> ExperimentTemplateAction
s {$sel:description:ExperimentTemplateAction' :: Maybe Text
description = Maybe Text
a} :: ExperimentTemplateAction)

instance Core.FromJSON ExperimentTemplateAction where
  parseJSON :: Value -> Parser ExperimentTemplateAction
parseJSON =
    String
-> (Object -> Parser ExperimentTemplateAction)
-> Value
-> Parser ExperimentTemplateAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExperimentTemplateAction"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text Text)
-> Maybe Text
-> ExperimentTemplateAction
ExperimentTemplateAction'
            (Maybe [Text]
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe (HashMap Text Text)
 -> Maybe Text
 -> ExperimentTemplateAction)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> ExperimentTemplateAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"startAfter" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> ExperimentTemplateAction)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> ExperimentTemplateAction)
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
"actionId")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> ExperimentTemplateAction)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe Text -> ExperimentTemplateAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"parameters" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe Text -> ExperimentTemplateAction)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe Text -> ExperimentTemplateAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"targets" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> ExperimentTemplateAction)
-> Parser (Maybe Text) -> Parser ExperimentTemplateAction
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
"description")
      )

instance Prelude.Hashable ExperimentTemplateAction

instance Prelude.NFData ExperimentTemplateAction