{-# 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.RecordColumn where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RecordColumn = RecordColumn'
{
RecordColumn -> Maybe Text
mapping :: Prelude.Maybe Prelude.Text,
RecordColumn -> Text
name :: Prelude.Text,
RecordColumn -> Text
sqlType :: Prelude.Text
}
deriving (RecordColumn -> RecordColumn -> Bool
(RecordColumn -> RecordColumn -> Bool)
-> (RecordColumn -> RecordColumn -> Bool) -> Eq RecordColumn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecordColumn -> RecordColumn -> Bool
$c/= :: RecordColumn -> RecordColumn -> Bool
== :: RecordColumn -> RecordColumn -> Bool
$c== :: RecordColumn -> RecordColumn -> Bool
Prelude.Eq, ReadPrec [RecordColumn]
ReadPrec RecordColumn
Int -> ReadS RecordColumn
ReadS [RecordColumn]
(Int -> ReadS RecordColumn)
-> ReadS [RecordColumn]
-> ReadPrec RecordColumn
-> ReadPrec [RecordColumn]
-> Read RecordColumn
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecordColumn]
$creadListPrec :: ReadPrec [RecordColumn]
readPrec :: ReadPrec RecordColumn
$creadPrec :: ReadPrec RecordColumn
readList :: ReadS [RecordColumn]
$creadList :: ReadS [RecordColumn]
readsPrec :: Int -> ReadS RecordColumn
$creadsPrec :: Int -> ReadS RecordColumn
Prelude.Read, Int -> RecordColumn -> ShowS
[RecordColumn] -> ShowS
RecordColumn -> String
(Int -> RecordColumn -> ShowS)
-> (RecordColumn -> String)
-> ([RecordColumn] -> ShowS)
-> Show RecordColumn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecordColumn] -> ShowS
$cshowList :: [RecordColumn] -> ShowS
show :: RecordColumn -> String
$cshow :: RecordColumn -> String
showsPrec :: Int -> RecordColumn -> ShowS
$cshowsPrec :: Int -> RecordColumn -> ShowS
Prelude.Show, (forall x. RecordColumn -> Rep RecordColumn x)
-> (forall x. Rep RecordColumn x -> RecordColumn)
-> Generic RecordColumn
forall x. Rep RecordColumn x -> RecordColumn
forall x. RecordColumn -> Rep RecordColumn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecordColumn x -> RecordColumn
$cfrom :: forall x. RecordColumn -> Rep RecordColumn x
Prelude.Generic)
newRecordColumn ::
Prelude.Text ->
Prelude.Text ->
RecordColumn
newRecordColumn :: Text -> Text -> RecordColumn
newRecordColumn Text
pName_ Text
pSqlType_ =
RecordColumn' :: Maybe Text -> Text -> Text -> RecordColumn
RecordColumn'
{ $sel:mapping:RecordColumn' :: Maybe Text
mapping = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:RecordColumn' :: Text
name = Text
pName_,
$sel:sqlType:RecordColumn' :: Text
sqlType = Text
pSqlType_
}
recordColumn_mapping :: Lens.Lens' RecordColumn (Prelude.Maybe Prelude.Text)
recordColumn_mapping :: (Maybe Text -> f (Maybe Text)) -> RecordColumn -> f RecordColumn
recordColumn_mapping = (RecordColumn -> Maybe Text)
-> (RecordColumn -> Maybe Text -> RecordColumn)
-> Lens RecordColumn RecordColumn (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordColumn' {Maybe Text
mapping :: Maybe Text
$sel:mapping:RecordColumn' :: RecordColumn -> Maybe Text
mapping} -> Maybe Text
mapping) (\s :: RecordColumn
s@RecordColumn' {} Maybe Text
a -> RecordColumn
s {$sel:mapping:RecordColumn' :: Maybe Text
mapping = Maybe Text
a} :: RecordColumn)
recordColumn_name :: Lens.Lens' RecordColumn Prelude.Text
recordColumn_name :: (Text -> f Text) -> RecordColumn -> f RecordColumn
recordColumn_name = (RecordColumn -> Text)
-> (RecordColumn -> Text -> RecordColumn)
-> Lens RecordColumn RecordColumn Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordColumn' {Text
name :: Text
$sel:name:RecordColumn' :: RecordColumn -> Text
name} -> Text
name) (\s :: RecordColumn
s@RecordColumn' {} Text
a -> RecordColumn
s {$sel:name:RecordColumn' :: Text
name = Text
a} :: RecordColumn)
recordColumn_sqlType :: Lens.Lens' RecordColumn Prelude.Text
recordColumn_sqlType :: (Text -> f Text) -> RecordColumn -> f RecordColumn
recordColumn_sqlType = (RecordColumn -> Text)
-> (RecordColumn -> Text -> RecordColumn)
-> Lens RecordColumn RecordColumn Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordColumn' {Text
sqlType :: Text
$sel:sqlType:RecordColumn' :: RecordColumn -> Text
sqlType} -> Text
sqlType) (\s :: RecordColumn
s@RecordColumn' {} Text
a -> RecordColumn
s {$sel:sqlType:RecordColumn' :: Text
sqlType = Text
a} :: RecordColumn)
instance Core.FromJSON RecordColumn where
parseJSON :: Value -> Parser RecordColumn
parseJSON =
String
-> (Object -> Parser RecordColumn) -> Value -> Parser RecordColumn
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RecordColumn"
( \Object
x ->
Maybe Text -> Text -> Text -> RecordColumn
RecordColumn'
(Maybe Text -> Text -> Text -> RecordColumn)
-> Parser (Maybe Text) -> Parser (Text -> Text -> RecordColumn)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Mapping")
Parser (Text -> Text -> RecordColumn)
-> Parser Text -> Parser (Text -> RecordColumn)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
Parser (Text -> RecordColumn) -> Parser Text -> Parser RecordColumn
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SqlType")
)
instance Prelude.Hashable RecordColumn
instance Prelude.NFData RecordColumn
instance Core.ToJSON RecordColumn where
toJSON :: RecordColumn -> Value
toJSON RecordColumn' {Maybe Text
Text
sqlType :: Text
name :: Text
mapping :: Maybe Text
$sel:sqlType:RecordColumn' :: RecordColumn -> Text
$sel:name:RecordColumn' :: RecordColumn -> Text
$sel:mapping:RecordColumn' :: RecordColumn -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Mapping" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
mapping,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SqlType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sqlType)
]
)