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