{-# 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.MetricValue where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data MetricValue = MetricValue'
{
MetricValue -> Maybe [Text]
cidrs :: Prelude.Maybe [Prelude.Text],
MetricValue -> Maybe Natural
count :: Prelude.Maybe Prelude.Natural,
MetricValue -> Maybe [Natural]
ports :: Prelude.Maybe [Prelude.Natural],
MetricValue -> Maybe [Double]
numbers :: Prelude.Maybe [Prelude.Double],
MetricValue -> Maybe Double
number :: Prelude.Maybe Prelude.Double,
MetricValue -> Maybe [Text]
strings :: Prelude.Maybe [Prelude.Text]
}
deriving (MetricValue -> MetricValue -> Bool
(MetricValue -> MetricValue -> Bool)
-> (MetricValue -> MetricValue -> Bool) -> Eq MetricValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricValue -> MetricValue -> Bool
$c/= :: MetricValue -> MetricValue -> Bool
== :: MetricValue -> MetricValue -> Bool
$c== :: MetricValue -> MetricValue -> Bool
Prelude.Eq, ReadPrec [MetricValue]
ReadPrec MetricValue
Int -> ReadS MetricValue
ReadS [MetricValue]
(Int -> ReadS MetricValue)
-> ReadS [MetricValue]
-> ReadPrec MetricValue
-> ReadPrec [MetricValue]
-> Read MetricValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricValue]
$creadListPrec :: ReadPrec [MetricValue]
readPrec :: ReadPrec MetricValue
$creadPrec :: ReadPrec MetricValue
readList :: ReadS [MetricValue]
$creadList :: ReadS [MetricValue]
readsPrec :: Int -> ReadS MetricValue
$creadsPrec :: Int -> ReadS MetricValue
Prelude.Read, Int -> MetricValue -> ShowS
[MetricValue] -> ShowS
MetricValue -> String
(Int -> MetricValue -> ShowS)
-> (MetricValue -> String)
-> ([MetricValue] -> ShowS)
-> Show MetricValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricValue] -> ShowS
$cshowList :: [MetricValue] -> ShowS
show :: MetricValue -> String
$cshow :: MetricValue -> String
showsPrec :: Int -> MetricValue -> ShowS
$cshowsPrec :: Int -> MetricValue -> ShowS
Prelude.Show, (forall x. MetricValue -> Rep MetricValue x)
-> (forall x. Rep MetricValue x -> MetricValue)
-> Generic MetricValue
forall x. Rep MetricValue x -> MetricValue
forall x. MetricValue -> Rep MetricValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricValue x -> MetricValue
$cfrom :: forall x. MetricValue -> Rep MetricValue x
Prelude.Generic)
newMetricValue ::
MetricValue
newMetricValue :: MetricValue
newMetricValue =
MetricValue' :: Maybe [Text]
-> Maybe Natural
-> Maybe [Natural]
-> Maybe [Double]
-> Maybe Double
-> Maybe [Text]
-> MetricValue
MetricValue'
{ $sel:cidrs:MetricValue' :: Maybe [Text]
cidrs = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:count:MetricValue' :: Maybe Natural
count = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:ports:MetricValue' :: Maybe [Natural]
ports = Maybe [Natural]
forall a. Maybe a
Prelude.Nothing,
$sel:numbers:MetricValue' :: Maybe [Double]
numbers = Maybe [Double]
forall a. Maybe a
Prelude.Nothing,
$sel:number:MetricValue' :: Maybe Double
number = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:strings:MetricValue' :: Maybe [Text]
strings = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
metricValue_cidrs :: Lens.Lens' MetricValue (Prelude.Maybe [Prelude.Text])
metricValue_cidrs :: (Maybe [Text] -> f (Maybe [Text])) -> MetricValue -> f MetricValue
metricValue_cidrs = (MetricValue -> Maybe [Text])
-> (MetricValue -> Maybe [Text] -> MetricValue)
-> Lens MetricValue MetricValue (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricValue' {Maybe [Text]
cidrs :: Maybe [Text]
$sel:cidrs:MetricValue' :: MetricValue -> Maybe [Text]
cidrs} -> Maybe [Text]
cidrs) (\s :: MetricValue
s@MetricValue' {} Maybe [Text]
a -> MetricValue
s {$sel:cidrs:MetricValue' :: Maybe [Text]
cidrs = Maybe [Text]
a} :: MetricValue) ((Maybe [Text] -> f (Maybe [Text]))
-> MetricValue -> f MetricValue)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> MetricValue
-> f MetricValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
metricValue_count :: Lens.Lens' MetricValue (Prelude.Maybe Prelude.Natural)
metricValue_count :: (Maybe Natural -> f (Maybe Natural))
-> MetricValue -> f MetricValue
metricValue_count = (MetricValue -> Maybe Natural)
-> (MetricValue -> Maybe Natural -> MetricValue)
-> Lens MetricValue MetricValue (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricValue' {Maybe Natural
count :: Maybe Natural
$sel:count:MetricValue' :: MetricValue -> Maybe Natural
count} -> Maybe Natural
count) (\s :: MetricValue
s@MetricValue' {} Maybe Natural
a -> MetricValue
s {$sel:count:MetricValue' :: Maybe Natural
count = Maybe Natural
a} :: MetricValue)
metricValue_ports :: Lens.Lens' MetricValue (Prelude.Maybe [Prelude.Natural])
metricValue_ports :: (Maybe [Natural] -> f (Maybe [Natural]))
-> MetricValue -> f MetricValue
metricValue_ports = (MetricValue -> Maybe [Natural])
-> (MetricValue -> Maybe [Natural] -> MetricValue)
-> Lens MetricValue MetricValue (Maybe [Natural]) (Maybe [Natural])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricValue' {Maybe [Natural]
ports :: Maybe [Natural]
$sel:ports:MetricValue' :: MetricValue -> Maybe [Natural]
ports} -> Maybe [Natural]
ports) (\s :: MetricValue
s@MetricValue' {} Maybe [Natural]
a -> MetricValue
s {$sel:ports:MetricValue' :: Maybe [Natural]
ports = Maybe [Natural]
a} :: MetricValue) ((Maybe [Natural] -> f (Maybe [Natural]))
-> MetricValue -> f MetricValue)
-> ((Maybe [Natural] -> f (Maybe [Natural]))
-> Maybe [Natural] -> f (Maybe [Natural]))
-> (Maybe [Natural] -> f (Maybe [Natural]))
-> MetricValue
-> f MetricValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Natural] [Natural] [Natural] [Natural]
-> Iso
(Maybe [Natural])
(Maybe [Natural])
(Maybe [Natural])
(Maybe [Natural])
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 [Natural] [Natural] [Natural] [Natural]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
metricValue_numbers :: Lens.Lens' MetricValue (Prelude.Maybe [Prelude.Double])
metricValue_numbers :: (Maybe [Double] -> f (Maybe [Double]))
-> MetricValue -> f MetricValue
metricValue_numbers = (MetricValue -> Maybe [Double])
-> (MetricValue -> Maybe [Double] -> MetricValue)
-> Lens MetricValue MetricValue (Maybe [Double]) (Maybe [Double])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricValue' {Maybe [Double]
numbers :: Maybe [Double]
$sel:numbers:MetricValue' :: MetricValue -> Maybe [Double]
numbers} -> Maybe [Double]
numbers) (\s :: MetricValue
s@MetricValue' {} Maybe [Double]
a -> MetricValue
s {$sel:numbers:MetricValue' :: Maybe [Double]
numbers = Maybe [Double]
a} :: MetricValue) ((Maybe [Double] -> f (Maybe [Double]))
-> MetricValue -> f MetricValue)
-> ((Maybe [Double] -> f (Maybe [Double]))
-> Maybe [Double] -> f (Maybe [Double]))
-> (Maybe [Double] -> f (Maybe [Double]))
-> MetricValue
-> f MetricValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Double] [Double] [Double] [Double]
-> Iso
(Maybe [Double]) (Maybe [Double]) (Maybe [Double]) (Maybe [Double])
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 [Double] [Double] [Double] [Double]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
metricValue_number :: Lens.Lens' MetricValue (Prelude.Maybe Prelude.Double)
metricValue_number :: (Maybe Double -> f (Maybe Double)) -> MetricValue -> f MetricValue
metricValue_number = (MetricValue -> Maybe Double)
-> (MetricValue -> Maybe Double -> MetricValue)
-> Lens MetricValue MetricValue (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricValue' {Maybe Double
number :: Maybe Double
$sel:number:MetricValue' :: MetricValue -> Maybe Double
number} -> Maybe Double
number) (\s :: MetricValue
s@MetricValue' {} Maybe Double
a -> MetricValue
s {$sel:number:MetricValue' :: Maybe Double
number = Maybe Double
a} :: MetricValue)
metricValue_strings :: Lens.Lens' MetricValue (Prelude.Maybe [Prelude.Text])
metricValue_strings :: (Maybe [Text] -> f (Maybe [Text])) -> MetricValue -> f MetricValue
metricValue_strings = (MetricValue -> Maybe [Text])
-> (MetricValue -> Maybe [Text] -> MetricValue)
-> Lens MetricValue MetricValue (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricValue' {Maybe [Text]
strings :: Maybe [Text]
$sel:strings:MetricValue' :: MetricValue -> Maybe [Text]
strings} -> Maybe [Text]
strings) (\s :: MetricValue
s@MetricValue' {} Maybe [Text]
a -> MetricValue
s {$sel:strings:MetricValue' :: Maybe [Text]
strings = Maybe [Text]
a} :: MetricValue) ((Maybe [Text] -> f (Maybe [Text]))
-> MetricValue -> f MetricValue)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> MetricValue
-> f MetricValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON MetricValue where
parseJSON :: Value -> Parser MetricValue
parseJSON =
String
-> (Object -> Parser MetricValue) -> Value -> Parser MetricValue
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"MetricValue"
( \Object
x ->
Maybe [Text]
-> Maybe Natural
-> Maybe [Natural]
-> Maybe [Double]
-> Maybe Double
-> Maybe [Text]
-> MetricValue
MetricValue'
(Maybe [Text]
-> Maybe Natural
-> Maybe [Natural]
-> Maybe [Double]
-> Maybe Double
-> Maybe [Text]
-> MetricValue)
-> Parser (Maybe [Text])
-> Parser
(Maybe Natural
-> Maybe [Natural]
-> Maybe [Double]
-> Maybe Double
-> Maybe [Text]
-> MetricValue)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cidrs" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Natural
-> Maybe [Natural]
-> Maybe [Double]
-> Maybe Double
-> Maybe [Text]
-> MetricValue)
-> Parser (Maybe Natural)
-> Parser
(Maybe [Natural]
-> Maybe [Double] -> Maybe Double -> Maybe [Text] -> MetricValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"count")
Parser
(Maybe [Natural]
-> Maybe [Double] -> Maybe Double -> Maybe [Text] -> MetricValue)
-> Parser (Maybe [Natural])
-> Parser
(Maybe [Double] -> Maybe Double -> Maybe [Text] -> MetricValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Natural]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ports" Parser (Maybe (Maybe [Natural]))
-> Maybe [Natural] -> Parser (Maybe [Natural])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Natural]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe [Double] -> Maybe Double -> Maybe [Text] -> MetricValue)
-> Parser (Maybe [Double])
-> Parser (Maybe Double -> Maybe [Text] -> MetricValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Double]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"numbers" Parser (Maybe (Maybe [Double]))
-> Maybe [Double] -> Parser (Maybe [Double])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Double]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Double -> Maybe [Text] -> MetricValue)
-> Parser (Maybe Double) -> Parser (Maybe [Text] -> MetricValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"number")
Parser (Maybe [Text] -> MetricValue)
-> Parser (Maybe [Text]) -> Parser MetricValue
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"strings" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable MetricValue
instance Prelude.NFData MetricValue
instance Core.ToJSON MetricValue where
toJSON :: MetricValue -> Value
toJSON MetricValue' {Maybe Double
Maybe Natural
Maybe [Double]
Maybe [Natural]
Maybe [Text]
strings :: Maybe [Text]
number :: Maybe Double
numbers :: Maybe [Double]
ports :: Maybe [Natural]
count :: Maybe Natural
cidrs :: Maybe [Text]
$sel:strings:MetricValue' :: MetricValue -> Maybe [Text]
$sel:number:MetricValue' :: MetricValue -> Maybe Double
$sel:numbers:MetricValue' :: MetricValue -> Maybe [Double]
$sel:ports:MetricValue' :: MetricValue -> Maybe [Natural]
$sel:count:MetricValue' :: MetricValue -> Maybe Natural
$sel:cidrs:MetricValue' :: MetricValue -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"cidrs" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
cidrs,
(Text
"count" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
count,
(Text
"ports" Text -> [Natural] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Natural] -> Pair) -> Maybe [Natural] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Natural]
ports,
(Text
"numbers" Text -> [Double] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Double] -> Pair) -> Maybe [Double] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Double]
numbers,
(Text
"number" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
number,
(Text
"strings" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
strings
]
)