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