{-# 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.Union 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.UnionType
import qualified Amazonka.Prelude as Prelude
data Union = Union'
{
Union -> Text
name :: Prelude.Text,
Union -> NonEmpty Text
inputs :: Prelude.NonEmpty Prelude.Text,
Union -> UnionType
unionType :: UnionType
}
deriving (Union -> Union -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Union -> Union -> Bool
$c/= :: Union -> Union -> Bool
== :: Union -> Union -> Bool
$c== :: Union -> Union -> Bool
Prelude.Eq, ReadPrec [Union]
ReadPrec Union
Int -> ReadS Union
ReadS [Union]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Union]
$creadListPrec :: ReadPrec [Union]
readPrec :: ReadPrec Union
$creadPrec :: ReadPrec Union
readList :: ReadS [Union]
$creadList :: ReadS [Union]
readsPrec :: Int -> ReadS Union
$creadsPrec :: Int -> ReadS Union
Prelude.Read, Int -> Union -> ShowS
[Union] -> ShowS
Union -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Union] -> ShowS
$cshowList :: [Union] -> ShowS
show :: Union -> String
$cshow :: Union -> String
showsPrec :: Int -> Union -> ShowS
$cshowsPrec :: Int -> Union -> ShowS
Prelude.Show, forall x. Rep Union x -> Union
forall x. Union -> Rep Union x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Union x -> Union
$cfrom :: forall x. Union -> Rep Union x
Prelude.Generic)
newUnion ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
UnionType ->
Union
newUnion :: Text -> NonEmpty Text -> UnionType -> Union
newUnion Text
pName_ NonEmpty Text
pInputs_ UnionType
pUnionType_ =
Union'
{ $sel:name:Union' :: Text
name = Text
pName_,
$sel:inputs:Union' :: 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:unionType:Union' :: UnionType
unionType = UnionType
pUnionType_
}
union_name :: Lens.Lens' Union Prelude.Text
union_name :: Lens' Union Text
union_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Union' {Text
name :: Text
$sel:name:Union' :: Union -> Text
name} -> Text
name) (\s :: Union
s@Union' {} Text
a -> Union
s {$sel:name:Union' :: Text
name = Text
a} :: Union)
union_inputs :: Lens.Lens' Union (Prelude.NonEmpty Prelude.Text)
union_inputs :: Lens' Union (NonEmpty Text)
union_inputs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Union' {NonEmpty Text
inputs :: NonEmpty Text
$sel:inputs:Union' :: Union -> NonEmpty Text
inputs} -> NonEmpty Text
inputs) (\s :: Union
s@Union' {} NonEmpty Text
a -> Union
s {$sel:inputs:Union' :: NonEmpty Text
inputs = NonEmpty Text
a} :: Union) 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
union_unionType :: Lens.Lens' Union UnionType
union_unionType :: Lens' Union UnionType
union_unionType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Union' {UnionType
unionType :: UnionType
$sel:unionType:Union' :: Union -> UnionType
unionType} -> UnionType
unionType) (\s :: Union
s@Union' {} UnionType
a -> Union
s {$sel:unionType:Union' :: UnionType
unionType = UnionType
a} :: Union)
instance Data.FromJSON Union where
parseJSON :: Value -> Parser Union
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Union"
( \Object
x ->
Text -> NonEmpty Text -> UnionType -> Union
Union'
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
"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
"UnionType")
)
instance Prelude.Hashable Union where
hashWithSalt :: Int -> Union -> Int
hashWithSalt Int
_salt Union' {NonEmpty Text
Text
UnionType
unionType :: UnionType
inputs :: NonEmpty Text
name :: Text
$sel:unionType:Union' :: Union -> UnionType
$sel:inputs:Union' :: Union -> NonEmpty Text
$sel:name:Union' :: Union -> Text
..} =
Int
_salt
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` UnionType
unionType
instance Prelude.NFData Union where
rnf :: Union -> ()
rnf Union' {NonEmpty Text
Text
UnionType
unionType :: UnionType
inputs :: NonEmpty Text
name :: Text
$sel:unionType:Union' :: Union -> UnionType
$sel:inputs:Union' :: Union -> NonEmpty Text
$sel:name:Union' :: Union -> Text
..} =
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 UnionType
unionType
instance Data.ToJSON Union where
toJSON :: Union -> Value
toJSON Union' {NonEmpty Text
Text
UnionType
unionType :: UnionType
inputs :: NonEmpty Text
name :: Text
$sel:unionType:Union' :: Union -> UnionType
$sel:inputs:Union' :: Union -> NonEmpty Text
$sel:name:Union' :: Union -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ 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
"UnionType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= UnionType
unionType)
]
)