{-# 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.Glue.Types.CustomCode where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.GlueSchema
import qualified Amazonka.Prelude as Prelude
data CustomCode = CustomCode'
{
CustomCode -> Maybe [GlueSchema]
outputSchemas :: Prelude.Maybe [GlueSchema],
CustomCode -> Text
name :: Prelude.Text,
CustomCode -> NonEmpty Text
inputs :: Prelude.NonEmpty Prelude.Text,
CustomCode -> Text
code :: Prelude.Text,
CustomCode -> Text
className :: Prelude.Text
}
deriving (CustomCode -> CustomCode -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomCode -> CustomCode -> Bool
$c/= :: CustomCode -> CustomCode -> Bool
== :: CustomCode -> CustomCode -> Bool
$c== :: CustomCode -> CustomCode -> Bool
Prelude.Eq, ReadPrec [CustomCode]
ReadPrec CustomCode
Int -> ReadS CustomCode
ReadS [CustomCode]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomCode]
$creadListPrec :: ReadPrec [CustomCode]
readPrec :: ReadPrec CustomCode
$creadPrec :: ReadPrec CustomCode
readList :: ReadS [CustomCode]
$creadList :: ReadS [CustomCode]
readsPrec :: Int -> ReadS CustomCode
$creadsPrec :: Int -> ReadS CustomCode
Prelude.Read, Int -> CustomCode -> ShowS
[CustomCode] -> ShowS
CustomCode -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomCode] -> ShowS
$cshowList :: [CustomCode] -> ShowS
show :: CustomCode -> String
$cshow :: CustomCode -> String
showsPrec :: Int -> CustomCode -> ShowS
$cshowsPrec :: Int -> CustomCode -> ShowS
Prelude.Show, forall x. Rep CustomCode x -> CustomCode
forall x. CustomCode -> Rep CustomCode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomCode x -> CustomCode
$cfrom :: forall x. CustomCode -> Rep CustomCode x
Prelude.Generic)
newCustomCode ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CustomCode
newCustomCode :: Text -> NonEmpty Text -> Text -> Text -> CustomCode
newCustomCode Text
pName_ NonEmpty Text
pInputs_ Text
pCode_ Text
pClassName_ =
CustomCode'
{ $sel:outputSchemas:CustomCode' :: Maybe [GlueSchema]
outputSchemas = forall a. Maybe a
Prelude.Nothing,
$sel:name:CustomCode' :: Text
name = Text
pName_,
$sel:inputs:CustomCode' :: NonEmpty Text
inputs = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pInputs_,
$sel:code:CustomCode' :: Text
code = Text
pCode_,
$sel:className:CustomCode' :: Text
className = Text
pClassName_
}
customCode_outputSchemas :: Lens.Lens' CustomCode (Prelude.Maybe [GlueSchema])
customCode_outputSchemas :: Lens' CustomCode (Maybe [GlueSchema])
customCode_outputSchemas = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomCode' {Maybe [GlueSchema]
outputSchemas :: Maybe [GlueSchema]
$sel:outputSchemas:CustomCode' :: CustomCode -> Maybe [GlueSchema]
outputSchemas} -> Maybe [GlueSchema]
outputSchemas) (\s :: CustomCode
s@CustomCode' {} Maybe [GlueSchema]
a -> CustomCode
s {$sel:outputSchemas:CustomCode' :: Maybe [GlueSchema]
outputSchemas = Maybe [GlueSchema]
a} :: CustomCode) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
customCode_name :: Lens.Lens' CustomCode Prelude.Text
customCode_name :: Lens' CustomCode Text
customCode_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomCode' {Text
name :: Text
$sel:name:CustomCode' :: CustomCode -> Text
name} -> Text
name) (\s :: CustomCode
s@CustomCode' {} Text
a -> CustomCode
s {$sel:name:CustomCode' :: Text
name = Text
a} :: CustomCode)
customCode_inputs :: Lens.Lens' CustomCode (Prelude.NonEmpty Prelude.Text)
customCode_inputs :: Lens' CustomCode (NonEmpty Text)
customCode_inputs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomCode' {NonEmpty Text
inputs :: NonEmpty Text
$sel:inputs:CustomCode' :: CustomCode -> NonEmpty Text
inputs} -> NonEmpty Text
inputs) (\s :: CustomCode
s@CustomCode' {} NonEmpty Text
a -> CustomCode
s {$sel:inputs:CustomCode' :: NonEmpty Text
inputs = NonEmpty Text
a} :: CustomCode) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
customCode_code :: Lens.Lens' CustomCode Prelude.Text
customCode_code :: Lens' CustomCode Text
customCode_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomCode' {Text
code :: Text
$sel:code:CustomCode' :: CustomCode -> Text
code} -> Text
code) (\s :: CustomCode
s@CustomCode' {} Text
a -> CustomCode
s {$sel:code:CustomCode' :: Text
code = Text
a} :: CustomCode)
customCode_className :: Lens.Lens' CustomCode Prelude.Text
customCode_className :: Lens' CustomCode Text
customCode_className = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomCode' {Text
className :: Text
$sel:className:CustomCode' :: CustomCode -> Text
className} -> Text
className) (\s :: CustomCode
s@CustomCode' {} Text
a -> CustomCode
s {$sel:className:CustomCode' :: Text
className = Text
a} :: CustomCode)
instance Data.FromJSON CustomCode where
parseJSON :: Value -> Parser CustomCode
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CustomCode"
( \Object
x ->
Maybe [GlueSchema]
-> Text -> NonEmpty Text -> Text -> Text -> CustomCode
CustomCode'
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
"OutputSchemas" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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")
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
"Inputs")
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
"Code")
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
"ClassName")
)
instance Prelude.Hashable CustomCode where
hashWithSalt :: Int -> CustomCode -> Int
hashWithSalt Int
_salt CustomCode' {Maybe [GlueSchema]
NonEmpty Text
Text
className :: Text
code :: Text
inputs :: NonEmpty Text
name :: Text
outputSchemas :: Maybe [GlueSchema]
$sel:className:CustomCode' :: CustomCode -> Text
$sel:code:CustomCode' :: CustomCode -> Text
$sel:inputs:CustomCode' :: CustomCode -> NonEmpty Text
$sel:name:CustomCode' :: CustomCode -> Text
$sel:outputSchemas:CustomCode' :: CustomCode -> Maybe [GlueSchema]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [GlueSchema]
outputSchemas
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
inputs
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
code
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
className
instance Prelude.NFData CustomCode where
rnf :: CustomCode -> ()
rnf CustomCode' {Maybe [GlueSchema]
NonEmpty Text
Text
className :: Text
code :: Text
inputs :: NonEmpty Text
name :: Text
outputSchemas :: Maybe [GlueSchema]
$sel:className:CustomCode' :: CustomCode -> Text
$sel:code:CustomCode' :: CustomCode -> Text
$sel:inputs:CustomCode' :: CustomCode -> NonEmpty Text
$sel:name:CustomCode' :: CustomCode -> Text
$sel:outputSchemas:CustomCode' :: CustomCode -> Maybe [GlueSchema]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [GlueSchema]
outputSchemas
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
inputs
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
code
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
className
instance Data.ToJSON CustomCode where
toJSON :: CustomCode -> Value
toJSON CustomCode' {Maybe [GlueSchema]
NonEmpty Text
Text
className :: Text
code :: Text
inputs :: NonEmpty Text
name :: Text
outputSchemas :: Maybe [GlueSchema]
$sel:className:CustomCode' :: CustomCode -> Text
$sel:code:CustomCode' :: CustomCode -> Text
$sel:inputs:CustomCode' :: CustomCode -> NonEmpty Text
$sel:name:CustomCode' :: CustomCode -> Text
$sel:outputSchemas:CustomCode' :: CustomCode -> Maybe [GlueSchema]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"OutputSchemas" 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 [GlueSchema]
outputSchemas,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Inputs" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
inputs),
forall a. a -> Maybe a
Prelude.Just (Key
"Code" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
code),
forall a. a -> Maybe a
Prelude.Just (Key
"ClassName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
className)
]
)