{-# 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.GetExperimentTemplate
(
GetExperimentTemplate (..),
newGetExperimentTemplate,
getExperimentTemplate_id,
GetExperimentTemplateResponse (..),
newGetExperimentTemplateResponse,
getExperimentTemplateResponse_experimentTemplate,
getExperimentTemplateResponse_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 GetExperimentTemplate = GetExperimentTemplate'
{
GetExperimentTemplate -> Text
id :: Prelude.Text
}
deriving (GetExperimentTemplate -> GetExperimentTemplate -> Bool
(GetExperimentTemplate -> GetExperimentTemplate -> Bool)
-> (GetExperimentTemplate -> GetExperimentTemplate -> Bool)
-> Eq GetExperimentTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetExperimentTemplate -> GetExperimentTemplate -> Bool
$c/= :: GetExperimentTemplate -> GetExperimentTemplate -> Bool
== :: GetExperimentTemplate -> GetExperimentTemplate -> Bool
$c== :: GetExperimentTemplate -> GetExperimentTemplate -> Bool
Prelude.Eq, ReadPrec [GetExperimentTemplate]
ReadPrec GetExperimentTemplate
Int -> ReadS GetExperimentTemplate
ReadS [GetExperimentTemplate]
(Int -> ReadS GetExperimentTemplate)
-> ReadS [GetExperimentTemplate]
-> ReadPrec GetExperimentTemplate
-> ReadPrec [GetExperimentTemplate]
-> Read GetExperimentTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetExperimentTemplate]
$creadListPrec :: ReadPrec [GetExperimentTemplate]
readPrec :: ReadPrec GetExperimentTemplate
$creadPrec :: ReadPrec GetExperimentTemplate
readList :: ReadS [GetExperimentTemplate]
$creadList :: ReadS [GetExperimentTemplate]
readsPrec :: Int -> ReadS GetExperimentTemplate
$creadsPrec :: Int -> ReadS GetExperimentTemplate
Prelude.Read, Int -> GetExperimentTemplate -> ShowS
[GetExperimentTemplate] -> ShowS
GetExperimentTemplate -> String
(Int -> GetExperimentTemplate -> ShowS)
-> (GetExperimentTemplate -> String)
-> ([GetExperimentTemplate] -> ShowS)
-> Show GetExperimentTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetExperimentTemplate] -> ShowS
$cshowList :: [GetExperimentTemplate] -> ShowS
show :: GetExperimentTemplate -> String
$cshow :: GetExperimentTemplate -> String
showsPrec :: Int -> GetExperimentTemplate -> ShowS
$cshowsPrec :: Int -> GetExperimentTemplate -> ShowS
Prelude.Show, (forall x. GetExperimentTemplate -> Rep GetExperimentTemplate x)
-> (forall x. Rep GetExperimentTemplate x -> GetExperimentTemplate)
-> Generic GetExperimentTemplate
forall x. Rep GetExperimentTemplate x -> GetExperimentTemplate
forall x. GetExperimentTemplate -> Rep GetExperimentTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetExperimentTemplate x -> GetExperimentTemplate
$cfrom :: forall x. GetExperimentTemplate -> Rep GetExperimentTemplate x
Prelude.Generic)
newGetExperimentTemplate ::
Prelude.Text ->
GetExperimentTemplate
newGetExperimentTemplate :: Text -> GetExperimentTemplate
newGetExperimentTemplate Text
pId_ =
GetExperimentTemplate' :: Text -> GetExperimentTemplate
GetExperimentTemplate' {$sel:id:GetExperimentTemplate' :: Text
id = Text
pId_}
getExperimentTemplate_id :: Lens.Lens' GetExperimentTemplate Prelude.Text
getExperimentTemplate_id :: (Text -> f Text)
-> GetExperimentTemplate -> f GetExperimentTemplate
getExperimentTemplate_id = (GetExperimentTemplate -> Text)
-> (GetExperimentTemplate -> Text -> GetExperimentTemplate)
-> Lens GetExperimentTemplate GetExperimentTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExperimentTemplate' {Text
id :: Text
$sel:id:GetExperimentTemplate' :: GetExperimentTemplate -> Text
id} -> Text
id) (\s :: GetExperimentTemplate
s@GetExperimentTemplate' {} Text
a -> GetExperimentTemplate
s {$sel:id:GetExperimentTemplate' :: Text
id = Text
a} :: GetExperimentTemplate)
instance Core.AWSRequest GetExperimentTemplate where
type
AWSResponse GetExperimentTemplate =
GetExperimentTemplateResponse
request :: GetExperimentTemplate -> Request GetExperimentTemplate
request = Service -> GetExperimentTemplate -> Request GetExperimentTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetExperimentTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetExperimentTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetExperimentTemplate))
-> Logger
-> Service
-> Proxy GetExperimentTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetExperimentTemplate)))
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 -> GetExperimentTemplateResponse
GetExperimentTemplateResponse'
(Maybe ExperimentTemplate -> Int -> GetExperimentTemplateResponse)
-> Either String (Maybe ExperimentTemplate)
-> Either String (Int -> GetExperimentTemplateResponse)
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 -> GetExperimentTemplateResponse)
-> Either String Int -> Either String GetExperimentTemplateResponse
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 GetExperimentTemplate
instance Prelude.NFData GetExperimentTemplate
instance Core.ToHeaders GetExperimentTemplate where
toHeaders :: GetExperimentTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetExperimentTemplate -> 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.ToPath GetExperimentTemplate where
toPath :: GetExperimentTemplate -> ByteString
toPath GetExperimentTemplate' {Text
id :: Text
$sel:id:GetExperimentTemplate' :: GetExperimentTemplate -> Text
..} =
[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 GetExperimentTemplate where
toQuery :: GetExperimentTemplate -> QueryString
toQuery = QueryString -> GetExperimentTemplate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetExperimentTemplateResponse = GetExperimentTemplateResponse'
{
GetExperimentTemplateResponse -> Maybe ExperimentTemplate
experimentTemplate :: Prelude.Maybe ExperimentTemplate,
GetExperimentTemplateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetExperimentTemplateResponse
-> GetExperimentTemplateResponse -> Bool
(GetExperimentTemplateResponse
-> GetExperimentTemplateResponse -> Bool)
-> (GetExperimentTemplateResponse
-> GetExperimentTemplateResponse -> Bool)
-> Eq GetExperimentTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetExperimentTemplateResponse
-> GetExperimentTemplateResponse -> Bool
$c/= :: GetExperimentTemplateResponse
-> GetExperimentTemplateResponse -> Bool
== :: GetExperimentTemplateResponse
-> GetExperimentTemplateResponse -> Bool
$c== :: GetExperimentTemplateResponse
-> GetExperimentTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetExperimentTemplateResponse]
ReadPrec GetExperimentTemplateResponse
Int -> ReadS GetExperimentTemplateResponse
ReadS [GetExperimentTemplateResponse]
(Int -> ReadS GetExperimentTemplateResponse)
-> ReadS [GetExperimentTemplateResponse]
-> ReadPrec GetExperimentTemplateResponse
-> ReadPrec [GetExperimentTemplateResponse]
-> Read GetExperimentTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetExperimentTemplateResponse]
$creadListPrec :: ReadPrec [GetExperimentTemplateResponse]
readPrec :: ReadPrec GetExperimentTemplateResponse
$creadPrec :: ReadPrec GetExperimentTemplateResponse
readList :: ReadS [GetExperimentTemplateResponse]
$creadList :: ReadS [GetExperimentTemplateResponse]
readsPrec :: Int -> ReadS GetExperimentTemplateResponse
$creadsPrec :: Int -> ReadS GetExperimentTemplateResponse
Prelude.Read, Int -> GetExperimentTemplateResponse -> ShowS
[GetExperimentTemplateResponse] -> ShowS
GetExperimentTemplateResponse -> String
(Int -> GetExperimentTemplateResponse -> ShowS)
-> (GetExperimentTemplateResponse -> String)
-> ([GetExperimentTemplateResponse] -> ShowS)
-> Show GetExperimentTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetExperimentTemplateResponse] -> ShowS
$cshowList :: [GetExperimentTemplateResponse] -> ShowS
show :: GetExperimentTemplateResponse -> String
$cshow :: GetExperimentTemplateResponse -> String
showsPrec :: Int -> GetExperimentTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetExperimentTemplateResponse -> ShowS
Prelude.Show, (forall x.
GetExperimentTemplateResponse
-> Rep GetExperimentTemplateResponse x)
-> (forall x.
Rep GetExperimentTemplateResponse x
-> GetExperimentTemplateResponse)
-> Generic GetExperimentTemplateResponse
forall x.
Rep GetExperimentTemplateResponse x
-> GetExperimentTemplateResponse
forall x.
GetExperimentTemplateResponse
-> Rep GetExperimentTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetExperimentTemplateResponse x
-> GetExperimentTemplateResponse
$cfrom :: forall x.
GetExperimentTemplateResponse
-> Rep GetExperimentTemplateResponse x
Prelude.Generic)
newGetExperimentTemplateResponse ::
Prelude.Int ->
GetExperimentTemplateResponse
newGetExperimentTemplateResponse :: Int -> GetExperimentTemplateResponse
newGetExperimentTemplateResponse Int
pHttpStatus_ =
GetExperimentTemplateResponse' :: Maybe ExperimentTemplate -> Int -> GetExperimentTemplateResponse
GetExperimentTemplateResponse'
{ $sel:experimentTemplate:GetExperimentTemplateResponse' :: Maybe ExperimentTemplate
experimentTemplate =
Maybe ExperimentTemplate
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetExperimentTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getExperimentTemplateResponse_experimentTemplate :: Lens.Lens' GetExperimentTemplateResponse (Prelude.Maybe ExperimentTemplate)
getExperimentTemplateResponse_experimentTemplate :: (Maybe ExperimentTemplate -> f (Maybe ExperimentTemplate))
-> GetExperimentTemplateResponse -> f GetExperimentTemplateResponse
getExperimentTemplateResponse_experimentTemplate = (GetExperimentTemplateResponse -> Maybe ExperimentTemplate)
-> (GetExperimentTemplateResponse
-> Maybe ExperimentTemplate -> GetExperimentTemplateResponse)
-> Lens
GetExperimentTemplateResponse
GetExperimentTemplateResponse
(Maybe ExperimentTemplate)
(Maybe ExperimentTemplate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExperimentTemplateResponse' {Maybe ExperimentTemplate
experimentTemplate :: Maybe ExperimentTemplate
$sel:experimentTemplate:GetExperimentTemplateResponse' :: GetExperimentTemplateResponse -> Maybe ExperimentTemplate
experimentTemplate} -> Maybe ExperimentTemplate
experimentTemplate) (\s :: GetExperimentTemplateResponse
s@GetExperimentTemplateResponse' {} Maybe ExperimentTemplate
a -> GetExperimentTemplateResponse
s {$sel:experimentTemplate:GetExperimentTemplateResponse' :: Maybe ExperimentTemplate
experimentTemplate = Maybe ExperimentTemplate
a} :: GetExperimentTemplateResponse)
getExperimentTemplateResponse_httpStatus :: Lens.Lens' GetExperimentTemplateResponse Prelude.Int
getExperimentTemplateResponse_httpStatus :: (Int -> f Int)
-> GetExperimentTemplateResponse -> f GetExperimentTemplateResponse
getExperimentTemplateResponse_httpStatus = (GetExperimentTemplateResponse -> Int)
-> (GetExperimentTemplateResponse
-> Int -> GetExperimentTemplateResponse)
-> Lens
GetExperimentTemplateResponse GetExperimentTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExperimentTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetExperimentTemplateResponse' :: GetExperimentTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetExperimentTemplateResponse
s@GetExperimentTemplateResponse' {} Int
a -> GetExperimentTemplateResponse
s {$sel:httpStatus:GetExperimentTemplateResponse' :: Int
httpStatus = Int
a} :: GetExperimentTemplateResponse)
instance Prelude.NFData GetExperimentTemplateResponse