{-# 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.SchemaColumn where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SchemaColumn = SchemaColumn'
{
SchemaColumn -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
SchemaColumn -> Maybe Text
dataType :: Prelude.Maybe Prelude.Text
}
deriving (SchemaColumn -> SchemaColumn -> Bool
(SchemaColumn -> SchemaColumn -> Bool)
-> (SchemaColumn -> SchemaColumn -> Bool) -> Eq SchemaColumn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SchemaColumn -> SchemaColumn -> Bool
$c/= :: SchemaColumn -> SchemaColumn -> Bool
== :: SchemaColumn -> SchemaColumn -> Bool
$c== :: SchemaColumn -> SchemaColumn -> Bool
Prelude.Eq, ReadPrec [SchemaColumn]
ReadPrec SchemaColumn
Int -> ReadS SchemaColumn
ReadS [SchemaColumn]
(Int -> ReadS SchemaColumn)
-> ReadS [SchemaColumn]
-> ReadPrec SchemaColumn
-> ReadPrec [SchemaColumn]
-> Read SchemaColumn
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SchemaColumn]
$creadListPrec :: ReadPrec [SchemaColumn]
readPrec :: ReadPrec SchemaColumn
$creadPrec :: ReadPrec SchemaColumn
readList :: ReadS [SchemaColumn]
$creadList :: ReadS [SchemaColumn]
readsPrec :: Int -> ReadS SchemaColumn
$creadsPrec :: Int -> ReadS SchemaColumn
Prelude.Read, Int -> SchemaColumn -> ShowS
[SchemaColumn] -> ShowS
SchemaColumn -> String
(Int -> SchemaColumn -> ShowS)
-> (SchemaColumn -> String)
-> ([SchemaColumn] -> ShowS)
-> Show SchemaColumn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SchemaColumn] -> ShowS
$cshowList :: [SchemaColumn] -> ShowS
show :: SchemaColumn -> String
$cshow :: SchemaColumn -> String
showsPrec :: Int -> SchemaColumn -> ShowS
$cshowsPrec :: Int -> SchemaColumn -> ShowS
Prelude.Show, (forall x. SchemaColumn -> Rep SchemaColumn x)
-> (forall x. Rep SchemaColumn x -> SchemaColumn)
-> Generic SchemaColumn
forall x. Rep SchemaColumn x -> SchemaColumn
forall x. SchemaColumn -> Rep SchemaColumn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SchemaColumn x -> SchemaColumn
$cfrom :: forall x. SchemaColumn -> Rep SchemaColumn x
Prelude.Generic)
newSchemaColumn ::
SchemaColumn
newSchemaColumn :: SchemaColumn
newSchemaColumn =
SchemaColumn' :: Maybe Text -> Maybe Text -> SchemaColumn
SchemaColumn'
{ $sel:name:SchemaColumn' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dataType:SchemaColumn' :: Maybe Text
dataType = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
schemaColumn_name :: Lens.Lens' SchemaColumn (Prelude.Maybe Prelude.Text)
schemaColumn_name :: (Maybe Text -> f (Maybe Text)) -> SchemaColumn -> f SchemaColumn
schemaColumn_name = (SchemaColumn -> Maybe Text)
-> (SchemaColumn -> Maybe Text -> SchemaColumn)
-> Lens SchemaColumn SchemaColumn (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaColumn' {Maybe Text
name :: Maybe Text
$sel:name:SchemaColumn' :: SchemaColumn -> Maybe Text
name} -> Maybe Text
name) (\s :: SchemaColumn
s@SchemaColumn' {} Maybe Text
a -> SchemaColumn
s {$sel:name:SchemaColumn' :: Maybe Text
name = Maybe Text
a} :: SchemaColumn)
schemaColumn_dataType :: Lens.Lens' SchemaColumn (Prelude.Maybe Prelude.Text)
schemaColumn_dataType :: (Maybe Text -> f (Maybe Text)) -> SchemaColumn -> f SchemaColumn
schemaColumn_dataType = (SchemaColumn -> Maybe Text)
-> (SchemaColumn -> Maybe Text -> SchemaColumn)
-> Lens SchemaColumn SchemaColumn (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaColumn' {Maybe Text
dataType :: Maybe Text
$sel:dataType:SchemaColumn' :: SchemaColumn -> Maybe Text
dataType} -> Maybe Text
dataType) (\s :: SchemaColumn
s@SchemaColumn' {} Maybe Text
a -> SchemaColumn
s {$sel:dataType:SchemaColumn' :: Maybe Text
dataType = Maybe Text
a} :: SchemaColumn)
instance Core.FromJSON SchemaColumn where
parseJSON :: Value -> Parser SchemaColumn
parseJSON =
String
-> (Object -> Parser SchemaColumn) -> Value -> Parser SchemaColumn
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SchemaColumn"
( \Object
x ->
Maybe Text -> Maybe Text -> SchemaColumn
SchemaColumn'
(Maybe Text -> Maybe Text -> SchemaColumn)
-> Parser (Maybe Text) -> Parser (Maybe Text -> SchemaColumn)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
Parser (Maybe Text -> SchemaColumn)
-> Parser (Maybe Text) -> Parser SchemaColumn
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataType")
)
instance Prelude.Hashable SchemaColumn
instance Prelude.NFData SchemaColumn
instance Core.ToJSON SchemaColumn where
toJSON :: SchemaColumn -> Value
toJSON SchemaColumn' {Maybe Text
dataType :: Maybe Text
name :: Maybe Text
$sel:dataType:SchemaColumn' :: SchemaColumn -> Maybe Text
$sel:name:SchemaColumn' :: SchemaColumn -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Name" 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
name,
(Text
"DataType" 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
dataType
]
)