{-# 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.GetExperiment
(
GetExperiment (..),
newGetExperiment,
getExperiment_id,
GetExperimentResponse (..),
newGetExperimentResponse,
getExperimentResponse_experiment,
getExperimentResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FIS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetExperiment = GetExperiment'
{
GetExperiment -> Text
id :: Prelude.Text
}
deriving (GetExperiment -> GetExperiment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetExperiment -> GetExperiment -> Bool
$c/= :: GetExperiment -> GetExperiment -> Bool
== :: GetExperiment -> GetExperiment -> Bool
$c== :: GetExperiment -> GetExperiment -> Bool
Prelude.Eq, ReadPrec [GetExperiment]
ReadPrec GetExperiment
Int -> ReadS GetExperiment
ReadS [GetExperiment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetExperiment]
$creadListPrec :: ReadPrec [GetExperiment]
readPrec :: ReadPrec GetExperiment
$creadPrec :: ReadPrec GetExperiment
readList :: ReadS [GetExperiment]
$creadList :: ReadS [GetExperiment]
readsPrec :: Int -> ReadS GetExperiment
$creadsPrec :: Int -> ReadS GetExperiment
Prelude.Read, Int -> GetExperiment -> ShowS
[GetExperiment] -> ShowS
GetExperiment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetExperiment] -> ShowS
$cshowList :: [GetExperiment] -> ShowS
show :: GetExperiment -> String
$cshow :: GetExperiment -> String
showsPrec :: Int -> GetExperiment -> ShowS
$cshowsPrec :: Int -> GetExperiment -> ShowS
Prelude.Show, forall x. Rep GetExperiment x -> GetExperiment
forall x. GetExperiment -> Rep GetExperiment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetExperiment x -> GetExperiment
$cfrom :: forall x. GetExperiment -> Rep GetExperiment x
Prelude.Generic)
newGetExperiment ::
Prelude.Text ->
GetExperiment
newGetExperiment :: Text -> GetExperiment
newGetExperiment Text
pId_ = GetExperiment' {$sel:id:GetExperiment' :: Text
id = Text
pId_}
getExperiment_id :: Lens.Lens' GetExperiment Prelude.Text
getExperiment_id :: Lens' GetExperiment Text
getExperiment_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExperiment' {Text
id :: Text
$sel:id:GetExperiment' :: GetExperiment -> Text
id} -> Text
id) (\s :: GetExperiment
s@GetExperiment' {} Text
a -> GetExperiment
s {$sel:id:GetExperiment' :: Text
id = Text
a} :: GetExperiment)
instance Core.AWSRequest GetExperiment where
type
AWSResponse GetExperiment =
GetExperimentResponse
request :: (Service -> Service) -> GetExperiment -> Request GetExperiment
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetExperiment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetExperiment)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Experiment -> Int -> GetExperimentResponse
GetExperimentResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"experiment")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetExperiment where
hashWithSalt :: Int -> GetExperiment -> Int
hashWithSalt Int
_salt GetExperiment' {Text
id :: Text
$sel:id:GetExperiment' :: GetExperiment -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetExperiment where
rnf :: GetExperiment -> ()
rnf GetExperiment' {Text
id :: Text
$sel:id:GetExperiment' :: GetExperiment -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetExperiment where
toHeaders :: GetExperiment -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetExperiment where
toPath :: GetExperiment -> ByteString
toPath GetExperiment' {Text
id :: Text
$sel:id:GetExperiment' :: GetExperiment -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/experiments/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id]
instance Data.ToQuery GetExperiment where
toQuery :: GetExperiment -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetExperimentResponse = GetExperimentResponse'
{
GetExperimentResponse -> Maybe Experiment
experiment :: Prelude.Maybe Experiment,
GetExperimentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetExperimentResponse -> GetExperimentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetExperimentResponse -> GetExperimentResponse -> Bool
$c/= :: GetExperimentResponse -> GetExperimentResponse -> Bool
== :: GetExperimentResponse -> GetExperimentResponse -> Bool
$c== :: GetExperimentResponse -> GetExperimentResponse -> Bool
Prelude.Eq, ReadPrec [GetExperimentResponse]
ReadPrec GetExperimentResponse
Int -> ReadS GetExperimentResponse
ReadS [GetExperimentResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetExperimentResponse]
$creadListPrec :: ReadPrec [GetExperimentResponse]
readPrec :: ReadPrec GetExperimentResponse
$creadPrec :: ReadPrec GetExperimentResponse
readList :: ReadS [GetExperimentResponse]
$creadList :: ReadS [GetExperimentResponse]
readsPrec :: Int -> ReadS GetExperimentResponse
$creadsPrec :: Int -> ReadS GetExperimentResponse
Prelude.Read, Int -> GetExperimentResponse -> ShowS
[GetExperimentResponse] -> ShowS
GetExperimentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetExperimentResponse] -> ShowS
$cshowList :: [GetExperimentResponse] -> ShowS
show :: GetExperimentResponse -> String
$cshow :: GetExperimentResponse -> String
showsPrec :: Int -> GetExperimentResponse -> ShowS
$cshowsPrec :: Int -> GetExperimentResponse -> ShowS
Prelude.Show, forall x. Rep GetExperimentResponse x -> GetExperimentResponse
forall x. GetExperimentResponse -> Rep GetExperimentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetExperimentResponse x -> GetExperimentResponse
$cfrom :: forall x. GetExperimentResponse -> Rep GetExperimentResponse x
Prelude.Generic)
newGetExperimentResponse ::
Prelude.Int ->
GetExperimentResponse
newGetExperimentResponse :: Int -> GetExperimentResponse
newGetExperimentResponse Int
pHttpStatus_ =
GetExperimentResponse'
{ $sel:experiment:GetExperimentResponse' :: Maybe Experiment
experiment =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetExperimentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getExperimentResponse_experiment :: Lens.Lens' GetExperimentResponse (Prelude.Maybe Experiment)
getExperimentResponse_experiment :: Lens' GetExperimentResponse (Maybe Experiment)
getExperimentResponse_experiment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExperimentResponse' {Maybe Experiment
experiment :: Maybe Experiment
$sel:experiment:GetExperimentResponse' :: GetExperimentResponse -> Maybe Experiment
experiment} -> Maybe Experiment
experiment) (\s :: GetExperimentResponse
s@GetExperimentResponse' {} Maybe Experiment
a -> GetExperimentResponse
s {$sel:experiment:GetExperimentResponse' :: Maybe Experiment
experiment = Maybe Experiment
a} :: GetExperimentResponse)
getExperimentResponse_httpStatus :: Lens.Lens' GetExperimentResponse Prelude.Int
getExperimentResponse_httpStatus :: Lens' GetExperimentResponse Int
getExperimentResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExperimentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetExperimentResponse' :: GetExperimentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetExperimentResponse
s@GetExperimentResponse' {} Int
a -> GetExperimentResponse
s {$sel:httpStatus:GetExperimentResponse' :: Int
httpStatus = Int
a} :: GetExperimentResponse)
instance Prelude.NFData GetExperimentResponse where
rnf :: GetExperimentResponse -> ()
rnf GetExperimentResponse' {Int
Maybe Experiment
httpStatus :: Int
experiment :: Maybe Experiment
$sel:httpStatus:GetExperimentResponse' :: GetExperimentResponse -> Int
$sel:experiment:GetExperimentResponse' :: GetExperimentResponse -> Maybe Experiment
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Experiment
experiment
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus