{-# 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.Mapping 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 Mapping = Mapping'
{
Mapping -> Maybe [Mapping]
children :: Prelude.Maybe [Mapping],
Mapping -> Maybe Bool
dropped :: Prelude.Maybe Prelude.Bool,
Mapping -> Maybe [Text]
fromPath :: Prelude.Maybe [Prelude.Text],
Mapping -> Maybe Text
fromType :: Prelude.Maybe Prelude.Text,
Mapping -> Maybe Text
toKey :: Prelude.Maybe Prelude.Text,
Mapping -> Maybe Text
toType :: Prelude.Maybe Prelude.Text
}
deriving (Mapping -> Mapping -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Mapping -> Mapping -> Bool
$c/= :: Mapping -> Mapping -> Bool
== :: Mapping -> Mapping -> Bool
$c== :: Mapping -> Mapping -> Bool
Prelude.Eq, ReadPrec [Mapping]
ReadPrec Mapping
Int -> ReadS Mapping
ReadS [Mapping]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Mapping]
$creadListPrec :: ReadPrec [Mapping]
readPrec :: ReadPrec Mapping
$creadPrec :: ReadPrec Mapping
readList :: ReadS [Mapping]
$creadList :: ReadS [Mapping]
readsPrec :: Int -> ReadS Mapping
$creadsPrec :: Int -> ReadS Mapping
Prelude.Read, Int -> Mapping -> ShowS
[Mapping] -> ShowS
Mapping -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Mapping] -> ShowS
$cshowList :: [Mapping] -> ShowS
show :: Mapping -> String
$cshow :: Mapping -> String
showsPrec :: Int -> Mapping -> ShowS
$cshowsPrec :: Int -> Mapping -> ShowS
Prelude.Show, forall x. Rep Mapping x -> Mapping
forall x. Mapping -> Rep Mapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Mapping x -> Mapping
$cfrom :: forall x. Mapping -> Rep Mapping x
Prelude.Generic)
newMapping ::
Mapping
newMapping :: Mapping
newMapping =
Mapping'
{ $sel:children:Mapping' :: Maybe [Mapping]
children = forall a. Maybe a
Prelude.Nothing,
$sel:dropped:Mapping' :: Maybe Bool
dropped = forall a. Maybe a
Prelude.Nothing,
$sel:fromPath:Mapping' :: Maybe [Text]
fromPath = forall a. Maybe a
Prelude.Nothing,
$sel:fromType:Mapping' :: Maybe Text
fromType = forall a. Maybe a
Prelude.Nothing,
$sel:toKey:Mapping' :: Maybe Text
toKey = forall a. Maybe a
Prelude.Nothing,
$sel:toType:Mapping' :: Maybe Text
toType = forall a. Maybe a
Prelude.Nothing
}
mapping_children :: Lens.Lens' Mapping (Prelude.Maybe [Mapping])
mapping_children :: Lens' Mapping (Maybe [Mapping])
mapping_children = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Mapping' {Maybe [Mapping]
children :: Maybe [Mapping]
$sel:children:Mapping' :: Mapping -> Maybe [Mapping]
children} -> Maybe [Mapping]
children) (\s :: Mapping
s@Mapping' {} Maybe [Mapping]
a -> Mapping
s {$sel:children:Mapping' :: Maybe [Mapping]
children = Maybe [Mapping]
a} :: Mapping) 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
mapping_dropped :: Lens.Lens' Mapping (Prelude.Maybe Prelude.Bool)
mapping_dropped :: Lens' Mapping (Maybe Bool)
mapping_dropped = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Mapping' {Maybe Bool
dropped :: Maybe Bool
$sel:dropped:Mapping' :: Mapping -> Maybe Bool
dropped} -> Maybe Bool
dropped) (\s :: Mapping
s@Mapping' {} Maybe Bool
a -> Mapping
s {$sel:dropped:Mapping' :: Maybe Bool
dropped = Maybe Bool
a} :: Mapping)
mapping_fromPath :: Lens.Lens' Mapping (Prelude.Maybe [Prelude.Text])
mapping_fromPath :: Lens' Mapping (Maybe [Text])
mapping_fromPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Mapping' {Maybe [Text]
fromPath :: Maybe [Text]
$sel:fromPath:Mapping' :: Mapping -> Maybe [Text]
fromPath} -> Maybe [Text]
fromPath) (\s :: Mapping
s@Mapping' {} Maybe [Text]
a -> Mapping
s {$sel:fromPath:Mapping' :: Maybe [Text]
fromPath = Maybe [Text]
a} :: Mapping) 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
mapping_fromType :: Lens.Lens' Mapping (Prelude.Maybe Prelude.Text)
mapping_fromType :: Lens' Mapping (Maybe Text)
mapping_fromType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Mapping' {Maybe Text
fromType :: Maybe Text
$sel:fromType:Mapping' :: Mapping -> Maybe Text
fromType} -> Maybe Text
fromType) (\s :: Mapping
s@Mapping' {} Maybe Text
a -> Mapping
s {$sel:fromType:Mapping' :: Maybe Text
fromType = Maybe Text
a} :: Mapping)
mapping_toKey :: Lens.Lens' Mapping (Prelude.Maybe Prelude.Text)
mapping_toKey :: Lens' Mapping (Maybe Text)
mapping_toKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Mapping' {Maybe Text
toKey :: Maybe Text
$sel:toKey:Mapping' :: Mapping -> Maybe Text
toKey} -> Maybe Text
toKey) (\s :: Mapping
s@Mapping' {} Maybe Text
a -> Mapping
s {$sel:toKey:Mapping' :: Maybe Text
toKey = Maybe Text
a} :: Mapping)
mapping_toType :: Lens.Lens' Mapping (Prelude.Maybe Prelude.Text)
mapping_toType :: Lens' Mapping (Maybe Text)
mapping_toType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Mapping' {Maybe Text
toType :: Maybe Text
$sel:toType:Mapping' :: Mapping -> Maybe Text
toType} -> Maybe Text
toType) (\s :: Mapping
s@Mapping' {} Maybe Text
a -> Mapping
s {$sel:toType:Mapping' :: Maybe Text
toType = Maybe Text
a} :: Mapping)
instance Data.FromJSON Mapping where
parseJSON :: Value -> Parser Mapping
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Mapping"
( \Object
x ->
Maybe [Mapping]
-> Maybe Bool
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Mapping
Mapping'
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
"Children" 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 (Maybe a)
Data..:? Key
"Dropped")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FromPath" 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 (Maybe a)
Data..:? Key
"FromType")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ToKey")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ToType")
)
instance Prelude.Hashable Mapping where
hashWithSalt :: Int -> Mapping -> Int
hashWithSalt Int
_salt Mapping' {Maybe Bool
Maybe [Text]
Maybe [Mapping]
Maybe Text
toType :: Maybe Text
toKey :: Maybe Text
fromType :: Maybe Text
fromPath :: Maybe [Text]
dropped :: Maybe Bool
children :: Maybe [Mapping]
$sel:toType:Mapping' :: Mapping -> Maybe Text
$sel:toKey:Mapping' :: Mapping -> Maybe Text
$sel:fromType:Mapping' :: Mapping -> Maybe Text
$sel:fromPath:Mapping' :: Mapping -> Maybe [Text]
$sel:dropped:Mapping' :: Mapping -> Maybe Bool
$sel:children:Mapping' :: Mapping -> Maybe [Mapping]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Mapping]
children
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dropped
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
fromPath
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fromType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
toKey
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
toType
instance Prelude.NFData Mapping where
rnf :: Mapping -> ()
rnf Mapping' {Maybe Bool
Maybe [Text]
Maybe [Mapping]
Maybe Text
toType :: Maybe Text
toKey :: Maybe Text
fromType :: Maybe Text
fromPath :: Maybe [Text]
dropped :: Maybe Bool
children :: Maybe [Mapping]
$sel:toType:Mapping' :: Mapping -> Maybe Text
$sel:toKey:Mapping' :: Mapping -> Maybe Text
$sel:fromType:Mapping' :: Mapping -> Maybe Text
$sel:fromPath:Mapping' :: Mapping -> Maybe [Text]
$sel:dropped:Mapping' :: Mapping -> Maybe Bool
$sel:children:Mapping' :: Mapping -> Maybe [Mapping]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Mapping]
children
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dropped
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
fromPath
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fromType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
toKey
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
toType
instance Data.ToJSON Mapping where
toJSON :: Mapping -> Value
toJSON Mapping' {Maybe Bool
Maybe [Text]
Maybe [Mapping]
Maybe Text
toType :: Maybe Text
toKey :: Maybe Text
fromType :: Maybe Text
fromPath :: Maybe [Text]
dropped :: Maybe Bool
children :: Maybe [Mapping]
$sel:toType:Mapping' :: Mapping -> Maybe Text
$sel:toKey:Mapping' :: Mapping -> Maybe Text
$sel:fromType:Mapping' :: Mapping -> Maybe Text
$sel:fromPath:Mapping' :: Mapping -> Maybe [Text]
$sel:dropped:Mapping' :: Mapping -> Maybe Bool
$sel:children:Mapping' :: Mapping -> Maybe [Mapping]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Children" 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 [Mapping]
children,
(Key
"Dropped" 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 Bool
dropped,
(Key
"FromPath" 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]
fromPath,
(Key
"FromType" 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
fromType,
(Key
"ToKey" 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
toKey,
(Key
"ToType" 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
toType
]
)