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