{-# 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.UpdateRecipe
(
UpdateRecipe (..),
newUpdateRecipe,
updateRecipe_steps,
updateRecipe_description,
updateRecipe_name,
UpdateRecipeResponse (..),
newUpdateRecipeResponse,
updateRecipeResponse_httpStatus,
updateRecipeResponse_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 UpdateRecipe = UpdateRecipe'
{
UpdateRecipe -> Maybe [RecipeStep]
steps :: Prelude.Maybe [RecipeStep],
UpdateRecipe -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateRecipe -> Text
name :: Prelude.Text
}
deriving (UpdateRecipe -> UpdateRecipe -> Bool
(UpdateRecipe -> UpdateRecipe -> Bool)
-> (UpdateRecipe -> UpdateRecipe -> Bool) -> Eq UpdateRecipe
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRecipe -> UpdateRecipe -> Bool
$c/= :: UpdateRecipe -> UpdateRecipe -> Bool
== :: UpdateRecipe -> UpdateRecipe -> Bool
$c== :: UpdateRecipe -> UpdateRecipe -> Bool
Prelude.Eq, ReadPrec [UpdateRecipe]
ReadPrec UpdateRecipe
Int -> ReadS UpdateRecipe
ReadS [UpdateRecipe]
(Int -> ReadS UpdateRecipe)
-> ReadS [UpdateRecipe]
-> ReadPrec UpdateRecipe
-> ReadPrec [UpdateRecipe]
-> Read UpdateRecipe
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRecipe]
$creadListPrec :: ReadPrec [UpdateRecipe]
readPrec :: ReadPrec UpdateRecipe
$creadPrec :: ReadPrec UpdateRecipe
readList :: ReadS [UpdateRecipe]
$creadList :: ReadS [UpdateRecipe]
readsPrec :: Int -> ReadS UpdateRecipe
$creadsPrec :: Int -> ReadS UpdateRecipe
Prelude.Read, Int -> UpdateRecipe -> ShowS
[UpdateRecipe] -> ShowS
UpdateRecipe -> String
(Int -> UpdateRecipe -> ShowS)
-> (UpdateRecipe -> String)
-> ([UpdateRecipe] -> ShowS)
-> Show UpdateRecipe
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRecipe] -> ShowS
$cshowList :: [UpdateRecipe] -> ShowS
show :: UpdateRecipe -> String
$cshow :: UpdateRecipe -> String
showsPrec :: Int -> UpdateRecipe -> ShowS
$cshowsPrec :: Int -> UpdateRecipe -> ShowS
Prelude.Show, (forall x. UpdateRecipe -> Rep UpdateRecipe x)
-> (forall x. Rep UpdateRecipe x -> UpdateRecipe)
-> Generic UpdateRecipe
forall x. Rep UpdateRecipe x -> UpdateRecipe
forall x. UpdateRecipe -> Rep UpdateRecipe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRecipe x -> UpdateRecipe
$cfrom :: forall x. UpdateRecipe -> Rep UpdateRecipe x
Prelude.Generic)
newUpdateRecipe ::
Prelude.Text ->
UpdateRecipe
newUpdateRecipe :: Text -> UpdateRecipe
newUpdateRecipe Text
pName_ =
UpdateRecipe' :: Maybe [RecipeStep] -> Maybe Text -> Text -> UpdateRecipe
UpdateRecipe'
{ $sel:steps:UpdateRecipe' :: Maybe [RecipeStep]
steps = Maybe [RecipeStep]
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateRecipe' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateRecipe' :: Text
name = Text
pName_
}
updateRecipe_steps :: Lens.Lens' UpdateRecipe (Prelude.Maybe [RecipeStep])
updateRecipe_steps :: (Maybe [RecipeStep] -> f (Maybe [RecipeStep]))
-> UpdateRecipe -> f UpdateRecipe
updateRecipe_steps = (UpdateRecipe -> Maybe [RecipeStep])
-> (UpdateRecipe -> Maybe [RecipeStep] -> UpdateRecipe)
-> Lens
UpdateRecipe UpdateRecipe (Maybe [RecipeStep]) (Maybe [RecipeStep])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRecipe' {Maybe [RecipeStep]
steps :: Maybe [RecipeStep]
$sel:steps:UpdateRecipe' :: UpdateRecipe -> Maybe [RecipeStep]
steps} -> Maybe [RecipeStep]
steps) (\s :: UpdateRecipe
s@UpdateRecipe' {} Maybe [RecipeStep]
a -> UpdateRecipe
s {$sel:steps:UpdateRecipe' :: Maybe [RecipeStep]
steps = Maybe [RecipeStep]
a} :: UpdateRecipe) ((Maybe [RecipeStep] -> f (Maybe [RecipeStep]))
-> UpdateRecipe -> f UpdateRecipe)
-> ((Maybe [RecipeStep] -> f (Maybe [RecipeStep]))
-> Maybe [RecipeStep] -> f (Maybe [RecipeStep]))
-> (Maybe [RecipeStep] -> f (Maybe [RecipeStep]))
-> UpdateRecipe
-> f UpdateRecipe
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [RecipeStep] [RecipeStep] [RecipeStep] [RecipeStep]
-> Iso
(Maybe [RecipeStep])
(Maybe [RecipeStep])
(Maybe [RecipeStep])
(Maybe [RecipeStep])
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 [RecipeStep] [RecipeStep] [RecipeStep] [RecipeStep]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateRecipe_description :: Lens.Lens' UpdateRecipe (Prelude.Maybe Prelude.Text)
updateRecipe_description :: (Maybe Text -> f (Maybe Text)) -> UpdateRecipe -> f UpdateRecipe
updateRecipe_description = (UpdateRecipe -> Maybe Text)
-> (UpdateRecipe -> Maybe Text -> UpdateRecipe)
-> Lens UpdateRecipe UpdateRecipe (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRecipe' {Maybe Text
description :: Maybe Text
$sel:description:UpdateRecipe' :: UpdateRecipe -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateRecipe
s@UpdateRecipe' {} Maybe Text
a -> UpdateRecipe
s {$sel:description:UpdateRecipe' :: Maybe Text
description = Maybe Text
a} :: UpdateRecipe)
updateRecipe_name :: Lens.Lens' UpdateRecipe Prelude.Text
updateRecipe_name :: (Text -> f Text) -> UpdateRecipe -> f UpdateRecipe
updateRecipe_name = (UpdateRecipe -> Text)
-> (UpdateRecipe -> Text -> UpdateRecipe)
-> Lens UpdateRecipe UpdateRecipe Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRecipe' {Text
name :: Text
$sel:name:UpdateRecipe' :: UpdateRecipe -> Text
name} -> Text
name) (\s :: UpdateRecipe
s@UpdateRecipe' {} Text
a -> UpdateRecipe
s {$sel:name:UpdateRecipe' :: Text
name = Text
a} :: UpdateRecipe)
instance Core.AWSRequest UpdateRecipe where
type AWSResponse UpdateRecipe = UpdateRecipeResponse
request :: UpdateRecipe -> Request UpdateRecipe
request = Service -> UpdateRecipe -> Request UpdateRecipe
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateRecipe
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRecipe)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateRecipe))
-> Logger
-> Service
-> Proxy UpdateRecipe
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRecipe)))
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 -> UpdateRecipeResponse
UpdateRecipeResponse'
(Int -> Text -> UpdateRecipeResponse)
-> Either String Int
-> Either String (Text -> UpdateRecipeResponse)
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 -> UpdateRecipeResponse)
-> Either String Text -> Either String UpdateRecipeResponse
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 UpdateRecipe
instance Prelude.NFData UpdateRecipe
instance Core.ToHeaders UpdateRecipe where
toHeaders :: UpdateRecipe -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateRecipe -> 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 UpdateRecipe where
toJSON :: UpdateRecipe -> Value
toJSON UpdateRecipe' {Maybe [RecipeStep]
Maybe Text
Text
name :: Text
description :: Maybe Text
steps :: Maybe [RecipeStep]
$sel:name:UpdateRecipe' :: UpdateRecipe -> Text
$sel:description:UpdateRecipe' :: UpdateRecipe -> Maybe Text
$sel:steps:UpdateRecipe' :: UpdateRecipe -> Maybe [RecipeStep]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Steps" Text -> [RecipeStep] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([RecipeStep] -> Pair) -> Maybe [RecipeStep] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [RecipeStep]
steps,
(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
]
)
instance Core.ToPath UpdateRecipe where
toPath :: UpdateRecipe -> ByteString
toPath UpdateRecipe' {Maybe [RecipeStep]
Maybe Text
Text
name :: Text
description :: Maybe Text
steps :: Maybe [RecipeStep]
$sel:name:UpdateRecipe' :: UpdateRecipe -> Text
$sel:description:UpdateRecipe' :: UpdateRecipe -> Maybe Text
$sel:steps:UpdateRecipe' :: UpdateRecipe -> Maybe [RecipeStep]
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/recipes/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name]
instance Core.ToQuery UpdateRecipe where
toQuery :: UpdateRecipe -> QueryString
toQuery = QueryString -> UpdateRecipe -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateRecipeResponse = UpdateRecipeResponse'
{
UpdateRecipeResponse -> Int
httpStatus :: Prelude.Int,
UpdateRecipeResponse -> Text
name :: Prelude.Text
}
deriving (UpdateRecipeResponse -> UpdateRecipeResponse -> Bool
(UpdateRecipeResponse -> UpdateRecipeResponse -> Bool)
-> (UpdateRecipeResponse -> UpdateRecipeResponse -> Bool)
-> Eq UpdateRecipeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRecipeResponse -> UpdateRecipeResponse -> Bool
$c/= :: UpdateRecipeResponse -> UpdateRecipeResponse -> Bool
== :: UpdateRecipeResponse -> UpdateRecipeResponse -> Bool
$c== :: UpdateRecipeResponse -> UpdateRecipeResponse -> Bool
Prelude.Eq, ReadPrec [UpdateRecipeResponse]
ReadPrec UpdateRecipeResponse
Int -> ReadS UpdateRecipeResponse
ReadS [UpdateRecipeResponse]
(Int -> ReadS UpdateRecipeResponse)
-> ReadS [UpdateRecipeResponse]
-> ReadPrec UpdateRecipeResponse
-> ReadPrec [UpdateRecipeResponse]
-> Read UpdateRecipeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRecipeResponse]
$creadListPrec :: ReadPrec [UpdateRecipeResponse]
readPrec :: ReadPrec UpdateRecipeResponse
$creadPrec :: ReadPrec UpdateRecipeResponse
readList :: ReadS [UpdateRecipeResponse]
$creadList :: ReadS [UpdateRecipeResponse]
readsPrec :: Int -> ReadS UpdateRecipeResponse
$creadsPrec :: Int -> ReadS UpdateRecipeResponse
Prelude.Read, Int -> UpdateRecipeResponse -> ShowS
[UpdateRecipeResponse] -> ShowS
UpdateRecipeResponse -> String
(Int -> UpdateRecipeResponse -> ShowS)
-> (UpdateRecipeResponse -> String)
-> ([UpdateRecipeResponse] -> ShowS)
-> Show UpdateRecipeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRecipeResponse] -> ShowS
$cshowList :: [UpdateRecipeResponse] -> ShowS
show :: UpdateRecipeResponse -> String
$cshow :: UpdateRecipeResponse -> String
showsPrec :: Int -> UpdateRecipeResponse -> ShowS
$cshowsPrec :: Int -> UpdateRecipeResponse -> ShowS
Prelude.Show, (forall x. UpdateRecipeResponse -> Rep UpdateRecipeResponse x)
-> (forall x. Rep UpdateRecipeResponse x -> UpdateRecipeResponse)
-> Generic UpdateRecipeResponse
forall x. Rep UpdateRecipeResponse x -> UpdateRecipeResponse
forall x. UpdateRecipeResponse -> Rep UpdateRecipeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRecipeResponse x -> UpdateRecipeResponse
$cfrom :: forall x. UpdateRecipeResponse -> Rep UpdateRecipeResponse x
Prelude.Generic)
newUpdateRecipeResponse ::
Prelude.Int ->
Prelude.Text ->
UpdateRecipeResponse
newUpdateRecipeResponse :: Int -> Text -> UpdateRecipeResponse
newUpdateRecipeResponse Int
pHttpStatus_ Text
pName_ =
UpdateRecipeResponse' :: Int -> Text -> UpdateRecipeResponse
UpdateRecipeResponse'
{ $sel:httpStatus:UpdateRecipeResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:name:UpdateRecipeResponse' :: Text
name = Text
pName_
}
updateRecipeResponse_httpStatus :: Lens.Lens' UpdateRecipeResponse Prelude.Int
updateRecipeResponse_httpStatus :: (Int -> f Int) -> UpdateRecipeResponse -> f UpdateRecipeResponse
updateRecipeResponse_httpStatus = (UpdateRecipeResponse -> Int)
-> (UpdateRecipeResponse -> Int -> UpdateRecipeResponse)
-> Lens UpdateRecipeResponse UpdateRecipeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRecipeResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRecipeResponse' :: UpdateRecipeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateRecipeResponse
s@UpdateRecipeResponse' {} Int
a -> UpdateRecipeResponse
s {$sel:httpStatus:UpdateRecipeResponse' :: Int
httpStatus = Int
a} :: UpdateRecipeResponse)
updateRecipeResponse_name :: Lens.Lens' UpdateRecipeResponse Prelude.Text
updateRecipeResponse_name :: (Text -> f Text) -> UpdateRecipeResponse -> f UpdateRecipeResponse
updateRecipeResponse_name = (UpdateRecipeResponse -> Text)
-> (UpdateRecipeResponse -> Text -> UpdateRecipeResponse)
-> Lens UpdateRecipeResponse UpdateRecipeResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRecipeResponse' {Text
name :: Text
$sel:name:UpdateRecipeResponse' :: UpdateRecipeResponse -> Text
name} -> Text
name) (\s :: UpdateRecipeResponse
s@UpdateRecipeResponse' {} Text
a -> UpdateRecipeResponse
s {$sel:name:UpdateRecipeResponse' :: Text
name = Text
a} :: UpdateRecipeResponse)
instance Prelude.NFData UpdateRecipeResponse