{-# 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.KinesisAnalyticsV2.Types.ReferenceDataSource where
import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.S3ReferenceDataSource
import Amazonka.KinesisAnalyticsV2.Types.SourceSchema
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ReferenceDataSource = ReferenceDataSource'
{
ReferenceDataSource -> Maybe S3ReferenceDataSource
s3ReferenceDataSource :: Prelude.Maybe S3ReferenceDataSource,
ReferenceDataSource -> Text
tableName :: Prelude.Text,
ReferenceDataSource -> SourceSchema
referenceSchema :: SourceSchema
}
deriving (ReferenceDataSource -> ReferenceDataSource -> Bool
(ReferenceDataSource -> ReferenceDataSource -> Bool)
-> (ReferenceDataSource -> ReferenceDataSource -> Bool)
-> Eq ReferenceDataSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReferenceDataSource -> ReferenceDataSource -> Bool
$c/= :: ReferenceDataSource -> ReferenceDataSource -> Bool
== :: ReferenceDataSource -> ReferenceDataSource -> Bool
$c== :: ReferenceDataSource -> ReferenceDataSource -> Bool
Prelude.Eq, ReadPrec [ReferenceDataSource]
ReadPrec ReferenceDataSource
Int -> ReadS ReferenceDataSource
ReadS [ReferenceDataSource]
(Int -> ReadS ReferenceDataSource)
-> ReadS [ReferenceDataSource]
-> ReadPrec ReferenceDataSource
-> ReadPrec [ReferenceDataSource]
-> Read ReferenceDataSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReferenceDataSource]
$creadListPrec :: ReadPrec [ReferenceDataSource]
readPrec :: ReadPrec ReferenceDataSource
$creadPrec :: ReadPrec ReferenceDataSource
readList :: ReadS [ReferenceDataSource]
$creadList :: ReadS [ReferenceDataSource]
readsPrec :: Int -> ReadS ReferenceDataSource
$creadsPrec :: Int -> ReadS ReferenceDataSource
Prelude.Read, Int -> ReferenceDataSource -> ShowS
[ReferenceDataSource] -> ShowS
ReferenceDataSource -> String
(Int -> ReferenceDataSource -> ShowS)
-> (ReferenceDataSource -> String)
-> ([ReferenceDataSource] -> ShowS)
-> Show ReferenceDataSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReferenceDataSource] -> ShowS
$cshowList :: [ReferenceDataSource] -> ShowS
show :: ReferenceDataSource -> String
$cshow :: ReferenceDataSource -> String
showsPrec :: Int -> ReferenceDataSource -> ShowS
$cshowsPrec :: Int -> ReferenceDataSource -> ShowS
Prelude.Show, (forall x. ReferenceDataSource -> Rep ReferenceDataSource x)
-> (forall x. Rep ReferenceDataSource x -> ReferenceDataSource)
-> Generic ReferenceDataSource
forall x. Rep ReferenceDataSource x -> ReferenceDataSource
forall x. ReferenceDataSource -> Rep ReferenceDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReferenceDataSource x -> ReferenceDataSource
$cfrom :: forall x. ReferenceDataSource -> Rep ReferenceDataSource x
Prelude.Generic)
newReferenceDataSource ::
Prelude.Text ->
SourceSchema ->
ReferenceDataSource
newReferenceDataSource :: Text -> SourceSchema -> ReferenceDataSource
newReferenceDataSource Text
pTableName_ SourceSchema
pReferenceSchema_ =
ReferenceDataSource' :: Maybe S3ReferenceDataSource
-> Text -> SourceSchema -> ReferenceDataSource
ReferenceDataSource'
{ $sel:s3ReferenceDataSource:ReferenceDataSource' :: Maybe S3ReferenceDataSource
s3ReferenceDataSource =
Maybe S3ReferenceDataSource
forall a. Maybe a
Prelude.Nothing,
$sel:tableName:ReferenceDataSource' :: Text
tableName = Text
pTableName_,
$sel:referenceSchema:ReferenceDataSource' :: SourceSchema
referenceSchema = SourceSchema
pReferenceSchema_
}
referenceDataSource_s3ReferenceDataSource :: Lens.Lens' ReferenceDataSource (Prelude.Maybe S3ReferenceDataSource)
referenceDataSource_s3ReferenceDataSource :: (Maybe S3ReferenceDataSource -> f (Maybe S3ReferenceDataSource))
-> ReferenceDataSource -> f ReferenceDataSource
referenceDataSource_s3ReferenceDataSource = (ReferenceDataSource -> Maybe S3ReferenceDataSource)
-> (ReferenceDataSource
-> Maybe S3ReferenceDataSource -> ReferenceDataSource)
-> Lens
ReferenceDataSource
ReferenceDataSource
(Maybe S3ReferenceDataSource)
(Maybe S3ReferenceDataSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReferenceDataSource' {Maybe S3ReferenceDataSource
s3ReferenceDataSource :: Maybe S3ReferenceDataSource
$sel:s3ReferenceDataSource:ReferenceDataSource' :: ReferenceDataSource -> Maybe S3ReferenceDataSource
s3ReferenceDataSource} -> Maybe S3ReferenceDataSource
s3ReferenceDataSource) (\s :: ReferenceDataSource
s@ReferenceDataSource' {} Maybe S3ReferenceDataSource
a -> ReferenceDataSource
s {$sel:s3ReferenceDataSource:ReferenceDataSource' :: Maybe S3ReferenceDataSource
s3ReferenceDataSource = Maybe S3ReferenceDataSource
a} :: ReferenceDataSource)
referenceDataSource_tableName :: Lens.Lens' ReferenceDataSource Prelude.Text
referenceDataSource_tableName :: (Text -> f Text) -> ReferenceDataSource -> f ReferenceDataSource
referenceDataSource_tableName = (ReferenceDataSource -> Text)
-> (ReferenceDataSource -> Text -> ReferenceDataSource)
-> Lens ReferenceDataSource ReferenceDataSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReferenceDataSource' {Text
tableName :: Text
$sel:tableName:ReferenceDataSource' :: ReferenceDataSource -> Text
tableName} -> Text
tableName) (\s :: ReferenceDataSource
s@ReferenceDataSource' {} Text
a -> ReferenceDataSource
s {$sel:tableName:ReferenceDataSource' :: Text
tableName = Text
a} :: ReferenceDataSource)
referenceDataSource_referenceSchema :: Lens.Lens' ReferenceDataSource SourceSchema
referenceDataSource_referenceSchema :: (SourceSchema -> f SourceSchema)
-> ReferenceDataSource -> f ReferenceDataSource
referenceDataSource_referenceSchema = (ReferenceDataSource -> SourceSchema)
-> (ReferenceDataSource -> SourceSchema -> ReferenceDataSource)
-> Lens
ReferenceDataSource ReferenceDataSource SourceSchema SourceSchema
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReferenceDataSource' {SourceSchema
referenceSchema :: SourceSchema
$sel:referenceSchema:ReferenceDataSource' :: ReferenceDataSource -> SourceSchema
referenceSchema} -> SourceSchema
referenceSchema) (\s :: ReferenceDataSource
s@ReferenceDataSource' {} SourceSchema
a -> ReferenceDataSource
s {$sel:referenceSchema:ReferenceDataSource' :: SourceSchema
referenceSchema = SourceSchema
a} :: ReferenceDataSource)
instance Prelude.Hashable ReferenceDataSource
instance Prelude.NFData ReferenceDataSource
instance Core.ToJSON ReferenceDataSource where
toJSON :: ReferenceDataSource -> Value
toJSON ReferenceDataSource' {Maybe S3ReferenceDataSource
Text
SourceSchema
referenceSchema :: SourceSchema
tableName :: Text
s3ReferenceDataSource :: Maybe S3ReferenceDataSource
$sel:referenceSchema:ReferenceDataSource' :: ReferenceDataSource -> SourceSchema
$sel:tableName:ReferenceDataSource' :: ReferenceDataSource -> Text
$sel:s3ReferenceDataSource:ReferenceDataSource' :: ReferenceDataSource -> Maybe S3ReferenceDataSource
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"S3ReferenceDataSource" Text -> S3ReferenceDataSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(S3ReferenceDataSource -> Pair)
-> Maybe S3ReferenceDataSource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3ReferenceDataSource
s3ReferenceDataSource,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ReferenceSchema" Text -> SourceSchema -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SourceSchema
referenceSchema)
]
)