{-# 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.LookoutMetrics.Types.AnomalyGroupSummary
-- 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.LookoutMetrics.Types.AnomalyGroupSummary where

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

-- | Details about a group of anomalous metrics.
--
-- /See:/ 'newAnomalyGroupSummary' smart constructor.
data AnomalyGroupSummary = AnomalyGroupSummary'
  { -- | The start time for the group.
    AnomalyGroupSummary -> Maybe Text
startTime :: Prelude.Maybe Prelude.Text,
    -- | The ID of the anomaly group.
    AnomalyGroupSummary -> Maybe Text
anomalyGroupId :: Prelude.Maybe Prelude.Text,
    -- | The severity score of the group.
    AnomalyGroupSummary -> Maybe Double
anomalyGroupScore :: Prelude.Maybe Prelude.Double,
    -- | The name of the primary affected measure for the group.
    AnomalyGroupSummary -> Maybe Text
primaryMetricName :: Prelude.Maybe Prelude.Text,
    -- | The end time for the group.
    AnomalyGroupSummary -> Maybe Text
endTime :: Prelude.Maybe Prelude.Text
  }
  deriving (AnomalyGroupSummary -> AnomalyGroupSummary -> Bool
(AnomalyGroupSummary -> AnomalyGroupSummary -> Bool)
-> (AnomalyGroupSummary -> AnomalyGroupSummary -> Bool)
-> Eq AnomalyGroupSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalyGroupSummary -> AnomalyGroupSummary -> Bool
$c/= :: AnomalyGroupSummary -> AnomalyGroupSummary -> Bool
== :: AnomalyGroupSummary -> AnomalyGroupSummary -> Bool
$c== :: AnomalyGroupSummary -> AnomalyGroupSummary -> Bool
Prelude.Eq, ReadPrec [AnomalyGroupSummary]
ReadPrec AnomalyGroupSummary
Int -> ReadS AnomalyGroupSummary
ReadS [AnomalyGroupSummary]
(Int -> ReadS AnomalyGroupSummary)
-> ReadS [AnomalyGroupSummary]
-> ReadPrec AnomalyGroupSummary
-> ReadPrec [AnomalyGroupSummary]
-> Read AnomalyGroupSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalyGroupSummary]
$creadListPrec :: ReadPrec [AnomalyGroupSummary]
readPrec :: ReadPrec AnomalyGroupSummary
$creadPrec :: ReadPrec AnomalyGroupSummary
readList :: ReadS [AnomalyGroupSummary]
$creadList :: ReadS [AnomalyGroupSummary]
readsPrec :: Int -> ReadS AnomalyGroupSummary
$creadsPrec :: Int -> ReadS AnomalyGroupSummary
Prelude.Read, Int -> AnomalyGroupSummary -> ShowS
[AnomalyGroupSummary] -> ShowS
AnomalyGroupSummary -> String
(Int -> AnomalyGroupSummary -> ShowS)
-> (AnomalyGroupSummary -> String)
-> ([AnomalyGroupSummary] -> ShowS)
-> Show AnomalyGroupSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalyGroupSummary] -> ShowS
$cshowList :: [AnomalyGroupSummary] -> ShowS
show :: AnomalyGroupSummary -> String
$cshow :: AnomalyGroupSummary -> String
showsPrec :: Int -> AnomalyGroupSummary -> ShowS
$cshowsPrec :: Int -> AnomalyGroupSummary -> ShowS
Prelude.Show, (forall x. AnomalyGroupSummary -> Rep AnomalyGroupSummary x)
-> (forall x. Rep AnomalyGroupSummary x -> AnomalyGroupSummary)
-> Generic AnomalyGroupSummary
forall x. Rep AnomalyGroupSummary x -> AnomalyGroupSummary
forall x. AnomalyGroupSummary -> Rep AnomalyGroupSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnomalyGroupSummary x -> AnomalyGroupSummary
$cfrom :: forall x. AnomalyGroupSummary -> Rep AnomalyGroupSummary x
Prelude.Generic)

-- |
-- Create a value of 'AnomalyGroupSummary' 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:
--
-- 'startTime', 'anomalyGroupSummary_startTime' - The start time for the group.
--
-- 'anomalyGroupId', 'anomalyGroupSummary_anomalyGroupId' - The ID of the anomaly group.
--
-- 'anomalyGroupScore', 'anomalyGroupSummary_anomalyGroupScore' - The severity score of the group.
--
-- 'primaryMetricName', 'anomalyGroupSummary_primaryMetricName' - The name of the primary affected measure for the group.
--
-- 'endTime', 'anomalyGroupSummary_endTime' - The end time for the group.
newAnomalyGroupSummary ::
  AnomalyGroupSummary
newAnomalyGroupSummary :: AnomalyGroupSummary
newAnomalyGroupSummary =
  AnomalyGroupSummary' :: Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Text
-> Maybe Text
-> AnomalyGroupSummary
AnomalyGroupSummary'
    { $sel:startTime:AnomalyGroupSummary' :: Maybe Text
startTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:anomalyGroupId:AnomalyGroupSummary' :: Maybe Text
anomalyGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:anomalyGroupScore:AnomalyGroupSummary' :: Maybe Double
anomalyGroupScore = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:primaryMetricName:AnomalyGroupSummary' :: Maybe Text
primaryMetricName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:AnomalyGroupSummary' :: Maybe Text
endTime = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The start time for the group.
anomalyGroupSummary_startTime :: Lens.Lens' AnomalyGroupSummary (Prelude.Maybe Prelude.Text)
anomalyGroupSummary_startTime :: (Maybe Text -> f (Maybe Text))
-> AnomalyGroupSummary -> f AnomalyGroupSummary
anomalyGroupSummary_startTime = (AnomalyGroupSummary -> Maybe Text)
-> (AnomalyGroupSummary -> Maybe Text -> AnomalyGroupSummary)
-> Lens
     AnomalyGroupSummary AnomalyGroupSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupSummary' {Maybe Text
startTime :: Maybe Text
$sel:startTime:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
startTime} -> Maybe Text
startTime) (\s :: AnomalyGroupSummary
s@AnomalyGroupSummary' {} Maybe Text
a -> AnomalyGroupSummary
s {$sel:startTime:AnomalyGroupSummary' :: Maybe Text
startTime = Maybe Text
a} :: AnomalyGroupSummary)

-- | The ID of the anomaly group.
anomalyGroupSummary_anomalyGroupId :: Lens.Lens' AnomalyGroupSummary (Prelude.Maybe Prelude.Text)
anomalyGroupSummary_anomalyGroupId :: (Maybe Text -> f (Maybe Text))
-> AnomalyGroupSummary -> f AnomalyGroupSummary
anomalyGroupSummary_anomalyGroupId = (AnomalyGroupSummary -> Maybe Text)
-> (AnomalyGroupSummary -> Maybe Text -> AnomalyGroupSummary)
-> Lens
     AnomalyGroupSummary AnomalyGroupSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupSummary' {Maybe Text
anomalyGroupId :: Maybe Text
$sel:anomalyGroupId:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
anomalyGroupId} -> Maybe Text
anomalyGroupId) (\s :: AnomalyGroupSummary
s@AnomalyGroupSummary' {} Maybe Text
a -> AnomalyGroupSummary
s {$sel:anomalyGroupId:AnomalyGroupSummary' :: Maybe Text
anomalyGroupId = Maybe Text
a} :: AnomalyGroupSummary)

-- | The severity score of the group.
anomalyGroupSummary_anomalyGroupScore :: Lens.Lens' AnomalyGroupSummary (Prelude.Maybe Prelude.Double)
anomalyGroupSummary_anomalyGroupScore :: (Maybe Double -> f (Maybe Double))
-> AnomalyGroupSummary -> f AnomalyGroupSummary
anomalyGroupSummary_anomalyGroupScore = (AnomalyGroupSummary -> Maybe Double)
-> (AnomalyGroupSummary -> Maybe Double -> AnomalyGroupSummary)
-> Lens
     AnomalyGroupSummary
     AnomalyGroupSummary
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupSummary' {Maybe Double
anomalyGroupScore :: Maybe Double
$sel:anomalyGroupScore:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Double
anomalyGroupScore} -> Maybe Double
anomalyGroupScore) (\s :: AnomalyGroupSummary
s@AnomalyGroupSummary' {} Maybe Double
a -> AnomalyGroupSummary
s {$sel:anomalyGroupScore:AnomalyGroupSummary' :: Maybe Double
anomalyGroupScore = Maybe Double
a} :: AnomalyGroupSummary)

-- | The name of the primary affected measure for the group.
anomalyGroupSummary_primaryMetricName :: Lens.Lens' AnomalyGroupSummary (Prelude.Maybe Prelude.Text)
anomalyGroupSummary_primaryMetricName :: (Maybe Text -> f (Maybe Text))
-> AnomalyGroupSummary -> f AnomalyGroupSummary
anomalyGroupSummary_primaryMetricName = (AnomalyGroupSummary -> Maybe Text)
-> (AnomalyGroupSummary -> Maybe Text -> AnomalyGroupSummary)
-> Lens
     AnomalyGroupSummary AnomalyGroupSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupSummary' {Maybe Text
primaryMetricName :: Maybe Text
$sel:primaryMetricName:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
primaryMetricName} -> Maybe Text
primaryMetricName) (\s :: AnomalyGroupSummary
s@AnomalyGroupSummary' {} Maybe Text
a -> AnomalyGroupSummary
s {$sel:primaryMetricName:AnomalyGroupSummary' :: Maybe Text
primaryMetricName = Maybe Text
a} :: AnomalyGroupSummary)

-- | The end time for the group.
anomalyGroupSummary_endTime :: Lens.Lens' AnomalyGroupSummary (Prelude.Maybe Prelude.Text)
anomalyGroupSummary_endTime :: (Maybe Text -> f (Maybe Text))
-> AnomalyGroupSummary -> f AnomalyGroupSummary
anomalyGroupSummary_endTime = (AnomalyGroupSummary -> Maybe Text)
-> (AnomalyGroupSummary -> Maybe Text -> AnomalyGroupSummary)
-> Lens
     AnomalyGroupSummary AnomalyGroupSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupSummary' {Maybe Text
endTime :: Maybe Text
$sel:endTime:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
endTime} -> Maybe Text
endTime) (\s :: AnomalyGroupSummary
s@AnomalyGroupSummary' {} Maybe Text
a -> AnomalyGroupSummary
s {$sel:endTime:AnomalyGroupSummary' :: Maybe Text
endTime = Maybe Text
a} :: AnomalyGroupSummary)

instance Core.FromJSON AnomalyGroupSummary where
  parseJSON :: Value -> Parser AnomalyGroupSummary
parseJSON =
    String
-> (Object -> Parser AnomalyGroupSummary)
-> Value
-> Parser AnomalyGroupSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AnomalyGroupSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Text
-> Maybe Text
-> AnomalyGroupSummary
AnomalyGroupSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe Double
 -> Maybe Text
 -> Maybe Text
 -> AnomalyGroupSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Double -> Maybe Text -> Maybe Text -> AnomalyGroupSummary)
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
"StartTime")
            Parser
  (Maybe Text
   -> Maybe Double -> Maybe Text -> Maybe Text -> AnomalyGroupSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Double -> Maybe Text -> Maybe Text -> AnomalyGroupSummary)
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
"AnomalyGroupId")
            Parser
  (Maybe Double -> Maybe Text -> Maybe Text -> AnomalyGroupSummary)
-> Parser (Maybe Double)
-> Parser (Maybe Text -> Maybe Text -> AnomalyGroupSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AnomalyGroupScore")
            Parser (Maybe Text -> Maybe Text -> AnomalyGroupSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AnomalyGroupSummary)
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
"PrimaryMetricName")
            Parser (Maybe Text -> AnomalyGroupSummary)
-> Parser (Maybe Text) -> Parser AnomalyGroupSummary
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
"EndTime")
      )

instance Prelude.Hashable AnomalyGroupSummary

instance Prelude.NFData AnomalyGroupSummary