{-# 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.SelectFields 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 SelectFields = SelectFields'
{
SelectFields -> Text
name :: Prelude.Text,
SelectFields -> NonEmpty Text
inputs :: Prelude.NonEmpty Prelude.Text,
SelectFields -> [[Text]]
paths :: [[Prelude.Text]]
}
deriving (SelectFields -> SelectFields -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectFields -> SelectFields -> Bool
$c/= :: SelectFields -> SelectFields -> Bool
== :: SelectFields -> SelectFields -> Bool
$c== :: SelectFields -> SelectFields -> Bool
Prelude.Eq, ReadPrec [SelectFields]
ReadPrec SelectFields
Int -> ReadS SelectFields
ReadS [SelectFields]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelectFields]
$creadListPrec :: ReadPrec [SelectFields]
readPrec :: ReadPrec SelectFields
$creadPrec :: ReadPrec SelectFields
readList :: ReadS [SelectFields]
$creadList :: ReadS [SelectFields]
readsPrec :: Int -> ReadS SelectFields
$creadsPrec :: Int -> ReadS SelectFields
Prelude.Read, Int -> SelectFields -> ShowS
[SelectFields] -> ShowS
SelectFields -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectFields] -> ShowS
$cshowList :: [SelectFields] -> ShowS
show :: SelectFields -> String
$cshow :: SelectFields -> String
showsPrec :: Int -> SelectFields -> ShowS
$cshowsPrec :: Int -> SelectFields -> ShowS
Prelude.Show, forall x. Rep SelectFields x -> SelectFields
forall x. SelectFields -> Rep SelectFields x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SelectFields x -> SelectFields
$cfrom :: forall x. SelectFields -> Rep SelectFields x
Prelude.Generic)
newSelectFields ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
SelectFields
newSelectFields :: Text -> NonEmpty Text -> SelectFields
newSelectFields Text
pName_ NonEmpty Text
pInputs_ =
SelectFields'
{ $sel:name:SelectFields' :: Text
name = Text
pName_,
$sel:inputs:SelectFields' :: 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:paths:SelectFields' :: [[Text]]
paths = forall a. Monoid a => a
Prelude.mempty
}
selectFields_name :: Lens.Lens' SelectFields Prelude.Text
selectFields_name :: Lens' SelectFields Text
selectFields_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectFields' {Text
name :: Text
$sel:name:SelectFields' :: SelectFields -> Text
name} -> Text
name) (\s :: SelectFields
s@SelectFields' {} Text
a -> SelectFields
s {$sel:name:SelectFields' :: Text
name = Text
a} :: SelectFields)
selectFields_inputs :: Lens.Lens' SelectFields (Prelude.NonEmpty Prelude.Text)
selectFields_inputs :: Lens' SelectFields (NonEmpty Text)
selectFields_inputs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectFields' {NonEmpty Text
inputs :: NonEmpty Text
$sel:inputs:SelectFields' :: SelectFields -> NonEmpty Text
inputs} -> NonEmpty Text
inputs) (\s :: SelectFields
s@SelectFields' {} NonEmpty Text
a -> SelectFields
s {$sel:inputs:SelectFields' :: NonEmpty Text
inputs = NonEmpty Text
a} :: SelectFields) 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
selectFields_paths :: Lens.Lens' SelectFields [[Prelude.Text]]
selectFields_paths :: Lens' SelectFields [[Text]]
selectFields_paths = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectFields' {[[Text]]
paths :: [[Text]]
$sel:paths:SelectFields' :: SelectFields -> [[Text]]
paths} -> [[Text]]
paths) (\s :: SelectFields
s@SelectFields' {} [[Text]]
a -> SelectFields
s {$sel:paths:SelectFields' :: [[Text]]
paths = [[Text]]
a} :: SelectFields) 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
instance Data.FromJSON SelectFields where
parseJSON :: Value -> Parser SelectFields
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SelectFields"
( \Object
x ->
Text -> NonEmpty Text -> [[Text]] -> SelectFields
SelectFields'
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 (Maybe a)
Data..:? Key
"Paths" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable SelectFields where
hashWithSalt :: Int -> SelectFields -> Int
hashWithSalt Int
_salt SelectFields' {[[Text]]
NonEmpty Text
Text
paths :: [[Text]]
inputs :: NonEmpty Text
name :: Text
$sel:paths:SelectFields' :: SelectFields -> [[Text]]
$sel:inputs:SelectFields' :: SelectFields -> NonEmpty Text
$sel:name:SelectFields' :: SelectFields -> 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` [[Text]]
paths
instance Prelude.NFData SelectFields where
rnf :: SelectFields -> ()
rnf SelectFields' {[[Text]]
NonEmpty Text
Text
paths :: [[Text]]
inputs :: NonEmpty Text
name :: Text
$sel:paths:SelectFields' :: SelectFields -> [[Text]]
$sel:inputs:SelectFields' :: SelectFields -> NonEmpty Text
$sel:name:SelectFields' :: SelectFields -> 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 [[Text]]
paths
instance Data.ToJSON SelectFields where
toJSON :: SelectFields -> Value
toJSON SelectFields' {[[Text]]
NonEmpty Text
Text
paths :: [[Text]]
inputs :: NonEmpty Text
name :: Text
$sel:paths:SelectFields' :: SelectFields -> [[Text]]
$sel:inputs:SelectFields' :: SelectFields -> NonEmpty Text
$sel:name:SelectFields' :: SelectFields -> 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
"Paths" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [[Text]]
paths)
]
)