{-# 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.Datatype 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 Datatype = Datatype'
{
Datatype -> Text
id :: Prelude.Text,
Datatype -> Text
label :: Prelude.Text
}
deriving (Datatype -> Datatype -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Datatype -> Datatype -> Bool
$c/= :: Datatype -> Datatype -> Bool
== :: Datatype -> Datatype -> Bool
$c== :: Datatype -> Datatype -> Bool
Prelude.Eq, ReadPrec [Datatype]
ReadPrec Datatype
Int -> ReadS Datatype
ReadS [Datatype]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Datatype]
$creadListPrec :: ReadPrec [Datatype]
readPrec :: ReadPrec Datatype
$creadPrec :: ReadPrec Datatype
readList :: ReadS [Datatype]
$creadList :: ReadS [Datatype]
readsPrec :: Int -> ReadS Datatype
$creadsPrec :: Int -> ReadS Datatype
Prelude.Read, Int -> Datatype -> ShowS
[Datatype] -> ShowS
Datatype -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Datatype] -> ShowS
$cshowList :: [Datatype] -> ShowS
show :: Datatype -> String
$cshow :: Datatype -> String
showsPrec :: Int -> Datatype -> ShowS
$cshowsPrec :: Int -> Datatype -> ShowS
Prelude.Show, forall x. Rep Datatype x -> Datatype
forall x. Datatype -> Rep Datatype x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Datatype x -> Datatype
$cfrom :: forall x. Datatype -> Rep Datatype x
Prelude.Generic)
newDatatype ::
Prelude.Text ->
Prelude.Text ->
Datatype
newDatatype :: Text -> Text -> Datatype
newDatatype Text
pId_ Text
pLabel_ =
Datatype' {$sel:id:Datatype' :: Text
id = Text
pId_, $sel:label:Datatype' :: Text
label = Text
pLabel_}
datatype_id :: Lens.Lens' Datatype Prelude.Text
datatype_id :: Lens' Datatype Text
datatype_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datatype' {Text
id :: Text
$sel:id:Datatype' :: Datatype -> Text
id} -> Text
id) (\s :: Datatype
s@Datatype' {} Text
a -> Datatype
s {$sel:id:Datatype' :: Text
id = Text
a} :: Datatype)
datatype_label :: Lens.Lens' Datatype Prelude.Text
datatype_label :: Lens' Datatype Text
datatype_label = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datatype' {Text
label :: Text
$sel:label:Datatype' :: Datatype -> Text
label} -> Text
label) (\s :: Datatype
s@Datatype' {} Text
a -> Datatype
s {$sel:label:Datatype' :: Text
label = Text
a} :: Datatype)
instance Data.FromJSON Datatype where
parseJSON :: Value -> Parser Datatype
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Datatype"
( \Object
x ->
Text -> Text -> Datatype
Datatype'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Id")
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
"Label")
)
instance Prelude.Hashable Datatype where
hashWithSalt :: Int -> Datatype -> Int
hashWithSalt Int
_salt Datatype' {Text
label :: Text
id :: Text
$sel:label:Datatype' :: Datatype -> Text
$sel:id:Datatype' :: Datatype -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
label
instance Prelude.NFData Datatype where
rnf :: Datatype -> ()
rnf Datatype' {Text
label :: Text
id :: Text
$sel:label:Datatype' :: Datatype -> Text
$sel:id:Datatype' :: Datatype -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
id seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
label
instance Data.ToJSON Datatype where
toJSON :: Datatype -> Value
toJSON Datatype' {Text
label :: Text
id :: Text
$sel:label:Datatype' :: Datatype -> Text
$sel:id:Datatype' :: Datatype -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id),
forall a. a -> Maybe a
Prelude.Just (Key
"Label" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
label)
]
)