{-# 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.Personalize.DescribeRecipe
(
DescribeRecipe (..),
newDescribeRecipe,
describeRecipe_recipeArn,
DescribeRecipeResponse (..),
newDescribeRecipeResponse,
describeRecipeResponse_recipe,
describeRecipeResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeRecipe = DescribeRecipe'
{
DescribeRecipe -> Text
recipeArn :: Prelude.Text
}
deriving (DescribeRecipe -> DescribeRecipe -> Bool
(DescribeRecipe -> DescribeRecipe -> Bool)
-> (DescribeRecipe -> DescribeRecipe -> Bool) -> Eq DescribeRecipe
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRecipe -> DescribeRecipe -> Bool
$c/= :: DescribeRecipe -> DescribeRecipe -> Bool
== :: DescribeRecipe -> DescribeRecipe -> Bool
$c== :: DescribeRecipe -> DescribeRecipe -> Bool
Prelude.Eq, ReadPrec [DescribeRecipe]
ReadPrec DescribeRecipe
Int -> ReadS DescribeRecipe
ReadS [DescribeRecipe]
(Int -> ReadS DescribeRecipe)
-> ReadS [DescribeRecipe]
-> ReadPrec DescribeRecipe
-> ReadPrec [DescribeRecipe]
-> Read DescribeRecipe
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRecipe]
$creadListPrec :: ReadPrec [DescribeRecipe]
readPrec :: ReadPrec DescribeRecipe
$creadPrec :: ReadPrec DescribeRecipe
readList :: ReadS [DescribeRecipe]
$creadList :: ReadS [DescribeRecipe]
readsPrec :: Int -> ReadS DescribeRecipe
$creadsPrec :: Int -> ReadS DescribeRecipe
Prelude.Read, Int -> DescribeRecipe -> ShowS
[DescribeRecipe] -> ShowS
DescribeRecipe -> String
(Int -> DescribeRecipe -> ShowS)
-> (DescribeRecipe -> String)
-> ([DescribeRecipe] -> ShowS)
-> Show DescribeRecipe
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRecipe] -> ShowS
$cshowList :: [DescribeRecipe] -> ShowS
show :: DescribeRecipe -> String
$cshow :: DescribeRecipe -> String
showsPrec :: Int -> DescribeRecipe -> ShowS
$cshowsPrec :: Int -> DescribeRecipe -> ShowS
Prelude.Show, (forall x. DescribeRecipe -> Rep DescribeRecipe x)
-> (forall x. Rep DescribeRecipe x -> DescribeRecipe)
-> Generic DescribeRecipe
forall x. Rep DescribeRecipe x -> DescribeRecipe
forall x. DescribeRecipe -> Rep DescribeRecipe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeRecipe x -> DescribeRecipe
$cfrom :: forall x. DescribeRecipe -> Rep DescribeRecipe x
Prelude.Generic)
newDescribeRecipe ::
Prelude.Text ->
DescribeRecipe
newDescribeRecipe :: Text -> DescribeRecipe
newDescribeRecipe Text
pRecipeArn_ =
DescribeRecipe' :: Text -> DescribeRecipe
DescribeRecipe' {$sel:recipeArn:DescribeRecipe' :: Text
recipeArn = Text
pRecipeArn_}
describeRecipe_recipeArn :: Lens.Lens' DescribeRecipe Prelude.Text
describeRecipe_recipeArn :: (Text -> f Text) -> DescribeRecipe -> f DescribeRecipe
describeRecipe_recipeArn = (DescribeRecipe -> Text)
-> (DescribeRecipe -> Text -> DescribeRecipe)
-> Lens DescribeRecipe DescribeRecipe Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRecipe' {Text
recipeArn :: Text
$sel:recipeArn:DescribeRecipe' :: DescribeRecipe -> Text
recipeArn} -> Text
recipeArn) (\s :: DescribeRecipe
s@DescribeRecipe' {} Text
a -> DescribeRecipe
s {$sel:recipeArn:DescribeRecipe' :: Text
recipeArn = Text
a} :: DescribeRecipe)
instance Core.AWSRequest DescribeRecipe where
type
AWSResponse DescribeRecipe =
DescribeRecipeResponse
request :: DescribeRecipe -> Request DescribeRecipe
request = Service -> DescribeRecipe -> Request DescribeRecipe
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeRecipe
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeRecipe)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeRecipe))
-> Logger
-> Service
-> Proxy DescribeRecipe
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeRecipe)))
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 Recipe -> Int -> DescribeRecipeResponse
DescribeRecipeResponse'
(Maybe Recipe -> Int -> DescribeRecipeResponse)
-> Either String (Maybe Recipe)
-> Either String (Int -> DescribeRecipeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Recipe)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"recipe")
Either String (Int -> DescribeRecipeResponse)
-> Either String Int -> Either String DescribeRecipeResponse
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 DescribeRecipe
instance Prelude.NFData DescribeRecipe
instance Core.ToHeaders DescribeRecipe where
toHeaders :: DescribeRecipe -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeRecipe -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonPersonalize.DescribeRecipe" ::
Prelude.ByteString
),
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 DescribeRecipe where
toJSON :: DescribeRecipe -> Value
toJSON DescribeRecipe' {Text
recipeArn :: Text
$sel:recipeArn:DescribeRecipe' :: DescribeRecipe -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"recipeArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
recipeArn)]
)
instance Core.ToPath DescribeRecipe where
toPath :: DescribeRecipe -> ByteString
toPath = ByteString -> DescribeRecipe -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeRecipe where
toQuery :: DescribeRecipe -> QueryString
toQuery = QueryString -> DescribeRecipe -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeRecipeResponse = DescribeRecipeResponse'
{
DescribeRecipeResponse -> Maybe Recipe
recipe :: Prelude.Maybe Recipe,
DescribeRecipeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeRecipeResponse -> DescribeRecipeResponse -> Bool
(DescribeRecipeResponse -> DescribeRecipeResponse -> Bool)
-> (DescribeRecipeResponse -> DescribeRecipeResponse -> Bool)
-> Eq DescribeRecipeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRecipeResponse -> DescribeRecipeResponse -> Bool
$c/= :: DescribeRecipeResponse -> DescribeRecipeResponse -> Bool
== :: DescribeRecipeResponse -> DescribeRecipeResponse -> Bool
$c== :: DescribeRecipeResponse -> DescribeRecipeResponse -> Bool
Prelude.Eq, ReadPrec [DescribeRecipeResponse]
ReadPrec DescribeRecipeResponse
Int -> ReadS DescribeRecipeResponse
ReadS [DescribeRecipeResponse]
(Int -> ReadS DescribeRecipeResponse)
-> ReadS [DescribeRecipeResponse]
-> ReadPrec DescribeRecipeResponse
-> ReadPrec [DescribeRecipeResponse]
-> Read DescribeRecipeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRecipeResponse]
$creadListPrec :: ReadPrec [DescribeRecipeResponse]
readPrec :: ReadPrec DescribeRecipeResponse
$creadPrec :: ReadPrec DescribeRecipeResponse
readList :: ReadS [DescribeRecipeResponse]
$creadList :: ReadS [DescribeRecipeResponse]
readsPrec :: Int -> ReadS DescribeRecipeResponse
$creadsPrec :: Int -> ReadS DescribeRecipeResponse
Prelude.Read, Int -> DescribeRecipeResponse -> ShowS
[DescribeRecipeResponse] -> ShowS
DescribeRecipeResponse -> String
(Int -> DescribeRecipeResponse -> ShowS)
-> (DescribeRecipeResponse -> String)
-> ([DescribeRecipeResponse] -> ShowS)
-> Show DescribeRecipeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRecipeResponse] -> ShowS
$cshowList :: [DescribeRecipeResponse] -> ShowS
show :: DescribeRecipeResponse -> String
$cshow :: DescribeRecipeResponse -> String
showsPrec :: Int -> DescribeRecipeResponse -> ShowS
$cshowsPrec :: Int -> DescribeRecipeResponse -> ShowS
Prelude.Show, (forall x. DescribeRecipeResponse -> Rep DescribeRecipeResponse x)
-> (forall x.
Rep DescribeRecipeResponse x -> DescribeRecipeResponse)
-> Generic DescribeRecipeResponse
forall x. Rep DescribeRecipeResponse x -> DescribeRecipeResponse
forall x. DescribeRecipeResponse -> Rep DescribeRecipeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeRecipeResponse x -> DescribeRecipeResponse
$cfrom :: forall x. DescribeRecipeResponse -> Rep DescribeRecipeResponse x
Prelude.Generic)
newDescribeRecipeResponse ::
Prelude.Int ->
DescribeRecipeResponse
newDescribeRecipeResponse :: Int -> DescribeRecipeResponse
newDescribeRecipeResponse Int
pHttpStatus_ =
DescribeRecipeResponse' :: Maybe Recipe -> Int -> DescribeRecipeResponse
DescribeRecipeResponse'
{ $sel:recipe:DescribeRecipeResponse' :: Maybe Recipe
recipe = Maybe Recipe
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeRecipeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeRecipeResponse_recipe :: Lens.Lens' DescribeRecipeResponse (Prelude.Maybe Recipe)
describeRecipeResponse_recipe :: (Maybe Recipe -> f (Maybe Recipe))
-> DescribeRecipeResponse -> f DescribeRecipeResponse
describeRecipeResponse_recipe = (DescribeRecipeResponse -> Maybe Recipe)
-> (DescribeRecipeResponse
-> Maybe Recipe -> DescribeRecipeResponse)
-> Lens
DescribeRecipeResponse
DescribeRecipeResponse
(Maybe Recipe)
(Maybe Recipe)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRecipeResponse' {Maybe Recipe
recipe :: Maybe Recipe
$sel:recipe:DescribeRecipeResponse' :: DescribeRecipeResponse -> Maybe Recipe
recipe} -> Maybe Recipe
recipe) (\s :: DescribeRecipeResponse
s@DescribeRecipeResponse' {} Maybe Recipe
a -> DescribeRecipeResponse
s {$sel:recipe:DescribeRecipeResponse' :: Maybe Recipe
recipe = Maybe Recipe
a} :: DescribeRecipeResponse)
describeRecipeResponse_httpStatus :: Lens.Lens' DescribeRecipeResponse Prelude.Int
describeRecipeResponse_httpStatus :: (Int -> f Int)
-> DescribeRecipeResponse -> f DescribeRecipeResponse
describeRecipeResponse_httpStatus = (DescribeRecipeResponse -> Int)
-> (DescribeRecipeResponse -> Int -> DescribeRecipeResponse)
-> Lens DescribeRecipeResponse DescribeRecipeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRecipeResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeRecipeResponse' :: DescribeRecipeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeRecipeResponse
s@DescribeRecipeResponse' {} Int
a -> DescribeRecipeResponse
s {$sel:httpStatus:DescribeRecipeResponse' :: Int
httpStatus = Int
a} :: DescribeRecipeResponse)
instance Prelude.NFData DescribeRecipeResponse