{-# 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.Pi.Types.MetricQuery where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pi.Types.DimensionGroup
import qualified Amazonka.Prelude as Prelude
data MetricQuery = MetricQuery'
{
MetricQuery -> Maybe DimensionGroup
groupBy :: Prelude.Maybe DimensionGroup,
MetricQuery -> Maybe (HashMap Text Text)
filter' :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
MetricQuery -> Text
metric :: Prelude.Text
}
deriving (MetricQuery -> MetricQuery -> Bool
(MetricQuery -> MetricQuery -> Bool)
-> (MetricQuery -> MetricQuery -> Bool) -> Eq MetricQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricQuery -> MetricQuery -> Bool
$c/= :: MetricQuery -> MetricQuery -> Bool
== :: MetricQuery -> MetricQuery -> Bool
$c== :: MetricQuery -> MetricQuery -> Bool
Prelude.Eq, ReadPrec [MetricQuery]
ReadPrec MetricQuery
Int -> ReadS MetricQuery
ReadS [MetricQuery]
(Int -> ReadS MetricQuery)
-> ReadS [MetricQuery]
-> ReadPrec MetricQuery
-> ReadPrec [MetricQuery]
-> Read MetricQuery
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricQuery]
$creadListPrec :: ReadPrec [MetricQuery]
readPrec :: ReadPrec MetricQuery
$creadPrec :: ReadPrec MetricQuery
readList :: ReadS [MetricQuery]
$creadList :: ReadS [MetricQuery]
readsPrec :: Int -> ReadS MetricQuery
$creadsPrec :: Int -> ReadS MetricQuery
Prelude.Read, Int -> MetricQuery -> ShowS
[MetricQuery] -> ShowS
MetricQuery -> String
(Int -> MetricQuery -> ShowS)
-> (MetricQuery -> String)
-> ([MetricQuery] -> ShowS)
-> Show MetricQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricQuery] -> ShowS
$cshowList :: [MetricQuery] -> ShowS
show :: MetricQuery -> String
$cshow :: MetricQuery -> String
showsPrec :: Int -> MetricQuery -> ShowS
$cshowsPrec :: Int -> MetricQuery -> ShowS
Prelude.Show, (forall x. MetricQuery -> Rep MetricQuery x)
-> (forall x. Rep MetricQuery x -> MetricQuery)
-> Generic MetricQuery
forall x. Rep MetricQuery x -> MetricQuery
forall x. MetricQuery -> Rep MetricQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricQuery x -> MetricQuery
$cfrom :: forall x. MetricQuery -> Rep MetricQuery x
Prelude.Generic)
newMetricQuery ::
Prelude.Text ->
MetricQuery
newMetricQuery :: Text -> MetricQuery
newMetricQuery Text
pMetric_ =
MetricQuery' :: Maybe DimensionGroup
-> Maybe (HashMap Text Text) -> Text -> MetricQuery
MetricQuery'
{ $sel:groupBy:MetricQuery' :: Maybe DimensionGroup
groupBy = Maybe DimensionGroup
forall a. Maybe a
Prelude.Nothing,
$sel:filter':MetricQuery' :: Maybe (HashMap Text Text)
filter' = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:metric:MetricQuery' :: Text
metric = Text
pMetric_
}
metricQuery_groupBy :: Lens.Lens' MetricQuery (Prelude.Maybe DimensionGroup)
metricQuery_groupBy :: (Maybe DimensionGroup -> f (Maybe DimensionGroup))
-> MetricQuery -> f MetricQuery
metricQuery_groupBy = (MetricQuery -> Maybe DimensionGroup)
-> (MetricQuery -> Maybe DimensionGroup -> MetricQuery)
-> Lens
MetricQuery
MetricQuery
(Maybe DimensionGroup)
(Maybe DimensionGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricQuery' {Maybe DimensionGroup
groupBy :: Maybe DimensionGroup
$sel:groupBy:MetricQuery' :: MetricQuery -> Maybe DimensionGroup
groupBy} -> Maybe DimensionGroup
groupBy) (\s :: MetricQuery
s@MetricQuery' {} Maybe DimensionGroup
a -> MetricQuery
s {$sel:groupBy:MetricQuery' :: Maybe DimensionGroup
groupBy = Maybe DimensionGroup
a} :: MetricQuery)
metricQuery_filter :: Lens.Lens' MetricQuery (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
metricQuery_filter :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> MetricQuery -> f MetricQuery
metricQuery_filter = (MetricQuery -> Maybe (HashMap Text Text))
-> (MetricQuery -> Maybe (HashMap Text Text) -> MetricQuery)
-> Lens
MetricQuery
MetricQuery
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricQuery' {Maybe (HashMap Text Text)
filter' :: Maybe (HashMap Text Text)
$sel:filter':MetricQuery' :: MetricQuery -> Maybe (HashMap Text Text)
filter'} -> Maybe (HashMap Text Text)
filter') (\s :: MetricQuery
s@MetricQuery' {} Maybe (HashMap Text Text)
a -> MetricQuery
s {$sel:filter':MetricQuery' :: Maybe (HashMap Text Text)
filter' = Maybe (HashMap Text Text)
a} :: MetricQuery) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> MetricQuery -> f MetricQuery)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> MetricQuery
-> f MetricQuery
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text 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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
metricQuery_metric :: Lens.Lens' MetricQuery Prelude.Text
metricQuery_metric :: (Text -> f Text) -> MetricQuery -> f MetricQuery
metricQuery_metric = (MetricQuery -> Text)
-> (MetricQuery -> Text -> MetricQuery)
-> Lens MetricQuery MetricQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricQuery' {Text
metric :: Text
$sel:metric:MetricQuery' :: MetricQuery -> Text
metric} -> Text
metric) (\s :: MetricQuery
s@MetricQuery' {} Text
a -> MetricQuery
s {$sel:metric:MetricQuery' :: Text
metric = Text
a} :: MetricQuery)
instance Prelude.Hashable MetricQuery
instance Prelude.NFData MetricQuery
instance Core.ToJSON MetricQuery where
toJSON :: MetricQuery -> Value
toJSON MetricQuery' {Maybe (HashMap Text Text)
Maybe DimensionGroup
Text
metric :: Text
filter' :: Maybe (HashMap Text Text)
groupBy :: Maybe DimensionGroup
$sel:metric:MetricQuery' :: MetricQuery -> Text
$sel:filter':MetricQuery' :: MetricQuery -> Maybe (HashMap Text Text)
$sel:groupBy:MetricQuery' :: MetricQuery -> Maybe DimensionGroup
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"GroupBy" Text -> DimensionGroup -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DimensionGroup -> Pair) -> Maybe DimensionGroup -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DimensionGroup
groupBy,
(Text
"Filter" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
filter',
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Metric" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
metric)
]
)