{-# 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.S3CatalogSource 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.S3SourceAdditionalOptions
import qualified Amazonka.Prelude as Prelude
data S3CatalogSource = S3CatalogSource'
{
S3CatalogSource -> Maybe S3SourceAdditionalOptions
additionalOptions :: Prelude.Maybe S3SourceAdditionalOptions,
S3CatalogSource -> Maybe Text
partitionPredicate :: Prelude.Maybe Prelude.Text,
S3CatalogSource -> Text
name :: Prelude.Text,
S3CatalogSource -> Text
database :: Prelude.Text,
S3CatalogSource -> Text
table :: Prelude.Text
}
deriving (S3CatalogSource -> S3CatalogSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3CatalogSource -> S3CatalogSource -> Bool
$c/= :: S3CatalogSource -> S3CatalogSource -> Bool
== :: S3CatalogSource -> S3CatalogSource -> Bool
$c== :: S3CatalogSource -> S3CatalogSource -> Bool
Prelude.Eq, ReadPrec [S3CatalogSource]
ReadPrec S3CatalogSource
Int -> ReadS S3CatalogSource
ReadS [S3CatalogSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3CatalogSource]
$creadListPrec :: ReadPrec [S3CatalogSource]
readPrec :: ReadPrec S3CatalogSource
$creadPrec :: ReadPrec S3CatalogSource
readList :: ReadS [S3CatalogSource]
$creadList :: ReadS [S3CatalogSource]
readsPrec :: Int -> ReadS S3CatalogSource
$creadsPrec :: Int -> ReadS S3CatalogSource
Prelude.Read, Int -> S3CatalogSource -> ShowS
[S3CatalogSource] -> ShowS
S3CatalogSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3CatalogSource] -> ShowS
$cshowList :: [S3CatalogSource] -> ShowS
show :: S3CatalogSource -> String
$cshow :: S3CatalogSource -> String
showsPrec :: Int -> S3CatalogSource -> ShowS
$cshowsPrec :: Int -> S3CatalogSource -> ShowS
Prelude.Show, forall x. Rep S3CatalogSource x -> S3CatalogSource
forall x. S3CatalogSource -> Rep S3CatalogSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3CatalogSource x -> S3CatalogSource
$cfrom :: forall x. S3CatalogSource -> Rep S3CatalogSource x
Prelude.Generic)
newS3CatalogSource ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
S3CatalogSource
newS3CatalogSource :: Text -> Text -> Text -> S3CatalogSource
newS3CatalogSource Text
pName_ Text
pDatabase_ Text
pTable_ =
S3CatalogSource'
{ $sel:additionalOptions:S3CatalogSource' :: Maybe S3SourceAdditionalOptions
additionalOptions =
forall a. Maybe a
Prelude.Nothing,
$sel:partitionPredicate:S3CatalogSource' :: Maybe Text
partitionPredicate = forall a. Maybe a
Prelude.Nothing,
$sel:name:S3CatalogSource' :: Text
name = Text
pName_,
$sel:database:S3CatalogSource' :: Text
database = Text
pDatabase_,
$sel:table:S3CatalogSource' :: Text
table = Text
pTable_
}
s3CatalogSource_additionalOptions :: Lens.Lens' S3CatalogSource (Prelude.Maybe S3SourceAdditionalOptions)
s3CatalogSource_additionalOptions :: Lens' S3CatalogSource (Maybe S3SourceAdditionalOptions)
s3CatalogSource_additionalOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogSource' {Maybe S3SourceAdditionalOptions
additionalOptions :: Maybe S3SourceAdditionalOptions
$sel:additionalOptions:S3CatalogSource' :: S3CatalogSource -> Maybe S3SourceAdditionalOptions
additionalOptions} -> Maybe S3SourceAdditionalOptions
additionalOptions) (\s :: S3CatalogSource
s@S3CatalogSource' {} Maybe S3SourceAdditionalOptions
a -> S3CatalogSource
s {$sel:additionalOptions:S3CatalogSource' :: Maybe S3SourceAdditionalOptions
additionalOptions = Maybe S3SourceAdditionalOptions
a} :: S3CatalogSource)
s3CatalogSource_partitionPredicate :: Lens.Lens' S3CatalogSource (Prelude.Maybe Prelude.Text)
s3CatalogSource_partitionPredicate :: Lens' S3CatalogSource (Maybe Text)
s3CatalogSource_partitionPredicate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogSource' {Maybe Text
partitionPredicate :: Maybe Text
$sel:partitionPredicate:S3CatalogSource' :: S3CatalogSource -> Maybe Text
partitionPredicate} -> Maybe Text
partitionPredicate) (\s :: S3CatalogSource
s@S3CatalogSource' {} Maybe Text
a -> S3CatalogSource
s {$sel:partitionPredicate:S3CatalogSource' :: Maybe Text
partitionPredicate = Maybe Text
a} :: S3CatalogSource)
s3CatalogSource_name :: Lens.Lens' S3CatalogSource Prelude.Text
s3CatalogSource_name :: Lens' S3CatalogSource Text
s3CatalogSource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogSource' {Text
name :: Text
$sel:name:S3CatalogSource' :: S3CatalogSource -> Text
name} -> Text
name) (\s :: S3CatalogSource
s@S3CatalogSource' {} Text
a -> S3CatalogSource
s {$sel:name:S3CatalogSource' :: Text
name = Text
a} :: S3CatalogSource)
s3CatalogSource_database :: Lens.Lens' S3CatalogSource Prelude.Text
s3CatalogSource_database :: Lens' S3CatalogSource Text
s3CatalogSource_database = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogSource' {Text
database :: Text
$sel:database:S3CatalogSource' :: S3CatalogSource -> Text
database} -> Text
database) (\s :: S3CatalogSource
s@S3CatalogSource' {} Text
a -> S3CatalogSource
s {$sel:database:S3CatalogSource' :: Text
database = Text
a} :: S3CatalogSource)
s3CatalogSource_table :: Lens.Lens' S3CatalogSource Prelude.Text
s3CatalogSource_table :: Lens' S3CatalogSource Text
s3CatalogSource_table = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogSource' {Text
table :: Text
$sel:table:S3CatalogSource' :: S3CatalogSource -> Text
table} -> Text
table) (\s :: S3CatalogSource
s@S3CatalogSource' {} Text
a -> S3CatalogSource
s {$sel:table:S3CatalogSource' :: Text
table = Text
a} :: S3CatalogSource)
instance Data.FromJSON S3CatalogSource where
parseJSON :: Value -> Parser S3CatalogSource
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"S3CatalogSource"
( \Object
x ->
Maybe S3SourceAdditionalOptions
-> Maybe Text -> Text -> Text -> Text -> S3CatalogSource
S3CatalogSource'
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
"AdditionalOptions")
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
"PartitionPredicate")
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
"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
"Database")
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
"Table")
)
instance Prelude.Hashable S3CatalogSource where
hashWithSalt :: Int -> S3CatalogSource -> Int
hashWithSalt Int
_salt S3CatalogSource' {Maybe Text
Maybe S3SourceAdditionalOptions
Text
table :: Text
database :: Text
name :: Text
partitionPredicate :: Maybe Text
additionalOptions :: Maybe S3SourceAdditionalOptions
$sel:table:S3CatalogSource' :: S3CatalogSource -> Text
$sel:database:S3CatalogSource' :: S3CatalogSource -> Text
$sel:name:S3CatalogSource' :: S3CatalogSource -> Text
$sel:partitionPredicate:S3CatalogSource' :: S3CatalogSource -> Maybe Text
$sel:additionalOptions:S3CatalogSource' :: S3CatalogSource -> Maybe S3SourceAdditionalOptions
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3SourceAdditionalOptions
additionalOptions
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
partitionPredicate
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
database
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
table
instance Prelude.NFData S3CatalogSource where
rnf :: S3CatalogSource -> ()
rnf S3CatalogSource' {Maybe Text
Maybe S3SourceAdditionalOptions
Text
table :: Text
database :: Text
name :: Text
partitionPredicate :: Maybe Text
additionalOptions :: Maybe S3SourceAdditionalOptions
$sel:table:S3CatalogSource' :: S3CatalogSource -> Text
$sel:database:S3CatalogSource' :: S3CatalogSource -> Text
$sel:name:S3CatalogSource' :: S3CatalogSource -> Text
$sel:partitionPredicate:S3CatalogSource' :: S3CatalogSource -> Maybe Text
$sel:additionalOptions:S3CatalogSource' :: S3CatalogSource -> Maybe S3SourceAdditionalOptions
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe S3SourceAdditionalOptions
additionalOptions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
partitionPredicate
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
database
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
table
instance Data.ToJSON S3CatalogSource where
toJSON :: S3CatalogSource -> Value
toJSON S3CatalogSource' {Maybe Text
Maybe S3SourceAdditionalOptions
Text
table :: Text
database :: Text
name :: Text
partitionPredicate :: Maybe Text
additionalOptions :: Maybe S3SourceAdditionalOptions
$sel:table:S3CatalogSource' :: S3CatalogSource -> Text
$sel:database:S3CatalogSource' :: S3CatalogSource -> Text
$sel:name:S3CatalogSource' :: S3CatalogSource -> Text
$sel:partitionPredicate:S3CatalogSource' :: S3CatalogSource -> Maybe Text
$sel:additionalOptions:S3CatalogSource' :: S3CatalogSource -> Maybe S3SourceAdditionalOptions
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AdditionalOptions" 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 S3SourceAdditionalOptions
additionalOptions,
(Key
"PartitionPredicate" 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
partitionPredicate,
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
"Database" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
database),
forall a. a -> Maybe a
Prelude.Just (Key
"Table" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
table)
]
)