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