{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Pi.Types.MetricDimensionGroups
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Pi.Types.MetricDimensionGroups where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pi.Types.DimensionGroupDetail
import qualified Amazonka.Prelude as Prelude

-- | The available dimension information for a metric type.
--
-- /See:/ 'newMetricDimensionGroups' smart constructor.
data MetricDimensionGroups = MetricDimensionGroups'
  { -- | The available dimension groups for a metric type.
    MetricDimensionGroups -> Maybe [DimensionGroupDetail]
groups :: Prelude.Maybe [DimensionGroupDetail],
    -- | The metric type to which the dimension information belongs.
    MetricDimensionGroups -> Maybe Text
metric :: Prelude.Maybe Prelude.Text
  }
  deriving (MetricDimensionGroups -> MetricDimensionGroups -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricDimensionGroups -> MetricDimensionGroups -> Bool
$c/= :: MetricDimensionGroups -> MetricDimensionGroups -> Bool
== :: MetricDimensionGroups -> MetricDimensionGroups -> Bool
$c== :: MetricDimensionGroups -> MetricDimensionGroups -> Bool
Prelude.Eq, ReadPrec [MetricDimensionGroups]
ReadPrec MetricDimensionGroups
Int -> ReadS MetricDimensionGroups
ReadS [MetricDimensionGroups]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricDimensionGroups]
$creadListPrec :: ReadPrec [MetricDimensionGroups]
readPrec :: ReadPrec MetricDimensionGroups
$creadPrec :: ReadPrec MetricDimensionGroups
readList :: ReadS [MetricDimensionGroups]
$creadList :: ReadS [MetricDimensionGroups]
readsPrec :: Int -> ReadS MetricDimensionGroups
$creadsPrec :: Int -> ReadS MetricDimensionGroups
Prelude.Read, Int -> MetricDimensionGroups -> ShowS
[MetricDimensionGroups] -> ShowS
MetricDimensionGroups -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricDimensionGroups] -> ShowS
$cshowList :: [MetricDimensionGroups] -> ShowS
show :: MetricDimensionGroups -> String
$cshow :: MetricDimensionGroups -> String
showsPrec :: Int -> MetricDimensionGroups -> ShowS
$cshowsPrec :: Int -> MetricDimensionGroups -> ShowS
Prelude.Show, forall x. Rep MetricDimensionGroups x -> MetricDimensionGroups
forall x. MetricDimensionGroups -> Rep MetricDimensionGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricDimensionGroups x -> MetricDimensionGroups
$cfrom :: forall x. MetricDimensionGroups -> Rep MetricDimensionGroups x
Prelude.Generic)

-- |
-- Create a value of 'MetricDimensionGroups' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'groups', 'metricDimensionGroups_groups' - The available dimension groups for a metric type.
--
-- 'metric', 'metricDimensionGroups_metric' - The metric type to which the dimension information belongs.
newMetricDimensionGroups ::
  MetricDimensionGroups
newMetricDimensionGroups :: MetricDimensionGroups
newMetricDimensionGroups =
  MetricDimensionGroups'
    { $sel:groups:MetricDimensionGroups' :: Maybe [DimensionGroupDetail]
groups = forall a. Maybe a
Prelude.Nothing,
      $sel:metric:MetricDimensionGroups' :: Maybe Text
metric = forall a. Maybe a
Prelude.Nothing
    }

-- | The available dimension groups for a metric type.
metricDimensionGroups_groups :: Lens.Lens' MetricDimensionGroups (Prelude.Maybe [DimensionGroupDetail])
metricDimensionGroups_groups :: Lens' MetricDimensionGroups (Maybe [DimensionGroupDetail])
metricDimensionGroups_groups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDimensionGroups' {Maybe [DimensionGroupDetail]
groups :: Maybe [DimensionGroupDetail]
$sel:groups:MetricDimensionGroups' :: MetricDimensionGroups -> Maybe [DimensionGroupDetail]
groups} -> Maybe [DimensionGroupDetail]
groups) (\s :: MetricDimensionGroups
s@MetricDimensionGroups' {} Maybe [DimensionGroupDetail]
a -> MetricDimensionGroups
s {$sel:groups:MetricDimensionGroups' :: Maybe [DimensionGroupDetail]
groups = Maybe [DimensionGroupDetail]
a} :: MetricDimensionGroups) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The metric type to which the dimension information belongs.
metricDimensionGroups_metric :: Lens.Lens' MetricDimensionGroups (Prelude.Maybe Prelude.Text)
metricDimensionGroups_metric :: Lens' MetricDimensionGroups (Maybe Text)
metricDimensionGroups_metric = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDimensionGroups' {Maybe Text
metric :: Maybe Text
$sel:metric:MetricDimensionGroups' :: MetricDimensionGroups -> Maybe Text
metric} -> Maybe Text
metric) (\s :: MetricDimensionGroups
s@MetricDimensionGroups' {} Maybe Text
a -> MetricDimensionGroups
s {$sel:metric:MetricDimensionGroups' :: Maybe Text
metric = Maybe Text
a} :: MetricDimensionGroups)

instance Data.FromJSON MetricDimensionGroups where
  parseJSON :: Value -> Parser MetricDimensionGroups
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MetricDimensionGroups"
      ( \Object
x ->
          Maybe [DimensionGroupDetail] -> Maybe Text -> MetricDimensionGroups
MetricDimensionGroups'
            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
"Groups" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Metric")
      )

instance Prelude.Hashable MetricDimensionGroups where
  hashWithSalt :: Int -> MetricDimensionGroups -> Int
hashWithSalt Int
_salt MetricDimensionGroups' {Maybe [DimensionGroupDetail]
Maybe Text
metric :: Maybe Text
groups :: Maybe [DimensionGroupDetail]
$sel:metric:MetricDimensionGroups' :: MetricDimensionGroups -> Maybe Text
$sel:groups:MetricDimensionGroups' :: MetricDimensionGroups -> Maybe [DimensionGroupDetail]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DimensionGroupDetail]
groups
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
metric

instance Prelude.NFData MetricDimensionGroups where
  rnf :: MetricDimensionGroups -> ()
rnf MetricDimensionGroups' {Maybe [DimensionGroupDetail]
Maybe Text
metric :: Maybe Text
groups :: Maybe [DimensionGroupDetail]
$sel:metric:MetricDimensionGroups' :: MetricDimensionGroups -> Maybe Text
$sel:groups:MetricDimensionGroups' :: MetricDimensionGroups -> Maybe [DimensionGroupDetail]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DimensionGroupDetail]
groups seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metric