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