{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.DataBrew.Types.RecipeReference where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data RecipeReference = RecipeReference'
{
RecipeReference -> Maybe Text
recipeVersion :: Prelude.Maybe Prelude.Text,
RecipeReference -> Text
name :: Prelude.Text
}
deriving (RecipeReference -> RecipeReference -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecipeReference -> RecipeReference -> Bool
$c/= :: RecipeReference -> RecipeReference -> Bool
== :: RecipeReference -> RecipeReference -> Bool
$c== :: RecipeReference -> RecipeReference -> Bool
Prelude.Eq, ReadPrec [RecipeReference]
ReadPrec RecipeReference
Int -> ReadS RecipeReference
ReadS [RecipeReference]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecipeReference]
$creadListPrec :: ReadPrec [RecipeReference]
readPrec :: ReadPrec RecipeReference
$creadPrec :: ReadPrec RecipeReference
readList :: ReadS [RecipeReference]
$creadList :: ReadS [RecipeReference]
readsPrec :: Int -> ReadS RecipeReference
$creadsPrec :: Int -> ReadS RecipeReference
Prelude.Read, Int -> RecipeReference -> ShowS
[RecipeReference] -> ShowS
RecipeReference -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecipeReference] -> ShowS
$cshowList :: [RecipeReference] -> ShowS
show :: RecipeReference -> String
$cshow :: RecipeReference -> String
showsPrec :: Int -> RecipeReference -> ShowS
$cshowsPrec :: Int -> RecipeReference -> ShowS
Prelude.Show, forall x. Rep RecipeReference x -> RecipeReference
forall x. RecipeReference -> Rep RecipeReference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecipeReference x -> RecipeReference
$cfrom :: forall x. RecipeReference -> Rep RecipeReference x
Prelude.Generic)
newRecipeReference ::
Prelude.Text ->
RecipeReference
newRecipeReference :: Text -> RecipeReference
newRecipeReference Text
pName_ =
RecipeReference'
{ $sel:recipeVersion:RecipeReference' :: Maybe Text
recipeVersion = forall a. Maybe a
Prelude.Nothing,
$sel:name:RecipeReference' :: Text
name = Text
pName_
}
recipeReference_recipeVersion :: Lens.Lens' RecipeReference (Prelude.Maybe Prelude.Text)
recipeReference_recipeVersion :: Lens' RecipeReference (Maybe Text)
recipeReference_recipeVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecipeReference' {Maybe Text
recipeVersion :: Maybe Text
$sel:recipeVersion:RecipeReference' :: RecipeReference -> Maybe Text
recipeVersion} -> Maybe Text
recipeVersion) (\s :: RecipeReference
s@RecipeReference' {} Maybe Text
a -> RecipeReference
s {$sel:recipeVersion:RecipeReference' :: Maybe Text
recipeVersion = Maybe Text
a} :: RecipeReference)
recipeReference_name :: Lens.Lens' RecipeReference Prelude.Text
recipeReference_name :: Lens' RecipeReference Text
recipeReference_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecipeReference' {Text
name :: Text
$sel:name:RecipeReference' :: RecipeReference -> Text
name} -> Text
name) (\s :: RecipeReference
s@RecipeReference' {} Text
a -> RecipeReference
s {$sel:name:RecipeReference' :: Text
name = Text
a} :: RecipeReference)
instance Data.FromJSON RecipeReference where
parseJSON :: Value -> Parser RecipeReference
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RecipeReference"
( \Object
x ->
Maybe Text -> Text -> RecipeReference
RecipeReference'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RecipeVersion")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
)
instance Prelude.Hashable RecipeReference where
hashWithSalt :: Int -> RecipeReference -> Int
hashWithSalt Int
_salt RecipeReference' {Maybe Text
Text
name :: Text
recipeVersion :: Maybe Text
$sel:name:RecipeReference' :: RecipeReference -> Text
$sel:recipeVersion:RecipeReference' :: RecipeReference -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recipeVersion
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData RecipeReference where
rnf :: RecipeReference -> ()
rnf RecipeReference' {Maybe Text
Text
name :: Text
recipeVersion :: Maybe Text
$sel:name:RecipeReference' :: RecipeReference -> Text
$sel:recipeVersion:RecipeReference' :: RecipeReference -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recipeVersion
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToJSON RecipeReference where
toJSON :: RecipeReference -> Value
toJSON RecipeReference' {Maybe Text
Text
name :: Text
recipeVersion :: Maybe Text
$sel:name:RecipeReference' :: RecipeReference -> Text
$sel:recipeVersion:RecipeReference' :: RecipeReference -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"RecipeVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
recipeVersion,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)