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