{-# 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.XRay.Types.Insight
-- 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.XRay.Types.Insight where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.XRay.Types.AnomalousService
import Amazonka.XRay.Types.InsightCategory
import Amazonka.XRay.Types.InsightState
import Amazonka.XRay.Types.RequestImpactStatistics
import Amazonka.XRay.Types.ServiceId

-- | When fault rates go outside of the expected range, X-Ray creates an
-- insight. Insights tracks emergent issues within your applications.
--
-- /See:/ 'newInsight' smart constructor.
data Insight = Insight'
  { -- | A brief description of the insight.
    Insight -> Maybe Text
summary :: Prelude.Maybe Prelude.Text,
    -- | The current state of the insight.
    Insight -> Maybe InsightState
state :: Prelude.Maybe InsightState,
    -- | The time, in Unix seconds, at which the insight began.
    Insight -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The insights unique identifier.
    Insight -> Maybe Text
insightId :: Prelude.Maybe Prelude.Text,
    -- | The categories that label and describe the type of insight.
    Insight -> Maybe [InsightCategory]
categories :: Prelude.Maybe [InsightCategory],
    -- | The impact statistics of the root cause service. This includes the
    -- number of requests to the client service and whether the requests were
    -- faults or okay.
    Insight -> Maybe RequestImpactStatistics
rootCauseServiceRequestImpactStatistics :: Prelude.Maybe RequestImpactStatistics,
    -- | The service within the insight that is most impacted by the incident.
    Insight -> Maybe [AnomalousService]
topAnomalousServices :: Prelude.Maybe [AnomalousService],
    Insight -> Maybe ServiceId
rootCauseServiceId :: Prelude.Maybe ServiceId,
    -- | The impact statistics of the client side service. This includes the
    -- number of requests to the client service and whether the requests were
    -- faults or okay.
    Insight -> Maybe RequestImpactStatistics
clientRequestImpactStatistics :: Prelude.Maybe RequestImpactStatistics,
    -- | The time, in Unix seconds, at which the insight ended.
    Insight -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the group that the insight belongs to.
    Insight -> Maybe Text
groupARN :: Prelude.Maybe Prelude.Text,
    -- | The name of the group that the insight belongs to.
    Insight -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text
  }
  deriving (Insight -> Insight -> Bool
(Insight -> Insight -> Bool)
-> (Insight -> Insight -> Bool) -> Eq Insight
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Insight -> Insight -> Bool
$c/= :: Insight -> Insight -> Bool
== :: Insight -> Insight -> Bool
$c== :: Insight -> Insight -> Bool
Prelude.Eq, ReadPrec [Insight]
ReadPrec Insight
Int -> ReadS Insight
ReadS [Insight]
(Int -> ReadS Insight)
-> ReadS [Insight]
-> ReadPrec Insight
-> ReadPrec [Insight]
-> Read Insight
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Insight]
$creadListPrec :: ReadPrec [Insight]
readPrec :: ReadPrec Insight
$creadPrec :: ReadPrec Insight
readList :: ReadS [Insight]
$creadList :: ReadS [Insight]
readsPrec :: Int -> ReadS Insight
$creadsPrec :: Int -> ReadS Insight
Prelude.Read, Int -> Insight -> ShowS
[Insight] -> ShowS
Insight -> String
(Int -> Insight -> ShowS)
-> (Insight -> String) -> ([Insight] -> ShowS) -> Show Insight
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Insight] -> ShowS
$cshowList :: [Insight] -> ShowS
show :: Insight -> String
$cshow :: Insight -> String
showsPrec :: Int -> Insight -> ShowS
$cshowsPrec :: Int -> Insight -> ShowS
Prelude.Show, (forall x. Insight -> Rep Insight x)
-> (forall x. Rep Insight x -> Insight) -> Generic Insight
forall x. Rep Insight x -> Insight
forall x. Insight -> Rep Insight x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Insight x -> Insight
$cfrom :: forall x. Insight -> Rep Insight x
Prelude.Generic)

-- |
-- Create a value of 'Insight' 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:
--
-- 'summary', 'insight_summary' - A brief description of the insight.
--
-- 'state', 'insight_state' - The current state of the insight.
--
-- 'startTime', 'insight_startTime' - The time, in Unix seconds, at which the insight began.
--
-- 'insightId', 'insight_insightId' - The insights unique identifier.
--
-- 'categories', 'insight_categories' - The categories that label and describe the type of insight.
--
-- 'rootCauseServiceRequestImpactStatistics', 'insight_rootCauseServiceRequestImpactStatistics' - The impact statistics of the root cause service. This includes the
-- number of requests to the client service and whether the requests were
-- faults or okay.
--
-- 'topAnomalousServices', 'insight_topAnomalousServices' - The service within the insight that is most impacted by the incident.
--
-- 'rootCauseServiceId', 'insight_rootCauseServiceId' - Undocumented member.
--
-- 'clientRequestImpactStatistics', 'insight_clientRequestImpactStatistics' - The impact statistics of the client side service. This includes the
-- number of requests to the client service and whether the requests were
-- faults or okay.
--
-- 'endTime', 'insight_endTime' - The time, in Unix seconds, at which the insight ended.
--
-- 'groupARN', 'insight_groupARN' - The Amazon Resource Name (ARN) of the group that the insight belongs to.
--
-- 'groupName', 'insight_groupName' - The name of the group that the insight belongs to.
newInsight ::
  Insight
newInsight :: Insight
newInsight =
  Insight' :: Maybe Text
-> Maybe InsightState
-> Maybe POSIX
-> Maybe Text
-> Maybe [InsightCategory]
-> Maybe RequestImpactStatistics
-> Maybe [AnomalousService]
-> Maybe ServiceId
-> Maybe RequestImpactStatistics
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Insight
Insight'
    { $sel:summary:Insight' :: Maybe Text
summary = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:state:Insight' :: Maybe InsightState
state = Maybe InsightState
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:Insight' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:insightId:Insight' :: Maybe Text
insightId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:categories:Insight' :: Maybe [InsightCategory]
categories = Maybe [InsightCategory]
forall a. Maybe a
Prelude.Nothing,
      $sel:rootCauseServiceRequestImpactStatistics:Insight' :: Maybe RequestImpactStatistics
rootCauseServiceRequestImpactStatistics =
        Maybe RequestImpactStatistics
forall a. Maybe a
Prelude.Nothing,
      $sel:topAnomalousServices:Insight' :: Maybe [AnomalousService]
topAnomalousServices = Maybe [AnomalousService]
forall a. Maybe a
Prelude.Nothing,
      $sel:rootCauseServiceId:Insight' :: Maybe ServiceId
rootCauseServiceId = Maybe ServiceId
forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestImpactStatistics:Insight' :: Maybe RequestImpactStatistics
clientRequestImpactStatistics = Maybe RequestImpactStatistics
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:Insight' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:groupARN:Insight' :: Maybe Text
groupARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:Insight' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A brief description of the insight.
insight_summary :: Lens.Lens' Insight (Prelude.Maybe Prelude.Text)
insight_summary :: (Maybe Text -> f (Maybe Text)) -> Insight -> f Insight
insight_summary = (Insight -> Maybe Text)
-> (Insight -> Maybe Text -> Insight)
-> Lens Insight Insight (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe Text
summary :: Maybe Text
$sel:summary:Insight' :: Insight -> Maybe Text
summary} -> Maybe Text
summary) (\s :: Insight
s@Insight' {} Maybe Text
a -> Insight
s {$sel:summary:Insight' :: Maybe Text
summary = Maybe Text
a} :: Insight)

-- | The current state of the insight.
insight_state :: Lens.Lens' Insight (Prelude.Maybe InsightState)
insight_state :: (Maybe InsightState -> f (Maybe InsightState))
-> Insight -> f Insight
insight_state = (Insight -> Maybe InsightState)
-> (Insight -> Maybe InsightState -> Insight)
-> Lens Insight Insight (Maybe InsightState) (Maybe InsightState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe InsightState
state :: Maybe InsightState
$sel:state:Insight' :: Insight -> Maybe InsightState
state} -> Maybe InsightState
state) (\s :: Insight
s@Insight' {} Maybe InsightState
a -> Insight
s {$sel:state:Insight' :: Maybe InsightState
state = Maybe InsightState
a} :: Insight)

-- | The time, in Unix seconds, at which the insight began.
insight_startTime :: Lens.Lens' Insight (Prelude.Maybe Prelude.UTCTime)
insight_startTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Insight -> f Insight
insight_startTime = (Insight -> Maybe POSIX)
-> (Insight -> Maybe POSIX -> Insight)
-> Lens Insight Insight (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:Insight' :: Insight -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: Insight
s@Insight' {} Maybe POSIX
a -> Insight
s {$sel:startTime:Insight' :: Maybe POSIX
startTime = Maybe POSIX
a} :: Insight) ((Maybe POSIX -> f (Maybe POSIX)) -> Insight -> f Insight)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Insight
-> f Insight
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The insights unique identifier.
insight_insightId :: Lens.Lens' Insight (Prelude.Maybe Prelude.Text)
insight_insightId :: (Maybe Text -> f (Maybe Text)) -> Insight -> f Insight
insight_insightId = (Insight -> Maybe Text)
-> (Insight -> Maybe Text -> Insight)
-> Lens Insight Insight (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe Text
insightId :: Maybe Text
$sel:insightId:Insight' :: Insight -> Maybe Text
insightId} -> Maybe Text
insightId) (\s :: Insight
s@Insight' {} Maybe Text
a -> Insight
s {$sel:insightId:Insight' :: Maybe Text
insightId = Maybe Text
a} :: Insight)

-- | The categories that label and describe the type of insight.
insight_categories :: Lens.Lens' Insight (Prelude.Maybe [InsightCategory])
insight_categories :: (Maybe [InsightCategory] -> f (Maybe [InsightCategory]))
-> Insight -> f Insight
insight_categories = (Insight -> Maybe [InsightCategory])
-> (Insight -> Maybe [InsightCategory] -> Insight)
-> Lens
     Insight Insight (Maybe [InsightCategory]) (Maybe [InsightCategory])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe [InsightCategory]
categories :: Maybe [InsightCategory]
$sel:categories:Insight' :: Insight -> Maybe [InsightCategory]
categories} -> Maybe [InsightCategory]
categories) (\s :: Insight
s@Insight' {} Maybe [InsightCategory]
a -> Insight
s {$sel:categories:Insight' :: Maybe [InsightCategory]
categories = Maybe [InsightCategory]
a} :: Insight) ((Maybe [InsightCategory] -> f (Maybe [InsightCategory]))
 -> Insight -> f Insight)
-> ((Maybe [InsightCategory] -> f (Maybe [InsightCategory]))
    -> Maybe [InsightCategory] -> f (Maybe [InsightCategory]))
-> (Maybe [InsightCategory] -> f (Maybe [InsightCategory]))
-> Insight
-> f Insight
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InsightCategory]
  [InsightCategory]
  [InsightCategory]
  [InsightCategory]
-> Iso
     (Maybe [InsightCategory])
     (Maybe [InsightCategory])
     (Maybe [InsightCategory])
     (Maybe [InsightCategory])
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 AnIso
  [InsightCategory]
  [InsightCategory]
  [InsightCategory]
  [InsightCategory]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The impact statistics of the root cause service. This includes the
-- number of requests to the client service and whether the requests were
-- faults or okay.
insight_rootCauseServiceRequestImpactStatistics :: Lens.Lens' Insight (Prelude.Maybe RequestImpactStatistics)
insight_rootCauseServiceRequestImpactStatistics :: (Maybe RequestImpactStatistics
 -> f (Maybe RequestImpactStatistics))
-> Insight -> f Insight
insight_rootCauseServiceRequestImpactStatistics = (Insight -> Maybe RequestImpactStatistics)
-> (Insight -> Maybe RequestImpactStatistics -> Insight)
-> Lens
     Insight
     Insight
     (Maybe RequestImpactStatistics)
     (Maybe RequestImpactStatistics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe RequestImpactStatistics
rootCauseServiceRequestImpactStatistics :: Maybe RequestImpactStatistics
$sel:rootCauseServiceRequestImpactStatistics:Insight' :: Insight -> Maybe RequestImpactStatistics
rootCauseServiceRequestImpactStatistics} -> Maybe RequestImpactStatistics
rootCauseServiceRequestImpactStatistics) (\s :: Insight
s@Insight' {} Maybe RequestImpactStatistics
a -> Insight
s {$sel:rootCauseServiceRequestImpactStatistics:Insight' :: Maybe RequestImpactStatistics
rootCauseServiceRequestImpactStatistics = Maybe RequestImpactStatistics
a} :: Insight)

-- | The service within the insight that is most impacted by the incident.
insight_topAnomalousServices :: Lens.Lens' Insight (Prelude.Maybe [AnomalousService])
insight_topAnomalousServices :: (Maybe [AnomalousService] -> f (Maybe [AnomalousService]))
-> Insight -> f Insight
insight_topAnomalousServices = (Insight -> Maybe [AnomalousService])
-> (Insight -> Maybe [AnomalousService] -> Insight)
-> Lens
     Insight
     Insight
     (Maybe [AnomalousService])
     (Maybe [AnomalousService])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe [AnomalousService]
topAnomalousServices :: Maybe [AnomalousService]
$sel:topAnomalousServices:Insight' :: Insight -> Maybe [AnomalousService]
topAnomalousServices} -> Maybe [AnomalousService]
topAnomalousServices) (\s :: Insight
s@Insight' {} Maybe [AnomalousService]
a -> Insight
s {$sel:topAnomalousServices:Insight' :: Maybe [AnomalousService]
topAnomalousServices = Maybe [AnomalousService]
a} :: Insight) ((Maybe [AnomalousService] -> f (Maybe [AnomalousService]))
 -> Insight -> f Insight)
-> ((Maybe [AnomalousService] -> f (Maybe [AnomalousService]))
    -> Maybe [AnomalousService] -> f (Maybe [AnomalousService]))
-> (Maybe [AnomalousService] -> f (Maybe [AnomalousService]))
-> Insight
-> f Insight
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AnomalousService]
  [AnomalousService]
  [AnomalousService]
  [AnomalousService]
-> Iso
     (Maybe [AnomalousService])
     (Maybe [AnomalousService])
     (Maybe [AnomalousService])
     (Maybe [AnomalousService])
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 AnIso
  [AnomalousService]
  [AnomalousService]
  [AnomalousService]
  [AnomalousService]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
insight_rootCauseServiceId :: Lens.Lens' Insight (Prelude.Maybe ServiceId)
insight_rootCauseServiceId :: (Maybe ServiceId -> f (Maybe ServiceId)) -> Insight -> f Insight
insight_rootCauseServiceId = (Insight -> Maybe ServiceId)
-> (Insight -> Maybe ServiceId -> Insight)
-> Lens Insight Insight (Maybe ServiceId) (Maybe ServiceId)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe ServiceId
rootCauseServiceId :: Maybe ServiceId
$sel:rootCauseServiceId:Insight' :: Insight -> Maybe ServiceId
rootCauseServiceId} -> Maybe ServiceId
rootCauseServiceId) (\s :: Insight
s@Insight' {} Maybe ServiceId
a -> Insight
s {$sel:rootCauseServiceId:Insight' :: Maybe ServiceId
rootCauseServiceId = Maybe ServiceId
a} :: Insight)

-- | The impact statistics of the client side service. This includes the
-- number of requests to the client service and whether the requests were
-- faults or okay.
insight_clientRequestImpactStatistics :: Lens.Lens' Insight (Prelude.Maybe RequestImpactStatistics)
insight_clientRequestImpactStatistics :: (Maybe RequestImpactStatistics
 -> f (Maybe RequestImpactStatistics))
-> Insight -> f Insight
insight_clientRequestImpactStatistics = (Insight -> Maybe RequestImpactStatistics)
-> (Insight -> Maybe RequestImpactStatistics -> Insight)
-> Lens
     Insight
     Insight
     (Maybe RequestImpactStatistics)
     (Maybe RequestImpactStatistics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe RequestImpactStatistics
clientRequestImpactStatistics :: Maybe RequestImpactStatistics
$sel:clientRequestImpactStatistics:Insight' :: Insight -> Maybe RequestImpactStatistics
clientRequestImpactStatistics} -> Maybe RequestImpactStatistics
clientRequestImpactStatistics) (\s :: Insight
s@Insight' {} Maybe RequestImpactStatistics
a -> Insight
s {$sel:clientRequestImpactStatistics:Insight' :: Maybe RequestImpactStatistics
clientRequestImpactStatistics = Maybe RequestImpactStatistics
a} :: Insight)

-- | The time, in Unix seconds, at which the insight ended.
insight_endTime :: Lens.Lens' Insight (Prelude.Maybe Prelude.UTCTime)
insight_endTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Insight -> f Insight
insight_endTime = (Insight -> Maybe POSIX)
-> (Insight -> Maybe POSIX -> Insight)
-> Lens Insight Insight (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:Insight' :: Insight -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: Insight
s@Insight' {} Maybe POSIX
a -> Insight
s {$sel:endTime:Insight' :: Maybe POSIX
endTime = Maybe POSIX
a} :: Insight) ((Maybe POSIX -> f (Maybe POSIX)) -> Insight -> f Insight)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Insight
-> f Insight
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Resource Name (ARN) of the group that the insight belongs to.
insight_groupARN :: Lens.Lens' Insight (Prelude.Maybe Prelude.Text)
insight_groupARN :: (Maybe Text -> f (Maybe Text)) -> Insight -> f Insight
insight_groupARN = (Insight -> Maybe Text)
-> (Insight -> Maybe Text -> Insight)
-> Lens Insight Insight (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe Text
groupARN :: Maybe Text
$sel:groupARN:Insight' :: Insight -> Maybe Text
groupARN} -> Maybe Text
groupARN) (\s :: Insight
s@Insight' {} Maybe Text
a -> Insight
s {$sel:groupARN:Insight' :: Maybe Text
groupARN = Maybe Text
a} :: Insight)

-- | The name of the group that the insight belongs to.
insight_groupName :: Lens.Lens' Insight (Prelude.Maybe Prelude.Text)
insight_groupName :: (Maybe Text -> f (Maybe Text)) -> Insight -> f Insight
insight_groupName = (Insight -> Maybe Text)
-> (Insight -> Maybe Text -> Insight)
-> Lens Insight Insight (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Insight' {Maybe Text
groupName :: Maybe Text
$sel:groupName:Insight' :: Insight -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: Insight
s@Insight' {} Maybe Text
a -> Insight
s {$sel:groupName:Insight' :: Maybe Text
groupName = Maybe Text
a} :: Insight)

instance Core.FromJSON Insight where
  parseJSON :: Value -> Parser Insight
parseJSON =
    String -> (Object -> Parser Insight) -> Value -> Parser Insight
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Insight"
      ( \Object
x ->
          Maybe Text
-> Maybe InsightState
-> Maybe POSIX
-> Maybe Text
-> Maybe [InsightCategory]
-> Maybe RequestImpactStatistics
-> Maybe [AnomalousService]
-> Maybe ServiceId
-> Maybe RequestImpactStatistics
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Insight
Insight'
            (Maybe Text
 -> Maybe InsightState
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe [InsightCategory]
 -> Maybe RequestImpactStatistics
 -> Maybe [AnomalousService]
 -> Maybe ServiceId
 -> Maybe RequestImpactStatistics
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Insight)
-> Parser (Maybe Text)
-> Parser
     (Maybe InsightState
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [InsightCategory]
      -> Maybe RequestImpactStatistics
      -> Maybe [AnomalousService]
      -> Maybe ServiceId
      -> Maybe RequestImpactStatistics
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Insight)
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
"Summary")
            Parser
  (Maybe InsightState
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [InsightCategory]
   -> Maybe RequestImpactStatistics
   -> Maybe [AnomalousService]
   -> Maybe ServiceId
   -> Maybe RequestImpactStatistics
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Insight)
-> Parser (Maybe InsightState)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe [InsightCategory]
      -> Maybe RequestImpactStatistics
      -> Maybe [AnomalousService]
      -> Maybe ServiceId
      -> Maybe RequestImpactStatistics
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Insight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InsightState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe [InsightCategory]
   -> Maybe RequestImpactStatistics
   -> Maybe [AnomalousService]
   -> Maybe ServiceId
   -> Maybe RequestImpactStatistics
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Insight)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe [InsightCategory]
      -> Maybe RequestImpactStatistics
      -> Maybe [AnomalousService]
      -> Maybe ServiceId
      -> Maybe RequestImpactStatistics
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Insight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTime")
            Parser
  (Maybe Text
   -> Maybe [InsightCategory]
   -> Maybe RequestImpactStatistics
   -> Maybe [AnomalousService]
   -> Maybe ServiceId
   -> Maybe RequestImpactStatistics
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Insight)
-> Parser (Maybe Text)
-> Parser
     (Maybe [InsightCategory]
      -> Maybe RequestImpactStatistics
      -> Maybe [AnomalousService]
      -> Maybe ServiceId
      -> Maybe RequestImpactStatistics
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Insight)
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
"InsightId")
            Parser
  (Maybe [InsightCategory]
   -> Maybe RequestImpactStatistics
   -> Maybe [AnomalousService]
   -> Maybe ServiceId
   -> Maybe RequestImpactStatistics
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Insight)
-> Parser (Maybe [InsightCategory])
-> Parser
     (Maybe RequestImpactStatistics
      -> Maybe [AnomalousService]
      -> Maybe ServiceId
      -> Maybe RequestImpactStatistics
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Insight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [InsightCategory]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Categories" Parser (Maybe (Maybe [InsightCategory]))
-> Maybe [InsightCategory] -> Parser (Maybe [InsightCategory])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [InsightCategory]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe RequestImpactStatistics
   -> Maybe [AnomalousService]
   -> Maybe ServiceId
   -> Maybe RequestImpactStatistics
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Insight)
-> Parser (Maybe RequestImpactStatistics)
-> Parser
     (Maybe [AnomalousService]
      -> Maybe ServiceId
      -> Maybe RequestImpactStatistics
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Insight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            Object -> Text -> Parser (Maybe RequestImpactStatistics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RootCauseServiceRequestImpactStatistics"
                        )
            Parser
  (Maybe [AnomalousService]
   -> Maybe ServiceId
   -> Maybe RequestImpactStatistics
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Insight)
-> Parser (Maybe [AnomalousService])
-> Parser
     (Maybe ServiceId
      -> Maybe RequestImpactStatistics
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Insight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AnomalousService]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TopAnomalousServices"
                            Parser (Maybe (Maybe [AnomalousService]))
-> Maybe [AnomalousService] -> Parser (Maybe [AnomalousService])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AnomalousService]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe ServiceId
   -> Maybe RequestImpactStatistics
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Insight)
-> Parser (Maybe ServiceId)
-> Parser
     (Maybe RequestImpactStatistics
      -> Maybe POSIX -> Maybe Text -> Maybe Text -> Insight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ServiceId)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RootCauseServiceId")
            Parser
  (Maybe RequestImpactStatistics
   -> Maybe POSIX -> Maybe Text -> Maybe Text -> Insight)
-> Parser (Maybe RequestImpactStatistics)
-> Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> Insight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RequestImpactStatistics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ClientRequestImpactStatistics")
            Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> Insight)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> Insight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndTime")
            Parser (Maybe Text -> Maybe Text -> Insight)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Insight)
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
"GroupARN")
            Parser (Maybe Text -> Insight)
-> Parser (Maybe Text) -> Parser Insight
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
"GroupName")
      )

instance Prelude.Hashable Insight

instance Prelude.NFData Insight