{-# 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.PerformanceInsightsReferenceMetric
-- 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.DevOpsGuru.Types.PerformanceInsightsReferenceMetric where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DevOpsGuru.Types.PerformanceInsightsMetricQuery
import qualified Amazonka.Prelude as Prelude

-- | Information about a reference metric used to evaluate Performance
-- Insights.
--
-- /See:/ 'newPerformanceInsightsReferenceMetric' smart constructor.
data PerformanceInsightsReferenceMetric = PerformanceInsightsReferenceMetric'
  { -- | A query to be processed on the metric.
    PerformanceInsightsReferenceMetric
-> Maybe PerformanceInsightsMetricQuery
metricQuery :: Prelude.Maybe PerformanceInsightsMetricQuery
  }
  deriving (PerformanceInsightsReferenceMetric
-> PerformanceInsightsReferenceMetric -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PerformanceInsightsReferenceMetric
-> PerformanceInsightsReferenceMetric -> Bool
$c/= :: PerformanceInsightsReferenceMetric
-> PerformanceInsightsReferenceMetric -> Bool
== :: PerformanceInsightsReferenceMetric
-> PerformanceInsightsReferenceMetric -> Bool
$c== :: PerformanceInsightsReferenceMetric
-> PerformanceInsightsReferenceMetric -> Bool
Prelude.Eq, ReadPrec [PerformanceInsightsReferenceMetric]
ReadPrec PerformanceInsightsReferenceMetric
Int -> ReadS PerformanceInsightsReferenceMetric
ReadS [PerformanceInsightsReferenceMetric]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PerformanceInsightsReferenceMetric]
$creadListPrec :: ReadPrec [PerformanceInsightsReferenceMetric]
readPrec :: ReadPrec PerformanceInsightsReferenceMetric
$creadPrec :: ReadPrec PerformanceInsightsReferenceMetric
readList :: ReadS [PerformanceInsightsReferenceMetric]
$creadList :: ReadS [PerformanceInsightsReferenceMetric]
readsPrec :: Int -> ReadS PerformanceInsightsReferenceMetric
$creadsPrec :: Int -> ReadS PerformanceInsightsReferenceMetric
Prelude.Read, Int -> PerformanceInsightsReferenceMetric -> ShowS
[PerformanceInsightsReferenceMetric] -> ShowS
PerformanceInsightsReferenceMetric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PerformanceInsightsReferenceMetric] -> ShowS
$cshowList :: [PerformanceInsightsReferenceMetric] -> ShowS
show :: PerformanceInsightsReferenceMetric -> String
$cshow :: PerformanceInsightsReferenceMetric -> String
showsPrec :: Int -> PerformanceInsightsReferenceMetric -> ShowS
$cshowsPrec :: Int -> PerformanceInsightsReferenceMetric -> ShowS
Prelude.Show, forall x.
Rep PerformanceInsightsReferenceMetric x
-> PerformanceInsightsReferenceMetric
forall x.
PerformanceInsightsReferenceMetric
-> Rep PerformanceInsightsReferenceMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PerformanceInsightsReferenceMetric x
-> PerformanceInsightsReferenceMetric
$cfrom :: forall x.
PerformanceInsightsReferenceMetric
-> Rep PerformanceInsightsReferenceMetric x
Prelude.Generic)

-- |
-- Create a value of 'PerformanceInsightsReferenceMetric' 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:
--
-- 'metricQuery', 'performanceInsightsReferenceMetric_metricQuery' - A query to be processed on the metric.
newPerformanceInsightsReferenceMetric ::
  PerformanceInsightsReferenceMetric
newPerformanceInsightsReferenceMetric :: PerformanceInsightsReferenceMetric
newPerformanceInsightsReferenceMetric =
  PerformanceInsightsReferenceMetric'
    { $sel:metricQuery:PerformanceInsightsReferenceMetric' :: Maybe PerformanceInsightsMetricQuery
metricQuery =
        forall a. Maybe a
Prelude.Nothing
    }

-- | A query to be processed on the metric.
performanceInsightsReferenceMetric_metricQuery :: Lens.Lens' PerformanceInsightsReferenceMetric (Prelude.Maybe PerformanceInsightsMetricQuery)
performanceInsightsReferenceMetric_metricQuery :: Lens'
  PerformanceInsightsReferenceMetric
  (Maybe PerformanceInsightsMetricQuery)
performanceInsightsReferenceMetric_metricQuery = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PerformanceInsightsReferenceMetric' {Maybe PerformanceInsightsMetricQuery
metricQuery :: Maybe PerformanceInsightsMetricQuery
$sel:metricQuery:PerformanceInsightsReferenceMetric' :: PerformanceInsightsReferenceMetric
-> Maybe PerformanceInsightsMetricQuery
metricQuery} -> Maybe PerformanceInsightsMetricQuery
metricQuery) (\s :: PerformanceInsightsReferenceMetric
s@PerformanceInsightsReferenceMetric' {} Maybe PerformanceInsightsMetricQuery
a -> PerformanceInsightsReferenceMetric
s {$sel:metricQuery:PerformanceInsightsReferenceMetric' :: Maybe PerformanceInsightsMetricQuery
metricQuery = Maybe PerformanceInsightsMetricQuery
a} :: PerformanceInsightsReferenceMetric)

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

instance
  Prelude.Hashable
    PerformanceInsightsReferenceMetric
  where
  hashWithSalt :: Int -> PerformanceInsightsReferenceMetric -> Int
hashWithSalt
    Int
_salt
    PerformanceInsightsReferenceMetric' {Maybe PerformanceInsightsMetricQuery
metricQuery :: Maybe PerformanceInsightsMetricQuery
$sel:metricQuery:PerformanceInsightsReferenceMetric' :: PerformanceInsightsReferenceMetric
-> Maybe PerformanceInsightsMetricQuery
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PerformanceInsightsMetricQuery
metricQuery

instance
  Prelude.NFData
    PerformanceInsightsReferenceMetric
  where
  rnf :: PerformanceInsightsReferenceMetric -> ()
rnf PerformanceInsightsReferenceMetric' {Maybe PerformanceInsightsMetricQuery
metricQuery :: Maybe PerformanceInsightsMetricQuery
$sel:metricQuery:PerformanceInsightsReferenceMetric' :: PerformanceInsightsReferenceMetric
-> Maybe PerformanceInsightsMetricQuery
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PerformanceInsightsMetricQuery
metricQuery