{-# 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 #-}
module Amazonka.FIS.StartExperiment
(
StartExperiment (..),
newStartExperiment,
startExperiment_tags,
startExperiment_clientToken,
startExperiment_experimentTemplateId,
StartExperimentResponse (..),
newStartExperimentResponse,
startExperimentResponse_experiment,
startExperimentResponse_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
data StartExperiment = StartExperiment'
{
StartExperiment -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
StartExperiment -> Text
clientToken :: Prelude.Text,
StartExperiment -> Text
experimentTemplateId :: Prelude.Text
}
deriving (StartExperiment -> StartExperiment -> Bool
(StartExperiment -> StartExperiment -> Bool)
-> (StartExperiment -> StartExperiment -> Bool)
-> Eq StartExperiment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartExperiment -> StartExperiment -> Bool
$c/= :: StartExperiment -> StartExperiment -> Bool
== :: StartExperiment -> StartExperiment -> Bool
$c== :: StartExperiment -> StartExperiment -> Bool
Prelude.Eq, ReadPrec [StartExperiment]
ReadPrec StartExperiment
Int -> ReadS StartExperiment
ReadS [StartExperiment]
(Int -> ReadS StartExperiment)
-> ReadS [StartExperiment]
-> ReadPrec StartExperiment
-> ReadPrec [StartExperiment]
-> Read StartExperiment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartExperiment]
$creadListPrec :: ReadPrec [StartExperiment]
readPrec :: ReadPrec StartExperiment
$creadPrec :: ReadPrec StartExperiment
readList :: ReadS [StartExperiment]
$creadList :: ReadS [StartExperiment]
readsPrec :: Int -> ReadS StartExperiment
$creadsPrec :: Int -> ReadS StartExperiment
Prelude.Read, Int -> StartExperiment -> ShowS
[StartExperiment] -> ShowS
StartExperiment -> String
(Int -> StartExperiment -> ShowS)
-> (StartExperiment -> String)
-> ([StartExperiment] -> ShowS)
-> Show StartExperiment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartExperiment] -> ShowS
$cshowList :: [StartExperiment] -> ShowS
show :: StartExperiment -> String
$cshow :: StartExperiment -> String
showsPrec :: Int -> StartExperiment -> ShowS
$cshowsPrec :: Int -> StartExperiment -> ShowS
Prelude.Show, (forall x. StartExperiment -> Rep StartExperiment x)
-> (forall x. Rep StartExperiment x -> StartExperiment)
-> Generic StartExperiment
forall x. Rep StartExperiment x -> StartExperiment
forall x. StartExperiment -> Rep StartExperiment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartExperiment x -> StartExperiment
$cfrom :: forall x. StartExperiment -> Rep StartExperiment x
Prelude.Generic)
newStartExperiment ::
Prelude.Text ->
Prelude.Text ->
StartExperiment
newStartExperiment :: Text -> Text -> StartExperiment
newStartExperiment
Text
pClientToken_
Text
pExperimentTemplateId_ =
StartExperiment' :: Maybe (HashMap Text Text) -> Text -> Text -> StartExperiment
StartExperiment'
{ $sel:tags:StartExperiment' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:clientToken:StartExperiment' :: Text
clientToken = Text
pClientToken_,
$sel:experimentTemplateId:StartExperiment' :: Text
experimentTemplateId = Text
pExperimentTemplateId_
}
startExperiment_tags :: Lens.Lens' StartExperiment (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
startExperiment_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StartExperiment -> f StartExperiment
startExperiment_tags = (StartExperiment -> Maybe (HashMap Text Text))
-> (StartExperiment
-> Maybe (HashMap Text Text) -> StartExperiment)
-> Lens
StartExperiment
StartExperiment
(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 (\StartExperiment' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:StartExperiment' :: StartExperiment -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: StartExperiment
s@StartExperiment' {} Maybe (HashMap Text Text)
a -> StartExperiment
s {$sel:tags:StartExperiment' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: StartExperiment) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StartExperiment -> f StartExperiment)
-> ((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)))
-> StartExperiment
-> f StartExperiment
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
startExperiment_clientToken :: Lens.Lens' StartExperiment Prelude.Text
startExperiment_clientToken :: (Text -> f Text) -> StartExperiment -> f StartExperiment
startExperiment_clientToken = (StartExperiment -> Text)
-> (StartExperiment -> Text -> StartExperiment)
-> Lens StartExperiment StartExperiment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExperiment' {Text
clientToken :: Text
$sel:clientToken:StartExperiment' :: StartExperiment -> Text
clientToken} -> Text
clientToken) (\s :: StartExperiment
s@StartExperiment' {} Text
a -> StartExperiment
s {$sel:clientToken:StartExperiment' :: Text
clientToken = Text
a} :: StartExperiment)
startExperiment_experimentTemplateId :: Lens.Lens' StartExperiment Prelude.Text
startExperiment_experimentTemplateId :: (Text -> f Text) -> StartExperiment -> f StartExperiment
startExperiment_experimentTemplateId = (StartExperiment -> Text)
-> (StartExperiment -> Text -> StartExperiment)
-> Lens StartExperiment StartExperiment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExperiment' {Text
experimentTemplateId :: Text
$sel:experimentTemplateId:StartExperiment' :: StartExperiment -> Text
experimentTemplateId} -> Text
experimentTemplateId) (\s :: StartExperiment
s@StartExperiment' {} Text
a -> StartExperiment
s {$sel:experimentTemplateId:StartExperiment' :: Text
experimentTemplateId = Text
a} :: StartExperiment)
instance Core.AWSRequest StartExperiment where
type
AWSResponse StartExperiment =
StartExperimentResponse
request :: StartExperiment -> Request StartExperiment
request = Service -> StartExperiment -> Request StartExperiment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartExperiment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartExperiment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartExperiment))
-> Logger
-> Service
-> Proxy StartExperiment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartExperiment)))
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 Experiment -> Int -> StartExperimentResponse
StartExperimentResponse'
(Maybe Experiment -> Int -> StartExperimentResponse)
-> Either String (Maybe Experiment)
-> Either String (Int -> StartExperimentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Experiment)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"experiment")
Either String (Int -> StartExperimentResponse)
-> Either String Int -> Either String StartExperimentResponse
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 StartExperiment
instance Prelude.NFData StartExperiment
instance Core.ToHeaders StartExperiment where
toHeaders :: StartExperiment -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartExperiment -> 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 StartExperiment where
toJSON :: StartExperiment -> Value
toJSON StartExperiment' {Maybe (HashMap Text Text)
Text
experimentTemplateId :: Text
clientToken :: Text
tags :: Maybe (HashMap Text Text)
$sel:experimentTemplateId:StartExperiment' :: StartExperiment -> Text
$sel:clientToken:StartExperiment' :: StartExperiment -> Text
$sel:tags:StartExperiment' :: StartExperiment -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"experimentTemplateId"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
experimentTemplateId
)
]
)
instance Core.ToPath StartExperiment where
toPath :: StartExperiment -> ByteString
toPath = ByteString -> StartExperiment -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/experiments"
instance Core.ToQuery StartExperiment where
toQuery :: StartExperiment -> QueryString
toQuery = QueryString -> StartExperiment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartExperimentResponse = StartExperimentResponse'
{
StartExperimentResponse -> Maybe Experiment
experiment :: Prelude.Maybe Experiment,
StartExperimentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartExperimentResponse -> StartExperimentResponse -> Bool
(StartExperimentResponse -> StartExperimentResponse -> Bool)
-> (StartExperimentResponse -> StartExperimentResponse -> Bool)
-> Eq StartExperimentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartExperimentResponse -> StartExperimentResponse -> Bool
$c/= :: StartExperimentResponse -> StartExperimentResponse -> Bool
== :: StartExperimentResponse -> StartExperimentResponse -> Bool
$c== :: StartExperimentResponse -> StartExperimentResponse -> Bool
Prelude.Eq, ReadPrec [StartExperimentResponse]
ReadPrec StartExperimentResponse
Int -> ReadS StartExperimentResponse
ReadS [StartExperimentResponse]
(Int -> ReadS StartExperimentResponse)
-> ReadS [StartExperimentResponse]
-> ReadPrec StartExperimentResponse
-> ReadPrec [StartExperimentResponse]
-> Read StartExperimentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartExperimentResponse]
$creadListPrec :: ReadPrec [StartExperimentResponse]
readPrec :: ReadPrec StartExperimentResponse
$creadPrec :: ReadPrec StartExperimentResponse
readList :: ReadS [StartExperimentResponse]
$creadList :: ReadS [StartExperimentResponse]
readsPrec :: Int -> ReadS StartExperimentResponse
$creadsPrec :: Int -> ReadS StartExperimentResponse
Prelude.Read, Int -> StartExperimentResponse -> ShowS
[StartExperimentResponse] -> ShowS
StartExperimentResponse -> String
(Int -> StartExperimentResponse -> ShowS)
-> (StartExperimentResponse -> String)
-> ([StartExperimentResponse] -> ShowS)
-> Show StartExperimentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartExperimentResponse] -> ShowS
$cshowList :: [StartExperimentResponse] -> ShowS
show :: StartExperimentResponse -> String
$cshow :: StartExperimentResponse -> String
showsPrec :: Int -> StartExperimentResponse -> ShowS
$cshowsPrec :: Int -> StartExperimentResponse -> ShowS
Prelude.Show, (forall x.
StartExperimentResponse -> Rep StartExperimentResponse x)
-> (forall x.
Rep StartExperimentResponse x -> StartExperimentResponse)
-> Generic StartExperimentResponse
forall x. Rep StartExperimentResponse x -> StartExperimentResponse
forall x. StartExperimentResponse -> Rep StartExperimentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartExperimentResponse x -> StartExperimentResponse
$cfrom :: forall x. StartExperimentResponse -> Rep StartExperimentResponse x
Prelude.Generic)
newStartExperimentResponse ::
Prelude.Int ->
StartExperimentResponse
newStartExperimentResponse :: Int -> StartExperimentResponse
newStartExperimentResponse Int
pHttpStatus_ =
StartExperimentResponse' :: Maybe Experiment -> Int -> StartExperimentResponse
StartExperimentResponse'
{ $sel:experiment:StartExperimentResponse' :: Maybe Experiment
experiment =
Maybe Experiment
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartExperimentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startExperimentResponse_experiment :: Lens.Lens' StartExperimentResponse (Prelude.Maybe Experiment)
startExperimentResponse_experiment :: (Maybe Experiment -> f (Maybe Experiment))
-> StartExperimentResponse -> f StartExperimentResponse
startExperimentResponse_experiment = (StartExperimentResponse -> Maybe Experiment)
-> (StartExperimentResponse
-> Maybe Experiment -> StartExperimentResponse)
-> Lens
StartExperimentResponse
StartExperimentResponse
(Maybe Experiment)
(Maybe Experiment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExperimentResponse' {Maybe Experiment
experiment :: Maybe Experiment
$sel:experiment:StartExperimentResponse' :: StartExperimentResponse -> Maybe Experiment
experiment} -> Maybe Experiment
experiment) (\s :: StartExperimentResponse
s@StartExperimentResponse' {} Maybe Experiment
a -> StartExperimentResponse
s {$sel:experiment:StartExperimentResponse' :: Maybe Experiment
experiment = Maybe Experiment
a} :: StartExperimentResponse)
startExperimentResponse_httpStatus :: Lens.Lens' StartExperimentResponse Prelude.Int
startExperimentResponse_httpStatus :: (Int -> f Int)
-> StartExperimentResponse -> f StartExperimentResponse
startExperimentResponse_httpStatus = (StartExperimentResponse -> Int)
-> (StartExperimentResponse -> Int -> StartExperimentResponse)
-> Lens StartExperimentResponse StartExperimentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExperimentResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartExperimentResponse' :: StartExperimentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartExperimentResponse
s@StartExperimentResponse' {} Int
a -> StartExperimentResponse
s {$sel:httpStatus:StartExperimentResponse' :: Int
httpStatus = Int
a} :: StartExperimentResponse)
instance Prelude.NFData StartExperimentResponse