{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.UpdateExperimentTemplate
-- 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)
--
-- Updates the specified experiment template.
module Amazonka.FIS.UpdateExperimentTemplate
  ( -- * Creating a Request
    UpdateExperimentTemplate (..),
    newUpdateExperimentTemplate,

    -- * Request Lenses
    updateExperimentTemplate_actions,
    updateExperimentTemplate_stopConditions,
    updateExperimentTemplate_targets,
    updateExperimentTemplate_description,
    updateExperimentTemplate_roleArn,
    updateExperimentTemplate_id,

    -- * Destructuring the Response
    UpdateExperimentTemplateResponse (..),
    newUpdateExperimentTemplateResponse,

    -- * Response Lenses
    updateExperimentTemplateResponse_experimentTemplate,
    updateExperimentTemplateResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.FIS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateExperimentTemplate' smart constructor.
data UpdateExperimentTemplate = UpdateExperimentTemplate'
  { -- | The actions for the experiment.
    UpdateExperimentTemplate
-> Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
actions :: Prelude.Maybe (Prelude.HashMap Prelude.Text UpdateExperimentTemplateActionInputItem),
    -- | The stop conditions for the experiment.
    UpdateExperimentTemplate
-> Maybe [UpdateExperimentTemplateStopConditionInput]
stopConditions :: Prelude.Maybe [UpdateExperimentTemplateStopConditionInput],
    -- | The targets for the experiment.
    UpdateExperimentTemplate
-> Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
targets :: Prelude.Maybe (Prelude.HashMap Prelude.Text UpdateExperimentTemplateTargetInput),
    -- | A description for the template.
    UpdateExperimentTemplate -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of an IAM role that grants the AWS FIS
    -- service permission to perform service actions on your behalf.
    UpdateExperimentTemplate -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the experiment template.
    UpdateExperimentTemplate -> Text
id :: Prelude.Text
  }
  deriving (UpdateExperimentTemplate -> UpdateExperimentTemplate -> Bool
(UpdateExperimentTemplate -> UpdateExperimentTemplate -> Bool)
-> (UpdateExperimentTemplate -> UpdateExperimentTemplate -> Bool)
-> Eq UpdateExperimentTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateExperimentTemplate -> UpdateExperimentTemplate -> Bool
$c/= :: UpdateExperimentTemplate -> UpdateExperimentTemplate -> Bool
== :: UpdateExperimentTemplate -> UpdateExperimentTemplate -> Bool
$c== :: UpdateExperimentTemplate -> UpdateExperimentTemplate -> Bool
Prelude.Eq, ReadPrec [UpdateExperimentTemplate]
ReadPrec UpdateExperimentTemplate
Int -> ReadS UpdateExperimentTemplate
ReadS [UpdateExperimentTemplate]
(Int -> ReadS UpdateExperimentTemplate)
-> ReadS [UpdateExperimentTemplate]
-> ReadPrec UpdateExperimentTemplate
-> ReadPrec [UpdateExperimentTemplate]
-> Read UpdateExperimentTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateExperimentTemplate]
$creadListPrec :: ReadPrec [UpdateExperimentTemplate]
readPrec :: ReadPrec UpdateExperimentTemplate
$creadPrec :: ReadPrec UpdateExperimentTemplate
readList :: ReadS [UpdateExperimentTemplate]
$creadList :: ReadS [UpdateExperimentTemplate]
readsPrec :: Int -> ReadS UpdateExperimentTemplate
$creadsPrec :: Int -> ReadS UpdateExperimentTemplate
Prelude.Read, Int -> UpdateExperimentTemplate -> ShowS
[UpdateExperimentTemplate] -> ShowS
UpdateExperimentTemplate -> String
(Int -> UpdateExperimentTemplate -> ShowS)
-> (UpdateExperimentTemplate -> String)
-> ([UpdateExperimentTemplate] -> ShowS)
-> Show UpdateExperimentTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateExperimentTemplate] -> ShowS
$cshowList :: [UpdateExperimentTemplate] -> ShowS
show :: UpdateExperimentTemplate -> String
$cshow :: UpdateExperimentTemplate -> String
showsPrec :: Int -> UpdateExperimentTemplate -> ShowS
$cshowsPrec :: Int -> UpdateExperimentTemplate -> ShowS
Prelude.Show, (forall x.
 UpdateExperimentTemplate -> Rep UpdateExperimentTemplate x)
-> (forall x.
    Rep UpdateExperimentTemplate x -> UpdateExperimentTemplate)
-> Generic UpdateExperimentTemplate
forall x.
Rep UpdateExperimentTemplate x -> UpdateExperimentTemplate
forall x.
UpdateExperimentTemplate -> Rep UpdateExperimentTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateExperimentTemplate x -> UpdateExperimentTemplate
$cfrom :: forall x.
UpdateExperimentTemplate -> Rep UpdateExperimentTemplate x
Prelude.Generic)

-- |
-- Create a value of 'UpdateExperimentTemplate' 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:
--
-- 'actions', 'updateExperimentTemplate_actions' - The actions for the experiment.
--
-- 'stopConditions', 'updateExperimentTemplate_stopConditions' - The stop conditions for the experiment.
--
-- 'targets', 'updateExperimentTemplate_targets' - The targets for the experiment.
--
-- 'description', 'updateExperimentTemplate_description' - A description for the template.
--
-- 'roleArn', 'updateExperimentTemplate_roleArn' - The Amazon Resource Name (ARN) of an IAM role that grants the AWS FIS
-- service permission to perform service actions on your behalf.
--
-- 'id', 'updateExperimentTemplate_id' - The ID of the experiment template.
newUpdateExperimentTemplate ::
  -- | 'id'
  Prelude.Text ->
  UpdateExperimentTemplate
newUpdateExperimentTemplate :: Text -> UpdateExperimentTemplate
newUpdateExperimentTemplate Text
pId_ =
  UpdateExperimentTemplate' :: Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
-> Maybe [UpdateExperimentTemplateStopConditionInput]
-> Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
-> Maybe Text
-> Maybe Text
-> Text
-> UpdateExperimentTemplate
UpdateExperimentTemplate'
    { $sel:actions:UpdateExperimentTemplate' :: Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
actions =
        Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
forall a. Maybe a
Prelude.Nothing,
      $sel:stopConditions:UpdateExperimentTemplate' :: Maybe [UpdateExperimentTemplateStopConditionInput]
stopConditions = Maybe [UpdateExperimentTemplateStopConditionInput]
forall a. Maybe a
Prelude.Nothing,
      $sel:targets:UpdateExperimentTemplate' :: Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
targets = Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateExperimentTemplate' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:UpdateExperimentTemplate' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:UpdateExperimentTemplate' :: Text
id = Text
pId_
    }

-- | The actions for the experiment.
updateExperimentTemplate_actions :: Lens.Lens' UpdateExperimentTemplate (Prelude.Maybe (Prelude.HashMap Prelude.Text UpdateExperimentTemplateActionInputItem))
updateExperimentTemplate_actions :: (Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
 -> f (Maybe
         (HashMap Text UpdateExperimentTemplateActionInputItem)))
-> UpdateExperimentTemplate -> f UpdateExperimentTemplate
updateExperimentTemplate_actions = (UpdateExperimentTemplate
 -> Maybe (HashMap Text UpdateExperimentTemplateActionInputItem))
-> (UpdateExperimentTemplate
    -> Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
    -> UpdateExperimentTemplate)
-> Lens
     UpdateExperimentTemplate
     UpdateExperimentTemplate
     (Maybe (HashMap Text UpdateExperimentTemplateActionInputItem))
     (Maybe (HashMap Text UpdateExperimentTemplateActionInputItem))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateExperimentTemplate' {Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
actions :: Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
$sel:actions:UpdateExperimentTemplate' :: UpdateExperimentTemplate
-> Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
actions} -> Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
actions) (\s :: UpdateExperimentTemplate
s@UpdateExperimentTemplate' {} Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
a -> UpdateExperimentTemplate
s {$sel:actions:UpdateExperimentTemplate' :: Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
actions = Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
a} :: UpdateExperimentTemplate) ((Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
  -> f (Maybe
          (HashMap Text UpdateExperimentTemplateActionInputItem)))
 -> UpdateExperimentTemplate -> f UpdateExperimentTemplate)
-> ((Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
     -> f (Maybe
             (HashMap Text UpdateExperimentTemplateActionInputItem)))
    -> Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
    -> f (Maybe
            (HashMap Text UpdateExperimentTemplateActionInputItem)))
-> (Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
    -> f (Maybe
            (HashMap Text UpdateExperimentTemplateActionInputItem)))
-> UpdateExperimentTemplate
-> f UpdateExperimentTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text UpdateExperimentTemplateActionInputItem)
  (HashMap Text UpdateExperimentTemplateActionInputItem)
  (HashMap Text UpdateExperimentTemplateActionInputItem)
  (HashMap Text UpdateExperimentTemplateActionInputItem)
-> Iso
     (Maybe (HashMap Text UpdateExperimentTemplateActionInputItem))
     (Maybe (HashMap Text UpdateExperimentTemplateActionInputItem))
     (Maybe (HashMap Text UpdateExperimentTemplateActionInputItem))
     (Maybe (HashMap Text UpdateExperimentTemplateActionInputItem))
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 UpdateExperimentTemplateActionInputItem)
  (HashMap Text UpdateExperimentTemplateActionInputItem)
  (HashMap Text UpdateExperimentTemplateActionInputItem)
  (HashMap Text UpdateExperimentTemplateActionInputItem)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The stop conditions for the experiment.
updateExperimentTemplate_stopConditions :: Lens.Lens' UpdateExperimentTemplate (Prelude.Maybe [UpdateExperimentTemplateStopConditionInput])
updateExperimentTemplate_stopConditions :: (Maybe [UpdateExperimentTemplateStopConditionInput]
 -> f (Maybe [UpdateExperimentTemplateStopConditionInput]))
-> UpdateExperimentTemplate -> f UpdateExperimentTemplate
updateExperimentTemplate_stopConditions = (UpdateExperimentTemplate
 -> Maybe [UpdateExperimentTemplateStopConditionInput])
-> (UpdateExperimentTemplate
    -> Maybe [UpdateExperimentTemplateStopConditionInput]
    -> UpdateExperimentTemplate)
-> Lens
     UpdateExperimentTemplate
     UpdateExperimentTemplate
     (Maybe [UpdateExperimentTemplateStopConditionInput])
     (Maybe [UpdateExperimentTemplateStopConditionInput])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateExperimentTemplate' {Maybe [UpdateExperimentTemplateStopConditionInput]
stopConditions :: Maybe [UpdateExperimentTemplateStopConditionInput]
$sel:stopConditions:UpdateExperimentTemplate' :: UpdateExperimentTemplate
-> Maybe [UpdateExperimentTemplateStopConditionInput]
stopConditions} -> Maybe [UpdateExperimentTemplateStopConditionInput]
stopConditions) (\s :: UpdateExperimentTemplate
s@UpdateExperimentTemplate' {} Maybe [UpdateExperimentTemplateStopConditionInput]
a -> UpdateExperimentTemplate
s {$sel:stopConditions:UpdateExperimentTemplate' :: Maybe [UpdateExperimentTemplateStopConditionInput]
stopConditions = Maybe [UpdateExperimentTemplateStopConditionInput]
a} :: UpdateExperimentTemplate) ((Maybe [UpdateExperimentTemplateStopConditionInput]
  -> f (Maybe [UpdateExperimentTemplateStopConditionInput]))
 -> UpdateExperimentTemplate -> f UpdateExperimentTemplate)
-> ((Maybe [UpdateExperimentTemplateStopConditionInput]
     -> f (Maybe [UpdateExperimentTemplateStopConditionInput]))
    -> Maybe [UpdateExperimentTemplateStopConditionInput]
    -> f (Maybe [UpdateExperimentTemplateStopConditionInput]))
-> (Maybe [UpdateExperimentTemplateStopConditionInput]
    -> f (Maybe [UpdateExperimentTemplateStopConditionInput]))
-> UpdateExperimentTemplate
-> f UpdateExperimentTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [UpdateExperimentTemplateStopConditionInput]
  [UpdateExperimentTemplateStopConditionInput]
  [UpdateExperimentTemplateStopConditionInput]
  [UpdateExperimentTemplateStopConditionInput]
-> Iso
     (Maybe [UpdateExperimentTemplateStopConditionInput])
     (Maybe [UpdateExperimentTemplateStopConditionInput])
     (Maybe [UpdateExperimentTemplateStopConditionInput])
     (Maybe [UpdateExperimentTemplateStopConditionInput])
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
  [UpdateExperimentTemplateStopConditionInput]
  [UpdateExperimentTemplateStopConditionInput]
  [UpdateExperimentTemplateStopConditionInput]
  [UpdateExperimentTemplateStopConditionInput]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The targets for the experiment.
updateExperimentTemplate_targets :: Lens.Lens' UpdateExperimentTemplate (Prelude.Maybe (Prelude.HashMap Prelude.Text UpdateExperimentTemplateTargetInput))
updateExperimentTemplate_targets :: (Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
 -> f (Maybe (HashMap Text UpdateExperimentTemplateTargetInput)))
-> UpdateExperimentTemplate -> f UpdateExperimentTemplate
updateExperimentTemplate_targets = (UpdateExperimentTemplate
 -> Maybe (HashMap Text UpdateExperimentTemplateTargetInput))
-> (UpdateExperimentTemplate
    -> Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
    -> UpdateExperimentTemplate)
-> Lens
     UpdateExperimentTemplate
     UpdateExperimentTemplate
     (Maybe (HashMap Text UpdateExperimentTemplateTargetInput))
     (Maybe (HashMap Text UpdateExperimentTemplateTargetInput))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateExperimentTemplate' {Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
targets :: Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
$sel:targets:UpdateExperimentTemplate' :: UpdateExperimentTemplate
-> Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
targets} -> Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
targets) (\s :: UpdateExperimentTemplate
s@UpdateExperimentTemplate' {} Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
a -> UpdateExperimentTemplate
s {$sel:targets:UpdateExperimentTemplate' :: Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
targets = Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
a} :: UpdateExperimentTemplate) ((Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
  -> f (Maybe (HashMap Text UpdateExperimentTemplateTargetInput)))
 -> UpdateExperimentTemplate -> f UpdateExperimentTemplate)
-> ((Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
     -> f (Maybe (HashMap Text UpdateExperimentTemplateTargetInput)))
    -> Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
    -> f (Maybe (HashMap Text UpdateExperimentTemplateTargetInput)))
-> (Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
    -> f (Maybe (HashMap Text UpdateExperimentTemplateTargetInput)))
-> UpdateExperimentTemplate
-> f UpdateExperimentTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text UpdateExperimentTemplateTargetInput)
  (HashMap Text UpdateExperimentTemplateTargetInput)
  (HashMap Text UpdateExperimentTemplateTargetInput)
  (HashMap Text UpdateExperimentTemplateTargetInput)
-> Iso
     (Maybe (HashMap Text UpdateExperimentTemplateTargetInput))
     (Maybe (HashMap Text UpdateExperimentTemplateTargetInput))
     (Maybe (HashMap Text UpdateExperimentTemplateTargetInput))
     (Maybe (HashMap Text UpdateExperimentTemplateTargetInput))
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 UpdateExperimentTemplateTargetInput)
  (HashMap Text UpdateExperimentTemplateTargetInput)
  (HashMap Text UpdateExperimentTemplateTargetInput)
  (HashMap Text UpdateExperimentTemplateTargetInput)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The Amazon Resource Name (ARN) of an IAM role that grants the AWS FIS
-- service permission to perform service actions on your behalf.
updateExperimentTemplate_roleArn :: Lens.Lens' UpdateExperimentTemplate (Prelude.Maybe Prelude.Text)
updateExperimentTemplate_roleArn :: (Maybe Text -> f (Maybe Text))
-> UpdateExperimentTemplate -> f UpdateExperimentTemplate
updateExperimentTemplate_roleArn = (UpdateExperimentTemplate -> Maybe Text)
-> (UpdateExperimentTemplate
    -> Maybe Text -> UpdateExperimentTemplate)
-> Lens
     UpdateExperimentTemplate
     UpdateExperimentTemplate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateExperimentTemplate' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:UpdateExperimentTemplate' :: UpdateExperimentTemplate -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: UpdateExperimentTemplate
s@UpdateExperimentTemplate' {} Maybe Text
a -> UpdateExperimentTemplate
s {$sel:roleArn:UpdateExperimentTemplate' :: Maybe Text
roleArn = Maybe Text
a} :: UpdateExperimentTemplate)

-- | The ID of the experiment template.
updateExperimentTemplate_id :: Lens.Lens' UpdateExperimentTemplate Prelude.Text
updateExperimentTemplate_id :: (Text -> f Text)
-> UpdateExperimentTemplate -> f UpdateExperimentTemplate
updateExperimentTemplate_id = (UpdateExperimentTemplate -> Text)
-> (UpdateExperimentTemplate -> Text -> UpdateExperimentTemplate)
-> Lens UpdateExperimentTemplate UpdateExperimentTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateExperimentTemplate' {Text
id :: Text
$sel:id:UpdateExperimentTemplate' :: UpdateExperimentTemplate -> Text
id} -> Text
id) (\s :: UpdateExperimentTemplate
s@UpdateExperimentTemplate' {} Text
a -> UpdateExperimentTemplate
s {$sel:id:UpdateExperimentTemplate' :: Text
id = Text
a} :: UpdateExperimentTemplate)

instance Core.AWSRequest UpdateExperimentTemplate where
  type
    AWSResponse UpdateExperimentTemplate =
      UpdateExperimentTemplateResponse
  request :: UpdateExperimentTemplate -> Request UpdateExperimentTemplate
request = Service
-> UpdateExperimentTemplate -> Request UpdateExperimentTemplate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateExperimentTemplate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateExperimentTemplate)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateExperimentTemplate))
-> Logger
-> Service
-> Proxy UpdateExperimentTemplate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateExperimentTemplate)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ExperimentTemplate -> Int -> UpdateExperimentTemplateResponse
UpdateExperimentTemplateResponse'
            (Maybe ExperimentTemplate
 -> Int -> UpdateExperimentTemplateResponse)
-> Either String (Maybe ExperimentTemplate)
-> Either String (Int -> UpdateExperimentTemplateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ExperimentTemplate)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"experimentTemplate")
            Either String (Int -> UpdateExperimentTemplateResponse)
-> Either String Int
-> Either String UpdateExperimentTemplateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateExperimentTemplate

instance Prelude.NFData UpdateExperimentTemplate

instance Core.ToHeaders UpdateExperimentTemplate where
  toHeaders :: UpdateExperimentTemplate -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateExperimentTemplate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateExperimentTemplate where
  toJSON :: UpdateExperimentTemplate -> Value
toJSON UpdateExperimentTemplate' {Maybe [UpdateExperimentTemplateStopConditionInput]
Maybe Text
Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
Text
id :: Text
roleArn :: Maybe Text
description :: Maybe Text
targets :: Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
stopConditions :: Maybe [UpdateExperimentTemplateStopConditionInput]
actions :: Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
$sel:id:UpdateExperimentTemplate' :: UpdateExperimentTemplate -> Text
$sel:roleArn:UpdateExperimentTemplate' :: UpdateExperimentTemplate -> Maybe Text
$sel:description:UpdateExperimentTemplate' :: UpdateExperimentTemplate -> Maybe Text
$sel:targets:UpdateExperimentTemplate' :: UpdateExperimentTemplate
-> Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
$sel:stopConditions:UpdateExperimentTemplate' :: UpdateExperimentTemplate
-> Maybe [UpdateExperimentTemplateStopConditionInput]
$sel:actions:UpdateExperimentTemplate' :: UpdateExperimentTemplate
-> Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"actions" Text
-> HashMap Text UpdateExperimentTemplateActionInputItem -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text UpdateExperimentTemplateActionInputItem -> Pair)
-> Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
actions,
            (Text
"stopConditions" Text -> [UpdateExperimentTemplateStopConditionInput] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([UpdateExperimentTemplateStopConditionInput] -> Pair)
-> Maybe [UpdateExperimentTemplateStopConditionInput] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [UpdateExperimentTemplateStopConditionInput]
stopConditions,
            (Text
"targets" Text -> HashMap Text UpdateExperimentTemplateTargetInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text UpdateExperimentTemplateTargetInput -> Pair)
-> Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
targets,
            (Text
"description" 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
description,
            (Text
"roleArn" 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
roleArn
          ]
      )

instance Core.ToPath UpdateExperimentTemplate where
  toPath :: UpdateExperimentTemplate -> ByteString
toPath UpdateExperimentTemplate' {Maybe [UpdateExperimentTemplateStopConditionInput]
Maybe Text
Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
Text
id :: Text
roleArn :: Maybe Text
description :: Maybe Text
targets :: Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
stopConditions :: Maybe [UpdateExperimentTemplateStopConditionInput]
actions :: Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
$sel:id:UpdateExperimentTemplate' :: UpdateExperimentTemplate -> Text
$sel:roleArn:UpdateExperimentTemplate' :: UpdateExperimentTemplate -> Maybe Text
$sel:description:UpdateExperimentTemplate' :: UpdateExperimentTemplate -> Maybe Text
$sel:targets:UpdateExperimentTemplate' :: UpdateExperimentTemplate
-> Maybe (HashMap Text UpdateExperimentTemplateTargetInput)
$sel:stopConditions:UpdateExperimentTemplate' :: UpdateExperimentTemplate
-> Maybe [UpdateExperimentTemplateStopConditionInput]
$sel:actions:UpdateExperimentTemplate' :: UpdateExperimentTemplate
-> Maybe (HashMap Text UpdateExperimentTemplateActionInputItem)
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/experimentTemplates/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]

instance Core.ToQuery UpdateExperimentTemplate where
  toQuery :: UpdateExperimentTemplate -> QueryString
toQuery = QueryString -> UpdateExperimentTemplate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateExperimentTemplateResponse' smart constructor.
data UpdateExperimentTemplateResponse = UpdateExperimentTemplateResponse'
  { -- | Information about the experiment template.
    UpdateExperimentTemplateResponse -> Maybe ExperimentTemplate
experimentTemplate :: Prelude.Maybe ExperimentTemplate,
    -- | The response's http status code.
    UpdateExperimentTemplateResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateExperimentTemplateResponse
-> UpdateExperimentTemplateResponse -> Bool
(UpdateExperimentTemplateResponse
 -> UpdateExperimentTemplateResponse -> Bool)
-> (UpdateExperimentTemplateResponse
    -> UpdateExperimentTemplateResponse -> Bool)
-> Eq UpdateExperimentTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateExperimentTemplateResponse
-> UpdateExperimentTemplateResponse -> Bool
$c/= :: UpdateExperimentTemplateResponse
-> UpdateExperimentTemplateResponse -> Bool
== :: UpdateExperimentTemplateResponse
-> UpdateExperimentTemplateResponse -> Bool
$c== :: UpdateExperimentTemplateResponse
-> UpdateExperimentTemplateResponse -> Bool
Prelude.Eq, ReadPrec [UpdateExperimentTemplateResponse]
ReadPrec UpdateExperimentTemplateResponse
Int -> ReadS UpdateExperimentTemplateResponse
ReadS [UpdateExperimentTemplateResponse]
(Int -> ReadS UpdateExperimentTemplateResponse)
-> ReadS [UpdateExperimentTemplateResponse]
-> ReadPrec UpdateExperimentTemplateResponse
-> ReadPrec [UpdateExperimentTemplateResponse]
-> Read UpdateExperimentTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateExperimentTemplateResponse]
$creadListPrec :: ReadPrec [UpdateExperimentTemplateResponse]
readPrec :: ReadPrec UpdateExperimentTemplateResponse
$creadPrec :: ReadPrec UpdateExperimentTemplateResponse
readList :: ReadS [UpdateExperimentTemplateResponse]
$creadList :: ReadS [UpdateExperimentTemplateResponse]
readsPrec :: Int -> ReadS UpdateExperimentTemplateResponse
$creadsPrec :: Int -> ReadS UpdateExperimentTemplateResponse
Prelude.Read, Int -> UpdateExperimentTemplateResponse -> ShowS
[UpdateExperimentTemplateResponse] -> ShowS
UpdateExperimentTemplateResponse -> String
(Int -> UpdateExperimentTemplateResponse -> ShowS)
-> (UpdateExperimentTemplateResponse -> String)
-> ([UpdateExperimentTemplateResponse] -> ShowS)
-> Show UpdateExperimentTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateExperimentTemplateResponse] -> ShowS
$cshowList :: [UpdateExperimentTemplateResponse] -> ShowS
show :: UpdateExperimentTemplateResponse -> String
$cshow :: UpdateExperimentTemplateResponse -> String
showsPrec :: Int -> UpdateExperimentTemplateResponse -> ShowS
$cshowsPrec :: Int -> UpdateExperimentTemplateResponse -> ShowS
Prelude.Show, (forall x.
 UpdateExperimentTemplateResponse
 -> Rep UpdateExperimentTemplateResponse x)
-> (forall x.
    Rep UpdateExperimentTemplateResponse x
    -> UpdateExperimentTemplateResponse)
-> Generic UpdateExperimentTemplateResponse
forall x.
Rep UpdateExperimentTemplateResponse x
-> UpdateExperimentTemplateResponse
forall x.
UpdateExperimentTemplateResponse
-> Rep UpdateExperimentTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateExperimentTemplateResponse x
-> UpdateExperimentTemplateResponse
$cfrom :: forall x.
UpdateExperimentTemplateResponse
-> Rep UpdateExperimentTemplateResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateExperimentTemplateResponse' 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:
--
-- 'experimentTemplate', 'updateExperimentTemplateResponse_experimentTemplate' - Information about the experiment template.
--
-- 'httpStatus', 'updateExperimentTemplateResponse_httpStatus' - The response's http status code.
newUpdateExperimentTemplateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateExperimentTemplateResponse
newUpdateExperimentTemplateResponse :: Int -> UpdateExperimentTemplateResponse
newUpdateExperimentTemplateResponse Int
pHttpStatus_ =
  UpdateExperimentTemplateResponse' :: Maybe ExperimentTemplate -> Int -> UpdateExperimentTemplateResponse
UpdateExperimentTemplateResponse'
    { $sel:experimentTemplate:UpdateExperimentTemplateResponse' :: Maybe ExperimentTemplate
experimentTemplate =
        Maybe ExperimentTemplate
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateExperimentTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the experiment template.
updateExperimentTemplateResponse_experimentTemplate :: Lens.Lens' UpdateExperimentTemplateResponse (Prelude.Maybe ExperimentTemplate)
updateExperimentTemplateResponse_experimentTemplate :: (Maybe ExperimentTemplate -> f (Maybe ExperimentTemplate))
-> UpdateExperimentTemplateResponse
-> f UpdateExperimentTemplateResponse
updateExperimentTemplateResponse_experimentTemplate = (UpdateExperimentTemplateResponse -> Maybe ExperimentTemplate)
-> (UpdateExperimentTemplateResponse
    -> Maybe ExperimentTemplate -> UpdateExperimentTemplateResponse)
-> Lens
     UpdateExperimentTemplateResponse
     UpdateExperimentTemplateResponse
     (Maybe ExperimentTemplate)
     (Maybe ExperimentTemplate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateExperimentTemplateResponse' {Maybe ExperimentTemplate
experimentTemplate :: Maybe ExperimentTemplate
$sel:experimentTemplate:UpdateExperimentTemplateResponse' :: UpdateExperimentTemplateResponse -> Maybe ExperimentTemplate
experimentTemplate} -> Maybe ExperimentTemplate
experimentTemplate) (\s :: UpdateExperimentTemplateResponse
s@UpdateExperimentTemplateResponse' {} Maybe ExperimentTemplate
a -> UpdateExperimentTemplateResponse
s {$sel:experimentTemplate:UpdateExperimentTemplateResponse' :: Maybe ExperimentTemplate
experimentTemplate = Maybe ExperimentTemplate
a} :: UpdateExperimentTemplateResponse)

-- | The response's http status code.
updateExperimentTemplateResponse_httpStatus :: Lens.Lens' UpdateExperimentTemplateResponse Prelude.Int
updateExperimentTemplateResponse_httpStatus :: (Int -> f Int)
-> UpdateExperimentTemplateResponse
-> f UpdateExperimentTemplateResponse
updateExperimentTemplateResponse_httpStatus = (UpdateExperimentTemplateResponse -> Int)
-> (UpdateExperimentTemplateResponse
    -> Int -> UpdateExperimentTemplateResponse)
-> Lens
     UpdateExperimentTemplateResponse
     UpdateExperimentTemplateResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateExperimentTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateExperimentTemplateResponse' :: UpdateExperimentTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateExperimentTemplateResponse
s@UpdateExperimentTemplateResponse' {} Int
a -> UpdateExperimentTemplateResponse
s {$sel:httpStatus:UpdateExperimentTemplateResponse' :: Int
httpStatus = Int
a} :: UpdateExperimentTemplateResponse)

instance
  Prelude.NFData
    UpdateExperimentTemplateResponse