{-# 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.DataBrew.CreateRecipe
(
CreateRecipe (..),
newCreateRecipe,
createRecipe_description,
createRecipe_tags,
createRecipe_name,
createRecipe_steps,
CreateRecipeResponse (..),
newCreateRecipeResponse,
createRecipeResponse_httpStatus,
createRecipeResponse_name,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DataBrew.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 CreateRecipe = CreateRecipe'
{
CreateRecipe -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateRecipe -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateRecipe -> Text
name :: Prelude.Text,
CreateRecipe -> [RecipeStep]
steps :: [RecipeStep]
}
deriving (CreateRecipe -> CreateRecipe -> Bool
(CreateRecipe -> CreateRecipe -> Bool)
-> (CreateRecipe -> CreateRecipe -> Bool) -> Eq CreateRecipe
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRecipe -> CreateRecipe -> Bool
$c/= :: CreateRecipe -> CreateRecipe -> Bool
== :: CreateRecipe -> CreateRecipe -> Bool
$c== :: CreateRecipe -> CreateRecipe -> Bool
Prelude.Eq, ReadPrec [CreateRecipe]
ReadPrec CreateRecipe
Int -> ReadS CreateRecipe
ReadS [CreateRecipe]
(Int -> ReadS CreateRecipe)
-> ReadS [CreateRecipe]
-> ReadPrec CreateRecipe
-> ReadPrec [CreateRecipe]
-> Read CreateRecipe
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRecipe]
$creadListPrec :: ReadPrec [CreateRecipe]
readPrec :: ReadPrec CreateRecipe
$creadPrec :: ReadPrec CreateRecipe
readList :: ReadS [CreateRecipe]
$creadList :: ReadS [CreateRecipe]
readsPrec :: Int -> ReadS CreateRecipe
$creadsPrec :: Int -> ReadS CreateRecipe
Prelude.Read, Int -> CreateRecipe -> ShowS
[CreateRecipe] -> ShowS
CreateRecipe -> String
(Int -> CreateRecipe -> ShowS)
-> (CreateRecipe -> String)
-> ([CreateRecipe] -> ShowS)
-> Show CreateRecipe
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRecipe] -> ShowS
$cshowList :: [CreateRecipe] -> ShowS
show :: CreateRecipe -> String
$cshow :: CreateRecipe -> String
showsPrec :: Int -> CreateRecipe -> ShowS
$cshowsPrec :: Int -> CreateRecipe -> ShowS
Prelude.Show, (forall x. CreateRecipe -> Rep CreateRecipe x)
-> (forall x. Rep CreateRecipe x -> CreateRecipe)
-> Generic CreateRecipe
forall x. Rep CreateRecipe x -> CreateRecipe
forall x. CreateRecipe -> Rep CreateRecipe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRecipe x -> CreateRecipe
$cfrom :: forall x. CreateRecipe -> Rep CreateRecipe x
Prelude.Generic)
newCreateRecipe ::
Prelude.Text ->
CreateRecipe
newCreateRecipe :: Text -> CreateRecipe
newCreateRecipe Text
pName_ =
CreateRecipe' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> [RecipeStep]
-> CreateRecipe
CreateRecipe'
{ $sel:description:CreateRecipe' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateRecipe' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateRecipe' :: Text
name = Text
pName_,
$sel:steps:CreateRecipe' :: [RecipeStep]
steps = [RecipeStep]
forall a. Monoid a => a
Prelude.mempty
}
createRecipe_description :: Lens.Lens' CreateRecipe (Prelude.Maybe Prelude.Text)
createRecipe_description :: (Maybe Text -> f (Maybe Text)) -> CreateRecipe -> f CreateRecipe
createRecipe_description = (CreateRecipe -> Maybe Text)
-> (CreateRecipe -> Maybe Text -> CreateRecipe)
-> Lens CreateRecipe CreateRecipe (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRecipe' {Maybe Text
description :: Maybe Text
$sel:description:CreateRecipe' :: CreateRecipe -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateRecipe
s@CreateRecipe' {} Maybe Text
a -> CreateRecipe
s {$sel:description:CreateRecipe' :: Maybe Text
description = Maybe Text
a} :: CreateRecipe)
createRecipe_tags :: Lens.Lens' CreateRecipe (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createRecipe_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRecipe -> f CreateRecipe
createRecipe_tags = (CreateRecipe -> Maybe (HashMap Text Text))
-> (CreateRecipe -> Maybe (HashMap Text Text) -> CreateRecipe)
-> Lens
CreateRecipe
CreateRecipe
(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 (\CreateRecipe' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateRecipe' :: CreateRecipe -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateRecipe
s@CreateRecipe' {} Maybe (HashMap Text Text)
a -> CreateRecipe
s {$sel:tags:CreateRecipe' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateRecipe) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRecipe -> f CreateRecipe)
-> ((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)))
-> CreateRecipe
-> f CreateRecipe
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
createRecipe_name :: Lens.Lens' CreateRecipe Prelude.Text
createRecipe_name :: (Text -> f Text) -> CreateRecipe -> f CreateRecipe
createRecipe_name = (CreateRecipe -> Text)
-> (CreateRecipe -> Text -> CreateRecipe)
-> Lens CreateRecipe CreateRecipe Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRecipe' {Text
name :: Text
$sel:name:CreateRecipe' :: CreateRecipe -> Text
name} -> Text
name) (\s :: CreateRecipe
s@CreateRecipe' {} Text
a -> CreateRecipe
s {$sel:name:CreateRecipe' :: Text
name = Text
a} :: CreateRecipe)
createRecipe_steps :: Lens.Lens' CreateRecipe [RecipeStep]
createRecipe_steps :: ([RecipeStep] -> f [RecipeStep]) -> CreateRecipe -> f CreateRecipe
createRecipe_steps = (CreateRecipe -> [RecipeStep])
-> (CreateRecipe -> [RecipeStep] -> CreateRecipe)
-> Lens CreateRecipe CreateRecipe [RecipeStep] [RecipeStep]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRecipe' {[RecipeStep]
steps :: [RecipeStep]
$sel:steps:CreateRecipe' :: CreateRecipe -> [RecipeStep]
steps} -> [RecipeStep]
steps) (\s :: CreateRecipe
s@CreateRecipe' {} [RecipeStep]
a -> CreateRecipe
s {$sel:steps:CreateRecipe' :: [RecipeStep]
steps = [RecipeStep]
a} :: CreateRecipe) (([RecipeStep] -> f [RecipeStep])
-> CreateRecipe -> f CreateRecipe)
-> (([RecipeStep] -> f [RecipeStep])
-> [RecipeStep] -> f [RecipeStep])
-> ([RecipeStep] -> f [RecipeStep])
-> CreateRecipe
-> f CreateRecipe
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RecipeStep] -> f [RecipeStep]) -> [RecipeStep] -> f [RecipeStep]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateRecipe where
type AWSResponse CreateRecipe = CreateRecipeResponse
request :: CreateRecipe -> Request CreateRecipe
request = Service -> CreateRecipe -> Request CreateRecipe
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateRecipe
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRecipe)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateRecipe))
-> Logger
-> Service
-> Proxy CreateRecipe
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRecipe)))
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 ->
Int -> Text -> CreateRecipeResponse
CreateRecipeResponse'
(Int -> Text -> CreateRecipeResponse)
-> Either String Int
-> Either String (Text -> CreateRecipeResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (Text -> CreateRecipeResponse)
-> Either String Text -> Either String CreateRecipeResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Name")
)
instance Prelude.Hashable CreateRecipe
instance Prelude.NFData CreateRecipe
instance Core.ToHeaders CreateRecipe where
toHeaders :: CreateRecipe -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateRecipe -> 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 CreateRecipe where
toJSON :: CreateRecipe -> Value
toJSON CreateRecipe' {[RecipeStep]
Maybe Text
Maybe (HashMap Text Text)
Text
steps :: [RecipeStep]
name :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:steps:CreateRecipe' :: CreateRecipe -> [RecipeStep]
$sel:name:CreateRecipe' :: CreateRecipe -> Text
$sel:tags:CreateRecipe' :: CreateRecipe -> Maybe (HashMap Text Text)
$sel:description:CreateRecipe' :: CreateRecipe -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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
"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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Steps" Text -> [RecipeStep] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [RecipeStep]
steps)
]
)
instance Core.ToPath CreateRecipe where
toPath :: CreateRecipe -> ByteString
toPath = ByteString -> CreateRecipe -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/recipes"
instance Core.ToQuery CreateRecipe where
toQuery :: CreateRecipe -> QueryString
toQuery = QueryString -> CreateRecipe -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateRecipeResponse = CreateRecipeResponse'
{
CreateRecipeResponse -> Int
httpStatus :: Prelude.Int,
CreateRecipeResponse -> Text
name :: Prelude.Text
}
deriving (CreateRecipeResponse -> CreateRecipeResponse -> Bool
(CreateRecipeResponse -> CreateRecipeResponse -> Bool)
-> (CreateRecipeResponse -> CreateRecipeResponse -> Bool)
-> Eq CreateRecipeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRecipeResponse -> CreateRecipeResponse -> Bool
$c/= :: CreateRecipeResponse -> CreateRecipeResponse -> Bool
== :: CreateRecipeResponse -> CreateRecipeResponse -> Bool
$c== :: CreateRecipeResponse -> CreateRecipeResponse -> Bool
Prelude.Eq, ReadPrec [CreateRecipeResponse]
ReadPrec CreateRecipeResponse
Int -> ReadS CreateRecipeResponse
ReadS [CreateRecipeResponse]
(Int -> ReadS CreateRecipeResponse)
-> ReadS [CreateRecipeResponse]
-> ReadPrec CreateRecipeResponse
-> ReadPrec [CreateRecipeResponse]
-> Read CreateRecipeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRecipeResponse]
$creadListPrec :: ReadPrec [CreateRecipeResponse]
readPrec :: ReadPrec CreateRecipeResponse
$creadPrec :: ReadPrec CreateRecipeResponse
readList :: ReadS [CreateRecipeResponse]
$creadList :: ReadS [CreateRecipeResponse]
readsPrec :: Int -> ReadS CreateRecipeResponse
$creadsPrec :: Int -> ReadS CreateRecipeResponse
Prelude.Read, Int -> CreateRecipeResponse -> ShowS
[CreateRecipeResponse] -> ShowS
CreateRecipeResponse -> String
(Int -> CreateRecipeResponse -> ShowS)
-> (CreateRecipeResponse -> String)
-> ([CreateRecipeResponse] -> ShowS)
-> Show CreateRecipeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRecipeResponse] -> ShowS
$cshowList :: [CreateRecipeResponse] -> ShowS
show :: CreateRecipeResponse -> String
$cshow :: CreateRecipeResponse -> String
showsPrec :: Int -> CreateRecipeResponse -> ShowS
$cshowsPrec :: Int -> CreateRecipeResponse -> ShowS
Prelude.Show, (forall x. CreateRecipeResponse -> Rep CreateRecipeResponse x)
-> (forall x. Rep CreateRecipeResponse x -> CreateRecipeResponse)
-> Generic CreateRecipeResponse
forall x. Rep CreateRecipeResponse x -> CreateRecipeResponse
forall x. CreateRecipeResponse -> Rep CreateRecipeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRecipeResponse x -> CreateRecipeResponse
$cfrom :: forall x. CreateRecipeResponse -> Rep CreateRecipeResponse x
Prelude.Generic)
newCreateRecipeResponse ::
Prelude.Int ->
Prelude.Text ->
CreateRecipeResponse
newCreateRecipeResponse :: Int -> Text -> CreateRecipeResponse
newCreateRecipeResponse Int
pHttpStatus_ Text
pName_ =
CreateRecipeResponse' :: Int -> Text -> CreateRecipeResponse
CreateRecipeResponse'
{ $sel:httpStatus:CreateRecipeResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:name:CreateRecipeResponse' :: Text
name = Text
pName_
}
createRecipeResponse_httpStatus :: Lens.Lens' CreateRecipeResponse Prelude.Int
createRecipeResponse_httpStatus :: (Int -> f Int) -> CreateRecipeResponse -> f CreateRecipeResponse
createRecipeResponse_httpStatus = (CreateRecipeResponse -> Int)
-> (CreateRecipeResponse -> Int -> CreateRecipeResponse)
-> Lens CreateRecipeResponse CreateRecipeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRecipeResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateRecipeResponse' :: CreateRecipeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateRecipeResponse
s@CreateRecipeResponse' {} Int
a -> CreateRecipeResponse
s {$sel:httpStatus:CreateRecipeResponse' :: Int
httpStatus = Int
a} :: CreateRecipeResponse)
createRecipeResponse_name :: Lens.Lens' CreateRecipeResponse Prelude.Text
createRecipeResponse_name :: (Text -> f Text) -> CreateRecipeResponse -> f CreateRecipeResponse
createRecipeResponse_name = (CreateRecipeResponse -> Text)
-> (CreateRecipeResponse -> Text -> CreateRecipeResponse)
-> Lens CreateRecipeResponse CreateRecipeResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRecipeResponse' {Text
name :: Text
$sel:name:CreateRecipeResponse' :: CreateRecipeResponse -> Text
name} -> Text
name) (\s :: CreateRecipeResponse
s@CreateRecipeResponse' {} Text
a -> CreateRecipeResponse
s {$sel:name:CreateRecipeResponse' :: Text
name = Text
a} :: CreateRecipeResponse)
instance Prelude.NFData CreateRecipeResponse