{-# 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.TimeStreamWrite.Types.MeasureValue 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
import Amazonka.TimeStreamWrite.Types.MeasureValueType
data MeasureValue = MeasureValue'
{
MeasureValue -> Text
name :: Prelude.Text,
MeasureValue -> Text
value :: Prelude.Text,
MeasureValue -> MeasureValueType
type' :: MeasureValueType
}
deriving (MeasureValue -> MeasureValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MeasureValue -> MeasureValue -> Bool
$c/= :: MeasureValue -> MeasureValue -> Bool
== :: MeasureValue -> MeasureValue -> Bool
$c== :: MeasureValue -> MeasureValue -> Bool
Prelude.Eq, ReadPrec [MeasureValue]
ReadPrec MeasureValue
Int -> ReadS MeasureValue
ReadS [MeasureValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MeasureValue]
$creadListPrec :: ReadPrec [MeasureValue]
readPrec :: ReadPrec MeasureValue
$creadPrec :: ReadPrec MeasureValue
readList :: ReadS [MeasureValue]
$creadList :: ReadS [MeasureValue]
readsPrec :: Int -> ReadS MeasureValue
$creadsPrec :: Int -> ReadS MeasureValue
Prelude.Read, Int -> MeasureValue -> ShowS
[MeasureValue] -> ShowS
MeasureValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MeasureValue] -> ShowS
$cshowList :: [MeasureValue] -> ShowS
show :: MeasureValue -> String
$cshow :: MeasureValue -> String
showsPrec :: Int -> MeasureValue -> ShowS
$cshowsPrec :: Int -> MeasureValue -> ShowS
Prelude.Show, forall x. Rep MeasureValue x -> MeasureValue
forall x. MeasureValue -> Rep MeasureValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MeasureValue x -> MeasureValue
$cfrom :: forall x. MeasureValue -> Rep MeasureValue x
Prelude.Generic)
newMeasureValue ::
Prelude.Text ->
Prelude.Text ->
MeasureValueType ->
MeasureValue
newMeasureValue :: Text -> Text -> MeasureValueType -> MeasureValue
newMeasureValue Text
pName_ Text
pValue_ MeasureValueType
pType_ =
MeasureValue'
{ $sel:name:MeasureValue' :: Text
name = Text
pName_,
$sel:value:MeasureValue' :: Text
value = Text
pValue_,
$sel:type':MeasureValue' :: MeasureValueType
type' = MeasureValueType
pType_
}
measureValue_name :: Lens.Lens' MeasureValue Prelude.Text
measureValue_name :: Lens' MeasureValue Text
measureValue_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeasureValue' {Text
name :: Text
$sel:name:MeasureValue' :: MeasureValue -> Text
name} -> Text
name) (\s :: MeasureValue
s@MeasureValue' {} Text
a -> MeasureValue
s {$sel:name:MeasureValue' :: Text
name = Text
a} :: MeasureValue)
measureValue_value :: Lens.Lens' MeasureValue Prelude.Text
measureValue_value :: Lens' MeasureValue Text
measureValue_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeasureValue' {Text
value :: Text
$sel:value:MeasureValue' :: MeasureValue -> Text
value} -> Text
value) (\s :: MeasureValue
s@MeasureValue' {} Text
a -> MeasureValue
s {$sel:value:MeasureValue' :: Text
value = Text
a} :: MeasureValue)
measureValue_type :: Lens.Lens' MeasureValue MeasureValueType
measureValue_type :: Lens' MeasureValue MeasureValueType
measureValue_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeasureValue' {MeasureValueType
type' :: MeasureValueType
$sel:type':MeasureValue' :: MeasureValue -> MeasureValueType
type'} -> MeasureValueType
type') (\s :: MeasureValue
s@MeasureValue' {} MeasureValueType
a -> MeasureValue
s {$sel:type':MeasureValue' :: MeasureValueType
type' = MeasureValueType
a} :: MeasureValue)
instance Prelude.Hashable MeasureValue where
hashWithSalt :: Int -> MeasureValue -> Int
hashWithSalt Int
_salt MeasureValue' {Text
MeasureValueType
type' :: MeasureValueType
value :: Text
name :: Text
$sel:type':MeasureValue' :: MeasureValue -> MeasureValueType
$sel:value:MeasureValue' :: MeasureValue -> Text
$sel:name:MeasureValue' :: MeasureValue -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` MeasureValueType
type'
instance Prelude.NFData MeasureValue where
rnf :: MeasureValue -> ()
rnf MeasureValue' {Text
MeasureValueType
type' :: MeasureValueType
value :: Text
name :: Text
$sel:type':MeasureValue' :: MeasureValue -> MeasureValueType
$sel:value:MeasureValue' :: MeasureValue -> Text
$sel:name:MeasureValue' :: MeasureValue -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MeasureValueType
type'
instance Data.ToJSON MeasureValue where
toJSON :: MeasureValue -> Value
toJSON MeasureValue' {Text
MeasureValueType
type' :: MeasureValueType
value :: Text
name :: Text
$sel:type':MeasureValue' :: MeasureValue -> MeasureValueType
$sel:value:MeasureValue' :: MeasureValue -> Text
$sel:name:MeasureValue' :: MeasureValue -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value),
forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= MeasureValueType
type')
]
)