{-# 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.CatalogKafkaSource 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.KafkaStreamingSourceOptions
import Amazonka.Glue.Types.StreamingDataPreviewOptions
import qualified Amazonka.Prelude as Prelude
data CatalogKafkaSource = CatalogKafkaSource'
{
CatalogKafkaSource -> Maybe StreamingDataPreviewOptions
dataPreviewOptions :: Prelude.Maybe StreamingDataPreviewOptions,
CatalogKafkaSource -> Maybe Bool
detectSchema :: Prelude.Maybe Prelude.Bool,
CatalogKafkaSource -> Maybe KafkaStreamingSourceOptions
streamingOptions :: Prelude.Maybe KafkaStreamingSourceOptions,
CatalogKafkaSource -> Maybe Natural
windowSize :: Prelude.Maybe Prelude.Natural,
CatalogKafkaSource -> Text
name :: Prelude.Text,
CatalogKafkaSource -> Text
table :: Prelude.Text,
CatalogKafkaSource -> Text
database :: Prelude.Text
}
deriving (CatalogKafkaSource -> CatalogKafkaSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CatalogKafkaSource -> CatalogKafkaSource -> Bool
$c/= :: CatalogKafkaSource -> CatalogKafkaSource -> Bool
== :: CatalogKafkaSource -> CatalogKafkaSource -> Bool
$c== :: CatalogKafkaSource -> CatalogKafkaSource -> Bool
Prelude.Eq, ReadPrec [CatalogKafkaSource]
ReadPrec CatalogKafkaSource
Int -> ReadS CatalogKafkaSource
ReadS [CatalogKafkaSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CatalogKafkaSource]
$creadListPrec :: ReadPrec [CatalogKafkaSource]
readPrec :: ReadPrec CatalogKafkaSource
$creadPrec :: ReadPrec CatalogKafkaSource
readList :: ReadS [CatalogKafkaSource]
$creadList :: ReadS [CatalogKafkaSource]
readsPrec :: Int -> ReadS CatalogKafkaSource
$creadsPrec :: Int -> ReadS CatalogKafkaSource
Prelude.Read, Int -> CatalogKafkaSource -> ShowS
[CatalogKafkaSource] -> ShowS
CatalogKafkaSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CatalogKafkaSource] -> ShowS
$cshowList :: [CatalogKafkaSource] -> ShowS
show :: CatalogKafkaSource -> String
$cshow :: CatalogKafkaSource -> String
showsPrec :: Int -> CatalogKafkaSource -> ShowS
$cshowsPrec :: Int -> CatalogKafkaSource -> ShowS
Prelude.Show, forall x. Rep CatalogKafkaSource x -> CatalogKafkaSource
forall x. CatalogKafkaSource -> Rep CatalogKafkaSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CatalogKafkaSource x -> CatalogKafkaSource
$cfrom :: forall x. CatalogKafkaSource -> Rep CatalogKafkaSource x
Prelude.Generic)
newCatalogKafkaSource ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CatalogKafkaSource
newCatalogKafkaSource :: Text -> Text -> Text -> CatalogKafkaSource
newCatalogKafkaSource Text
pName_ Text
pTable_ Text
pDatabase_ =
CatalogKafkaSource'
{ $sel:dataPreviewOptions:CatalogKafkaSource' :: Maybe StreamingDataPreviewOptions
dataPreviewOptions =
forall a. Maybe a
Prelude.Nothing,
$sel:detectSchema:CatalogKafkaSource' :: Maybe Bool
detectSchema = forall a. Maybe a
Prelude.Nothing,
$sel:streamingOptions:CatalogKafkaSource' :: Maybe KafkaStreamingSourceOptions
streamingOptions = forall a. Maybe a
Prelude.Nothing,
$sel:windowSize:CatalogKafkaSource' :: Maybe Natural
windowSize = forall a. Maybe a
Prelude.Nothing,
$sel:name:CatalogKafkaSource' :: Text
name = Text
pName_,
$sel:table:CatalogKafkaSource' :: Text
table = Text
pTable_,
$sel:database:CatalogKafkaSource' :: Text
database = Text
pDatabase_
}
catalogKafkaSource_dataPreviewOptions :: Lens.Lens' CatalogKafkaSource (Prelude.Maybe StreamingDataPreviewOptions)
catalogKafkaSource_dataPreviewOptions :: Lens' CatalogKafkaSource (Maybe StreamingDataPreviewOptions)
catalogKafkaSource_dataPreviewOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CatalogKafkaSource' {Maybe StreamingDataPreviewOptions
dataPreviewOptions :: Maybe StreamingDataPreviewOptions
$sel:dataPreviewOptions:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe StreamingDataPreviewOptions
dataPreviewOptions} -> Maybe StreamingDataPreviewOptions
dataPreviewOptions) (\s :: CatalogKafkaSource
s@CatalogKafkaSource' {} Maybe StreamingDataPreviewOptions
a -> CatalogKafkaSource
s {$sel:dataPreviewOptions:CatalogKafkaSource' :: Maybe StreamingDataPreviewOptions
dataPreviewOptions = Maybe StreamingDataPreviewOptions
a} :: CatalogKafkaSource)
catalogKafkaSource_detectSchema :: Lens.Lens' CatalogKafkaSource (Prelude.Maybe Prelude.Bool)
catalogKafkaSource_detectSchema :: Lens' CatalogKafkaSource (Maybe Bool)
catalogKafkaSource_detectSchema = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CatalogKafkaSource' {Maybe Bool
detectSchema :: Maybe Bool
$sel:detectSchema:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe Bool
detectSchema} -> Maybe Bool
detectSchema) (\s :: CatalogKafkaSource
s@CatalogKafkaSource' {} Maybe Bool
a -> CatalogKafkaSource
s {$sel:detectSchema:CatalogKafkaSource' :: Maybe Bool
detectSchema = Maybe Bool
a} :: CatalogKafkaSource)
catalogKafkaSource_streamingOptions :: Lens.Lens' CatalogKafkaSource (Prelude.Maybe KafkaStreamingSourceOptions)
catalogKafkaSource_streamingOptions :: Lens' CatalogKafkaSource (Maybe KafkaStreamingSourceOptions)
catalogKafkaSource_streamingOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CatalogKafkaSource' {Maybe KafkaStreamingSourceOptions
streamingOptions :: Maybe KafkaStreamingSourceOptions
$sel:streamingOptions:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe KafkaStreamingSourceOptions
streamingOptions} -> Maybe KafkaStreamingSourceOptions
streamingOptions) (\s :: CatalogKafkaSource
s@CatalogKafkaSource' {} Maybe KafkaStreamingSourceOptions
a -> CatalogKafkaSource
s {$sel:streamingOptions:CatalogKafkaSource' :: Maybe KafkaStreamingSourceOptions
streamingOptions = Maybe KafkaStreamingSourceOptions
a} :: CatalogKafkaSource)
catalogKafkaSource_windowSize :: Lens.Lens' CatalogKafkaSource (Prelude.Maybe Prelude.Natural)
catalogKafkaSource_windowSize :: Lens' CatalogKafkaSource (Maybe Natural)
catalogKafkaSource_windowSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CatalogKafkaSource' {Maybe Natural
windowSize :: Maybe Natural
$sel:windowSize:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe Natural
windowSize} -> Maybe Natural
windowSize) (\s :: CatalogKafkaSource
s@CatalogKafkaSource' {} Maybe Natural
a -> CatalogKafkaSource
s {$sel:windowSize:CatalogKafkaSource' :: Maybe Natural
windowSize = Maybe Natural
a} :: CatalogKafkaSource)
catalogKafkaSource_name :: Lens.Lens' CatalogKafkaSource Prelude.Text
catalogKafkaSource_name :: Lens' CatalogKafkaSource Text
catalogKafkaSource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CatalogKafkaSource' {Text
name :: Text
$sel:name:CatalogKafkaSource' :: CatalogKafkaSource -> Text
name} -> Text
name) (\s :: CatalogKafkaSource
s@CatalogKafkaSource' {} Text
a -> CatalogKafkaSource
s {$sel:name:CatalogKafkaSource' :: Text
name = Text
a} :: CatalogKafkaSource)
catalogKafkaSource_table :: Lens.Lens' CatalogKafkaSource Prelude.Text
catalogKafkaSource_table :: Lens' CatalogKafkaSource Text
catalogKafkaSource_table = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CatalogKafkaSource' {Text
table :: Text
$sel:table:CatalogKafkaSource' :: CatalogKafkaSource -> Text
table} -> Text
table) (\s :: CatalogKafkaSource
s@CatalogKafkaSource' {} Text
a -> CatalogKafkaSource
s {$sel:table:CatalogKafkaSource' :: Text
table = Text
a} :: CatalogKafkaSource)
catalogKafkaSource_database :: Lens.Lens' CatalogKafkaSource Prelude.Text
catalogKafkaSource_database :: Lens' CatalogKafkaSource Text
catalogKafkaSource_database = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CatalogKafkaSource' {Text
database :: Text
$sel:database:CatalogKafkaSource' :: CatalogKafkaSource -> Text
database} -> Text
database) (\s :: CatalogKafkaSource
s@CatalogKafkaSource' {} Text
a -> CatalogKafkaSource
s {$sel:database:CatalogKafkaSource' :: Text
database = Text
a} :: CatalogKafkaSource)
instance Data.FromJSON CatalogKafkaSource where
parseJSON :: Value -> Parser CatalogKafkaSource
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CatalogKafkaSource"
( \Object
x ->
Maybe StreamingDataPreviewOptions
-> Maybe Bool
-> Maybe KafkaStreamingSourceOptions
-> Maybe Natural
-> Text
-> Text
-> Text
-> CatalogKafkaSource
CatalogKafkaSource'
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
"DataPreviewOptions")
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
"DetectSchema")
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
"StreamingOptions")
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
"WindowSize")
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
"Table")
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")
)
instance Prelude.Hashable CatalogKafkaSource where
hashWithSalt :: Int -> CatalogKafkaSource -> Int
hashWithSalt Int
_salt CatalogKafkaSource' {Maybe Bool
Maybe Natural
Maybe KafkaStreamingSourceOptions
Maybe StreamingDataPreviewOptions
Text
database :: Text
table :: Text
name :: Text
windowSize :: Maybe Natural
streamingOptions :: Maybe KafkaStreamingSourceOptions
detectSchema :: Maybe Bool
dataPreviewOptions :: Maybe StreamingDataPreviewOptions
$sel:database:CatalogKafkaSource' :: CatalogKafkaSource -> Text
$sel:table:CatalogKafkaSource' :: CatalogKafkaSource -> Text
$sel:name:CatalogKafkaSource' :: CatalogKafkaSource -> Text
$sel:windowSize:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe Natural
$sel:streamingOptions:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe KafkaStreamingSourceOptions
$sel:detectSchema:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe Bool
$sel:dataPreviewOptions:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe StreamingDataPreviewOptions
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StreamingDataPreviewOptions
dataPreviewOptions
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
detectSchema
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KafkaStreamingSourceOptions
streamingOptions
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
windowSize
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
table
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
database
instance Prelude.NFData CatalogKafkaSource where
rnf :: CatalogKafkaSource -> ()
rnf CatalogKafkaSource' {Maybe Bool
Maybe Natural
Maybe KafkaStreamingSourceOptions
Maybe StreamingDataPreviewOptions
Text
database :: Text
table :: Text
name :: Text
windowSize :: Maybe Natural
streamingOptions :: Maybe KafkaStreamingSourceOptions
detectSchema :: Maybe Bool
dataPreviewOptions :: Maybe StreamingDataPreviewOptions
$sel:database:CatalogKafkaSource' :: CatalogKafkaSource -> Text
$sel:table:CatalogKafkaSource' :: CatalogKafkaSource -> Text
$sel:name:CatalogKafkaSource' :: CatalogKafkaSource -> Text
$sel:windowSize:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe Natural
$sel:streamingOptions:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe KafkaStreamingSourceOptions
$sel:detectSchema:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe Bool
$sel:dataPreviewOptions:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe StreamingDataPreviewOptions
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe StreamingDataPreviewOptions
dataPreviewOptions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
detectSchema
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KafkaStreamingSourceOptions
streamingOptions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
windowSize
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
table
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
database
instance Data.ToJSON CatalogKafkaSource where
toJSON :: CatalogKafkaSource -> Value
toJSON CatalogKafkaSource' {Maybe Bool
Maybe Natural
Maybe KafkaStreamingSourceOptions
Maybe StreamingDataPreviewOptions
Text
database :: Text
table :: Text
name :: Text
windowSize :: Maybe Natural
streamingOptions :: Maybe KafkaStreamingSourceOptions
detectSchema :: Maybe Bool
dataPreviewOptions :: Maybe StreamingDataPreviewOptions
$sel:database:CatalogKafkaSource' :: CatalogKafkaSource -> Text
$sel:table:CatalogKafkaSource' :: CatalogKafkaSource -> Text
$sel:name:CatalogKafkaSource' :: CatalogKafkaSource -> Text
$sel:windowSize:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe Natural
$sel:streamingOptions:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe KafkaStreamingSourceOptions
$sel:detectSchema:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe Bool
$sel:dataPreviewOptions:CatalogKafkaSource' :: CatalogKafkaSource -> Maybe StreamingDataPreviewOptions
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DataPreviewOptions" 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 StreamingDataPreviewOptions
dataPreviewOptions,
(Key
"DetectSchema" 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
detectSchema,
(Key
"StreamingOptions" 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 KafkaStreamingSourceOptions
streamingOptions,
(Key
"WindowSize" 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 Natural
windowSize,
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
"Table" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
table),
forall a. a -> Maybe a
Prelude.Just (Key
"Database" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
database)
]
)