{-# 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.DevOpsGuru.Types.CloudWatchMetricsDimension
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DevOpsGuru.Types.CloudWatchMetricsDimension where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The dimension of a Amazon CloudWatch metric that is used when DevOps
-- Guru analyzes the resources in your account for operational problems and
-- anomalous behavior. A dimension is a name\/value pair that is part of
-- the identity of a metric. A metric can have up to 10 dimensions. For
-- more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension Dimensions>
-- in the /Amazon CloudWatch User Guide/.
--
-- /See:/ 'newCloudWatchMetricsDimension' smart constructor.
data CloudWatchMetricsDimension = CloudWatchMetricsDimension'
  { -- | The value of the CloudWatch dimension.
    CloudWatchMetricsDimension -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The name of the CloudWatch dimension.
    CloudWatchMetricsDimension -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (CloudWatchMetricsDimension -> CloudWatchMetricsDimension -> Bool
(CloudWatchMetricsDimension -> CloudWatchMetricsDimension -> Bool)
-> (CloudWatchMetricsDimension
    -> CloudWatchMetricsDimension -> Bool)
-> Eq CloudWatchMetricsDimension
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchMetricsDimension -> CloudWatchMetricsDimension -> Bool
$c/= :: CloudWatchMetricsDimension -> CloudWatchMetricsDimension -> Bool
== :: CloudWatchMetricsDimension -> CloudWatchMetricsDimension -> Bool
$c== :: CloudWatchMetricsDimension -> CloudWatchMetricsDimension -> Bool
Prelude.Eq, ReadPrec [CloudWatchMetricsDimension]
ReadPrec CloudWatchMetricsDimension
Int -> ReadS CloudWatchMetricsDimension
ReadS [CloudWatchMetricsDimension]
(Int -> ReadS CloudWatchMetricsDimension)
-> ReadS [CloudWatchMetricsDimension]
-> ReadPrec CloudWatchMetricsDimension
-> ReadPrec [CloudWatchMetricsDimension]
-> Read CloudWatchMetricsDimension
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchMetricsDimension]
$creadListPrec :: ReadPrec [CloudWatchMetricsDimension]
readPrec :: ReadPrec CloudWatchMetricsDimension
$creadPrec :: ReadPrec CloudWatchMetricsDimension
readList :: ReadS [CloudWatchMetricsDimension]
$creadList :: ReadS [CloudWatchMetricsDimension]
readsPrec :: Int -> ReadS CloudWatchMetricsDimension
$creadsPrec :: Int -> ReadS CloudWatchMetricsDimension
Prelude.Read, Int -> CloudWatchMetricsDimension -> ShowS
[CloudWatchMetricsDimension] -> ShowS
CloudWatchMetricsDimension -> String
(Int -> CloudWatchMetricsDimension -> ShowS)
-> (CloudWatchMetricsDimension -> String)
-> ([CloudWatchMetricsDimension] -> ShowS)
-> Show CloudWatchMetricsDimension
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchMetricsDimension] -> ShowS
$cshowList :: [CloudWatchMetricsDimension] -> ShowS
show :: CloudWatchMetricsDimension -> String
$cshow :: CloudWatchMetricsDimension -> String
showsPrec :: Int -> CloudWatchMetricsDimension -> ShowS
$cshowsPrec :: Int -> CloudWatchMetricsDimension -> ShowS
Prelude.Show, (forall x.
 CloudWatchMetricsDimension -> Rep CloudWatchMetricsDimension x)
-> (forall x.
    Rep CloudWatchMetricsDimension x -> CloudWatchMetricsDimension)
-> Generic CloudWatchMetricsDimension
forall x.
Rep CloudWatchMetricsDimension x -> CloudWatchMetricsDimension
forall x.
CloudWatchMetricsDimension -> Rep CloudWatchMetricsDimension x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudWatchMetricsDimension x -> CloudWatchMetricsDimension
$cfrom :: forall x.
CloudWatchMetricsDimension -> Rep CloudWatchMetricsDimension x
Prelude.Generic)

-- |
-- Create a value of 'CloudWatchMetricsDimension' 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:
--
-- 'value', 'cloudWatchMetricsDimension_value' - The value of the CloudWatch dimension.
--
-- 'name', 'cloudWatchMetricsDimension_name' - The name of the CloudWatch dimension.
newCloudWatchMetricsDimension ::
  CloudWatchMetricsDimension
newCloudWatchMetricsDimension :: CloudWatchMetricsDimension
newCloudWatchMetricsDimension =
  CloudWatchMetricsDimension' :: Maybe Text -> Maybe Text -> CloudWatchMetricsDimension
CloudWatchMetricsDimension'
    { $sel:value:CloudWatchMetricsDimension' :: Maybe Text
value =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CloudWatchMetricsDimension' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The value of the CloudWatch dimension.
cloudWatchMetricsDimension_value :: Lens.Lens' CloudWatchMetricsDimension (Prelude.Maybe Prelude.Text)
cloudWatchMetricsDimension_value :: (Maybe Text -> f (Maybe Text))
-> CloudWatchMetricsDimension -> f CloudWatchMetricsDimension
cloudWatchMetricsDimension_value = (CloudWatchMetricsDimension -> Maybe Text)
-> (CloudWatchMetricsDimension
    -> Maybe Text -> CloudWatchMetricsDimension)
-> Lens
     CloudWatchMetricsDimension
     CloudWatchMetricsDimension
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchMetricsDimension' {Maybe Text
value :: Maybe Text
$sel:value:CloudWatchMetricsDimension' :: CloudWatchMetricsDimension -> Maybe Text
value} -> Maybe Text
value) (\s :: CloudWatchMetricsDimension
s@CloudWatchMetricsDimension' {} Maybe Text
a -> CloudWatchMetricsDimension
s {$sel:value:CloudWatchMetricsDimension' :: Maybe Text
value = Maybe Text
a} :: CloudWatchMetricsDimension)

-- | The name of the CloudWatch dimension.
cloudWatchMetricsDimension_name :: Lens.Lens' CloudWatchMetricsDimension (Prelude.Maybe Prelude.Text)
cloudWatchMetricsDimension_name :: (Maybe Text -> f (Maybe Text))
-> CloudWatchMetricsDimension -> f CloudWatchMetricsDimension
cloudWatchMetricsDimension_name = (CloudWatchMetricsDimension -> Maybe Text)
-> (CloudWatchMetricsDimension
    -> Maybe Text -> CloudWatchMetricsDimension)
-> Lens
     CloudWatchMetricsDimension
     CloudWatchMetricsDimension
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchMetricsDimension' {Maybe Text
name :: Maybe Text
$sel:name:CloudWatchMetricsDimension' :: CloudWatchMetricsDimension -> Maybe Text
name} -> Maybe Text
name) (\s :: CloudWatchMetricsDimension
s@CloudWatchMetricsDimension' {} Maybe Text
a -> CloudWatchMetricsDimension
s {$sel:name:CloudWatchMetricsDimension' :: Maybe Text
name = Maybe Text
a} :: CloudWatchMetricsDimension)

instance Core.FromJSON CloudWatchMetricsDimension where
  parseJSON :: Value -> Parser CloudWatchMetricsDimension
parseJSON =
    String
-> (Object -> Parser CloudWatchMetricsDimension)
-> Value
-> Parser CloudWatchMetricsDimension
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CloudWatchMetricsDimension"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> CloudWatchMetricsDimension
CloudWatchMetricsDimension'
            (Maybe Text -> Maybe Text -> CloudWatchMetricsDimension)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> CloudWatchMetricsDimension)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value") Parser (Maybe Text -> CloudWatchMetricsDimension)
-> Parser (Maybe Text) -> Parser CloudWatchMetricsDimension
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
      )

instance Prelude.Hashable CloudWatchMetricsDimension

instance Prelude.NFData CloudWatchMetricsDimension