{-# 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.ResponseResourceMetric
-- 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.ResponseResourceMetric 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

-- | An object that contains the full name, description, and unit of a
-- metric.
--
-- /See:/ 'newResponseResourceMetric' smart constructor.
data ResponseResourceMetric = ResponseResourceMetric'
  { -- | The description of the metric.
    ResponseResourceMetric -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The full name of the metric.
    ResponseResourceMetric -> Maybe Text
metric :: Prelude.Maybe Prelude.Text,
    -- | The unit of the metric.
    ResponseResourceMetric -> Maybe Text
unit :: Prelude.Maybe Prelude.Text
  }
  deriving (ResponseResourceMetric -> ResponseResourceMetric -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResponseResourceMetric -> ResponseResourceMetric -> Bool
$c/= :: ResponseResourceMetric -> ResponseResourceMetric -> Bool
== :: ResponseResourceMetric -> ResponseResourceMetric -> Bool
$c== :: ResponseResourceMetric -> ResponseResourceMetric -> Bool
Prelude.Eq, ReadPrec [ResponseResourceMetric]
ReadPrec ResponseResourceMetric
Int -> ReadS ResponseResourceMetric
ReadS [ResponseResourceMetric]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResponseResourceMetric]
$creadListPrec :: ReadPrec [ResponseResourceMetric]
readPrec :: ReadPrec ResponseResourceMetric
$creadPrec :: ReadPrec ResponseResourceMetric
readList :: ReadS [ResponseResourceMetric]
$creadList :: ReadS [ResponseResourceMetric]
readsPrec :: Int -> ReadS ResponseResourceMetric
$creadsPrec :: Int -> ReadS ResponseResourceMetric
Prelude.Read, Int -> ResponseResourceMetric -> ShowS
[ResponseResourceMetric] -> ShowS
ResponseResourceMetric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResponseResourceMetric] -> ShowS
$cshowList :: [ResponseResourceMetric] -> ShowS
show :: ResponseResourceMetric -> String
$cshow :: ResponseResourceMetric -> String
showsPrec :: Int -> ResponseResourceMetric -> ShowS
$cshowsPrec :: Int -> ResponseResourceMetric -> ShowS
Prelude.Show, forall x. Rep ResponseResourceMetric x -> ResponseResourceMetric
forall x. ResponseResourceMetric -> Rep ResponseResourceMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResponseResourceMetric x -> ResponseResourceMetric
$cfrom :: forall x. ResponseResourceMetric -> Rep ResponseResourceMetric x
Prelude.Generic)

-- |
-- Create a value of 'ResponseResourceMetric' 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:
--
-- 'description', 'responseResourceMetric_description' - The description of the metric.
--
-- 'metric', 'responseResourceMetric_metric' - The full name of the metric.
--
-- 'unit', 'responseResourceMetric_unit' - The unit of the metric.
newResponseResourceMetric ::
  ResponseResourceMetric
newResponseResourceMetric :: ResponseResourceMetric
newResponseResourceMetric =
  ResponseResourceMetric'
    { $sel:description:ResponseResourceMetric' :: Maybe Text
description =
        forall a. Maybe a
Prelude.Nothing,
      $sel:metric:ResponseResourceMetric' :: Maybe Text
metric = forall a. Maybe a
Prelude.Nothing,
      $sel:unit:ResponseResourceMetric' :: Maybe Text
unit = forall a. Maybe a
Prelude.Nothing
    }

-- | The description of the metric.
responseResourceMetric_description :: Lens.Lens' ResponseResourceMetric (Prelude.Maybe Prelude.Text)
responseResourceMetric_description :: Lens' ResponseResourceMetric (Maybe Text)
responseResourceMetric_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseResourceMetric' {Maybe Text
description :: Maybe Text
$sel:description:ResponseResourceMetric' :: ResponseResourceMetric -> Maybe Text
description} -> Maybe Text
description) (\s :: ResponseResourceMetric
s@ResponseResourceMetric' {} Maybe Text
a -> ResponseResourceMetric
s {$sel:description:ResponseResourceMetric' :: Maybe Text
description = Maybe Text
a} :: ResponseResourceMetric)

-- | The full name of the metric.
responseResourceMetric_metric :: Lens.Lens' ResponseResourceMetric (Prelude.Maybe Prelude.Text)
responseResourceMetric_metric :: Lens' ResponseResourceMetric (Maybe Text)
responseResourceMetric_metric = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseResourceMetric' {Maybe Text
metric :: Maybe Text
$sel:metric:ResponseResourceMetric' :: ResponseResourceMetric -> Maybe Text
metric} -> Maybe Text
metric) (\s :: ResponseResourceMetric
s@ResponseResourceMetric' {} Maybe Text
a -> ResponseResourceMetric
s {$sel:metric:ResponseResourceMetric' :: Maybe Text
metric = Maybe Text
a} :: ResponseResourceMetric)

-- | The unit of the metric.
responseResourceMetric_unit :: Lens.Lens' ResponseResourceMetric (Prelude.Maybe Prelude.Text)
responseResourceMetric_unit :: Lens' ResponseResourceMetric (Maybe Text)
responseResourceMetric_unit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseResourceMetric' {Maybe Text
unit :: Maybe Text
$sel:unit:ResponseResourceMetric' :: ResponseResourceMetric -> Maybe Text
unit} -> Maybe Text
unit) (\s :: ResponseResourceMetric
s@ResponseResourceMetric' {} Maybe Text
a -> ResponseResourceMetric
s {$sel:unit:ResponseResourceMetric' :: Maybe Text
unit = Maybe Text
a} :: ResponseResourceMetric)

instance Data.FromJSON ResponseResourceMetric where
  parseJSON :: Value -> Parser ResponseResourceMetric
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResponseResourceMetric"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> ResponseResourceMetric
ResponseResourceMetric'
            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
"Description")
            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")
            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
"Unit")
      )

instance Prelude.Hashable ResponseResourceMetric where
  hashWithSalt :: Int -> ResponseResourceMetric -> Int
hashWithSalt Int
_salt ResponseResourceMetric' {Maybe Text
unit :: Maybe Text
metric :: Maybe Text
description :: Maybe Text
$sel:unit:ResponseResourceMetric' :: ResponseResourceMetric -> Maybe Text
$sel:metric:ResponseResourceMetric' :: ResponseResourceMetric -> Maybe Text
$sel:description:ResponseResourceMetric' :: ResponseResourceMetric -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
metric
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
unit

instance Prelude.NFData ResponseResourceMetric where
  rnf :: ResponseResourceMetric -> ()
rnf ResponseResourceMetric' {Maybe Text
unit :: Maybe Text
metric :: Maybe Text
description :: Maybe Text
$sel:unit:ResponseResourceMetric' :: ResponseResourceMetric -> Maybe Text
$sel:metric:ResponseResourceMetric' :: ResponseResourceMetric -> Maybe Text
$sel:description:ResponseResourceMetric' :: ResponseResourceMetric -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metric
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
unit