{-# 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.ProactiveInsight
-- 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.ProactiveInsight where

import qualified Amazonka.Core as Core
import Amazonka.DevOpsGuru.Types.InsightSeverity
import Amazonka.DevOpsGuru.Types.InsightStatus
import Amazonka.DevOpsGuru.Types.InsightTimeRange
import Amazonka.DevOpsGuru.Types.PredictionTimeRange
import Amazonka.DevOpsGuru.Types.ResourceCollection
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details about a proactive insight. This object is returned by
-- @ListInsights@.
--
-- /See:/ 'newProactiveInsight' smart constructor.
data ProactiveInsight = ProactiveInsight'
  { -- | The status of the proactive insight.
    ProactiveInsight -> Maybe InsightStatus
status :: Prelude.Maybe InsightStatus,
    ProactiveInsight -> Maybe ResourceCollection
resourceCollection :: Prelude.Maybe ResourceCollection,
    -- | The severity of the proactive insight.
    ProactiveInsight -> Maybe InsightSeverity
severity :: Prelude.Maybe InsightSeverity,
    -- | The ID of the AWS System Manager OpsItem created for this insight. You
    -- must enable the creation of OpstItems insights before they are created
    -- for each insight.
    ProactiveInsight -> Maybe Text
ssmOpsItemId :: Prelude.Maybe Prelude.Text,
    ProactiveInsight -> Maybe InsightTimeRange
insightTimeRange :: Prelude.Maybe InsightTimeRange,
    -- | The name of the proactive insight.
    ProactiveInsight -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    ProactiveInsight -> Maybe PredictionTimeRange
predictionTimeRange :: Prelude.Maybe PredictionTimeRange,
    -- | The ID of the proactive insight.
    ProactiveInsight -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (ProactiveInsight -> ProactiveInsight -> Bool
(ProactiveInsight -> ProactiveInsight -> Bool)
-> (ProactiveInsight -> ProactiveInsight -> Bool)
-> Eq ProactiveInsight
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProactiveInsight -> ProactiveInsight -> Bool
$c/= :: ProactiveInsight -> ProactiveInsight -> Bool
== :: ProactiveInsight -> ProactiveInsight -> Bool
$c== :: ProactiveInsight -> ProactiveInsight -> Bool
Prelude.Eq, ReadPrec [ProactiveInsight]
ReadPrec ProactiveInsight
Int -> ReadS ProactiveInsight
ReadS [ProactiveInsight]
(Int -> ReadS ProactiveInsight)
-> ReadS [ProactiveInsight]
-> ReadPrec ProactiveInsight
-> ReadPrec [ProactiveInsight]
-> Read ProactiveInsight
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProactiveInsight]
$creadListPrec :: ReadPrec [ProactiveInsight]
readPrec :: ReadPrec ProactiveInsight
$creadPrec :: ReadPrec ProactiveInsight
readList :: ReadS [ProactiveInsight]
$creadList :: ReadS [ProactiveInsight]
readsPrec :: Int -> ReadS ProactiveInsight
$creadsPrec :: Int -> ReadS ProactiveInsight
Prelude.Read, Int -> ProactiveInsight -> ShowS
[ProactiveInsight] -> ShowS
ProactiveInsight -> String
(Int -> ProactiveInsight -> ShowS)
-> (ProactiveInsight -> String)
-> ([ProactiveInsight] -> ShowS)
-> Show ProactiveInsight
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProactiveInsight] -> ShowS
$cshowList :: [ProactiveInsight] -> ShowS
show :: ProactiveInsight -> String
$cshow :: ProactiveInsight -> String
showsPrec :: Int -> ProactiveInsight -> ShowS
$cshowsPrec :: Int -> ProactiveInsight -> ShowS
Prelude.Show, (forall x. ProactiveInsight -> Rep ProactiveInsight x)
-> (forall x. Rep ProactiveInsight x -> ProactiveInsight)
-> Generic ProactiveInsight
forall x. Rep ProactiveInsight x -> ProactiveInsight
forall x. ProactiveInsight -> Rep ProactiveInsight x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProactiveInsight x -> ProactiveInsight
$cfrom :: forall x. ProactiveInsight -> Rep ProactiveInsight x
Prelude.Generic)

-- |
-- Create a value of 'ProactiveInsight' 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:
--
-- 'status', 'proactiveInsight_status' - The status of the proactive insight.
--
-- 'resourceCollection', 'proactiveInsight_resourceCollection' - Undocumented member.
--
-- 'severity', 'proactiveInsight_severity' - The severity of the proactive insight.
--
-- 'ssmOpsItemId', 'proactiveInsight_ssmOpsItemId' - The ID of the AWS System Manager OpsItem created for this insight. You
-- must enable the creation of OpstItems insights before they are created
-- for each insight.
--
-- 'insightTimeRange', 'proactiveInsight_insightTimeRange' - Undocumented member.
--
-- 'name', 'proactiveInsight_name' - The name of the proactive insight.
--
-- 'predictionTimeRange', 'proactiveInsight_predictionTimeRange' - Undocumented member.
--
-- 'id', 'proactiveInsight_id' - The ID of the proactive insight.
newProactiveInsight ::
  ProactiveInsight
newProactiveInsight :: ProactiveInsight
newProactiveInsight =
  ProactiveInsight' :: Maybe InsightStatus
-> Maybe ResourceCollection
-> Maybe InsightSeverity
-> Maybe Text
-> Maybe InsightTimeRange
-> Maybe Text
-> Maybe PredictionTimeRange
-> Maybe Text
-> ProactiveInsight
ProactiveInsight'
    { $sel:status:ProactiveInsight' :: Maybe InsightStatus
status = Maybe InsightStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceCollection:ProactiveInsight' :: Maybe ResourceCollection
resourceCollection = Maybe ResourceCollection
forall a. Maybe a
Prelude.Nothing,
      $sel:severity:ProactiveInsight' :: Maybe InsightSeverity
severity = Maybe InsightSeverity
forall a. Maybe a
Prelude.Nothing,
      $sel:ssmOpsItemId:ProactiveInsight' :: Maybe Text
ssmOpsItemId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:insightTimeRange:ProactiveInsight' :: Maybe InsightTimeRange
insightTimeRange = Maybe InsightTimeRange
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ProactiveInsight' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:predictionTimeRange:ProactiveInsight' :: Maybe PredictionTimeRange
predictionTimeRange = Maybe PredictionTimeRange
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ProactiveInsight' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the proactive insight.
proactiveInsight_status :: Lens.Lens' ProactiveInsight (Prelude.Maybe InsightStatus)
proactiveInsight_status :: (Maybe InsightStatus -> f (Maybe InsightStatus))
-> ProactiveInsight -> f ProactiveInsight
proactiveInsight_status = (ProactiveInsight -> Maybe InsightStatus)
-> (ProactiveInsight -> Maybe InsightStatus -> ProactiveInsight)
-> Lens
     ProactiveInsight
     ProactiveInsight
     (Maybe InsightStatus)
     (Maybe InsightStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProactiveInsight' {Maybe InsightStatus
status :: Maybe InsightStatus
$sel:status:ProactiveInsight' :: ProactiveInsight -> Maybe InsightStatus
status} -> Maybe InsightStatus
status) (\s :: ProactiveInsight
s@ProactiveInsight' {} Maybe InsightStatus
a -> ProactiveInsight
s {$sel:status:ProactiveInsight' :: Maybe InsightStatus
status = Maybe InsightStatus
a} :: ProactiveInsight)

-- | Undocumented member.
proactiveInsight_resourceCollection :: Lens.Lens' ProactiveInsight (Prelude.Maybe ResourceCollection)
proactiveInsight_resourceCollection :: (Maybe ResourceCollection -> f (Maybe ResourceCollection))
-> ProactiveInsight -> f ProactiveInsight
proactiveInsight_resourceCollection = (ProactiveInsight -> Maybe ResourceCollection)
-> (ProactiveInsight
    -> Maybe ResourceCollection -> ProactiveInsight)
-> Lens
     ProactiveInsight
     ProactiveInsight
     (Maybe ResourceCollection)
     (Maybe ResourceCollection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProactiveInsight' {Maybe ResourceCollection
resourceCollection :: Maybe ResourceCollection
$sel:resourceCollection:ProactiveInsight' :: ProactiveInsight -> Maybe ResourceCollection
resourceCollection} -> Maybe ResourceCollection
resourceCollection) (\s :: ProactiveInsight
s@ProactiveInsight' {} Maybe ResourceCollection
a -> ProactiveInsight
s {$sel:resourceCollection:ProactiveInsight' :: Maybe ResourceCollection
resourceCollection = Maybe ResourceCollection
a} :: ProactiveInsight)

-- | The severity of the proactive insight.
proactiveInsight_severity :: Lens.Lens' ProactiveInsight (Prelude.Maybe InsightSeverity)
proactiveInsight_severity :: (Maybe InsightSeverity -> f (Maybe InsightSeverity))
-> ProactiveInsight -> f ProactiveInsight
proactiveInsight_severity = (ProactiveInsight -> Maybe InsightSeverity)
-> (ProactiveInsight -> Maybe InsightSeverity -> ProactiveInsight)
-> Lens
     ProactiveInsight
     ProactiveInsight
     (Maybe InsightSeverity)
     (Maybe InsightSeverity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProactiveInsight' {Maybe InsightSeverity
severity :: Maybe InsightSeverity
$sel:severity:ProactiveInsight' :: ProactiveInsight -> Maybe InsightSeverity
severity} -> Maybe InsightSeverity
severity) (\s :: ProactiveInsight
s@ProactiveInsight' {} Maybe InsightSeverity
a -> ProactiveInsight
s {$sel:severity:ProactiveInsight' :: Maybe InsightSeverity
severity = Maybe InsightSeverity
a} :: ProactiveInsight)

-- | The ID of the AWS System Manager OpsItem created for this insight. You
-- must enable the creation of OpstItems insights before they are created
-- for each insight.
proactiveInsight_ssmOpsItemId :: Lens.Lens' ProactiveInsight (Prelude.Maybe Prelude.Text)
proactiveInsight_ssmOpsItemId :: (Maybe Text -> f (Maybe Text))
-> ProactiveInsight -> f ProactiveInsight
proactiveInsight_ssmOpsItemId = (ProactiveInsight -> Maybe Text)
-> (ProactiveInsight -> Maybe Text -> ProactiveInsight)
-> Lens ProactiveInsight ProactiveInsight (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProactiveInsight' {Maybe Text
ssmOpsItemId :: Maybe Text
$sel:ssmOpsItemId:ProactiveInsight' :: ProactiveInsight -> Maybe Text
ssmOpsItemId} -> Maybe Text
ssmOpsItemId) (\s :: ProactiveInsight
s@ProactiveInsight' {} Maybe Text
a -> ProactiveInsight
s {$sel:ssmOpsItemId:ProactiveInsight' :: Maybe Text
ssmOpsItemId = Maybe Text
a} :: ProactiveInsight)

-- | Undocumented member.
proactiveInsight_insightTimeRange :: Lens.Lens' ProactiveInsight (Prelude.Maybe InsightTimeRange)
proactiveInsight_insightTimeRange :: (Maybe InsightTimeRange -> f (Maybe InsightTimeRange))
-> ProactiveInsight -> f ProactiveInsight
proactiveInsight_insightTimeRange = (ProactiveInsight -> Maybe InsightTimeRange)
-> (ProactiveInsight -> Maybe InsightTimeRange -> ProactiveInsight)
-> Lens
     ProactiveInsight
     ProactiveInsight
     (Maybe InsightTimeRange)
     (Maybe InsightTimeRange)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProactiveInsight' {Maybe InsightTimeRange
insightTimeRange :: Maybe InsightTimeRange
$sel:insightTimeRange:ProactiveInsight' :: ProactiveInsight -> Maybe InsightTimeRange
insightTimeRange} -> Maybe InsightTimeRange
insightTimeRange) (\s :: ProactiveInsight
s@ProactiveInsight' {} Maybe InsightTimeRange
a -> ProactiveInsight
s {$sel:insightTimeRange:ProactiveInsight' :: Maybe InsightTimeRange
insightTimeRange = Maybe InsightTimeRange
a} :: ProactiveInsight)

-- | The name of the proactive insight.
proactiveInsight_name :: Lens.Lens' ProactiveInsight (Prelude.Maybe Prelude.Text)
proactiveInsight_name :: (Maybe Text -> f (Maybe Text))
-> ProactiveInsight -> f ProactiveInsight
proactiveInsight_name = (ProactiveInsight -> Maybe Text)
-> (ProactiveInsight -> Maybe Text -> ProactiveInsight)
-> Lens ProactiveInsight ProactiveInsight (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProactiveInsight' {Maybe Text
name :: Maybe Text
$sel:name:ProactiveInsight' :: ProactiveInsight -> Maybe Text
name} -> Maybe Text
name) (\s :: ProactiveInsight
s@ProactiveInsight' {} Maybe Text
a -> ProactiveInsight
s {$sel:name:ProactiveInsight' :: Maybe Text
name = Maybe Text
a} :: ProactiveInsight)

-- | Undocumented member.
proactiveInsight_predictionTimeRange :: Lens.Lens' ProactiveInsight (Prelude.Maybe PredictionTimeRange)
proactiveInsight_predictionTimeRange :: (Maybe PredictionTimeRange -> f (Maybe PredictionTimeRange))
-> ProactiveInsight -> f ProactiveInsight
proactiveInsight_predictionTimeRange = (ProactiveInsight -> Maybe PredictionTimeRange)
-> (ProactiveInsight
    -> Maybe PredictionTimeRange -> ProactiveInsight)
-> Lens
     ProactiveInsight
     ProactiveInsight
     (Maybe PredictionTimeRange)
     (Maybe PredictionTimeRange)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProactiveInsight' {Maybe PredictionTimeRange
predictionTimeRange :: Maybe PredictionTimeRange
$sel:predictionTimeRange:ProactiveInsight' :: ProactiveInsight -> Maybe PredictionTimeRange
predictionTimeRange} -> Maybe PredictionTimeRange
predictionTimeRange) (\s :: ProactiveInsight
s@ProactiveInsight' {} Maybe PredictionTimeRange
a -> ProactiveInsight
s {$sel:predictionTimeRange:ProactiveInsight' :: Maybe PredictionTimeRange
predictionTimeRange = Maybe PredictionTimeRange
a} :: ProactiveInsight)

-- | The ID of the proactive insight.
proactiveInsight_id :: Lens.Lens' ProactiveInsight (Prelude.Maybe Prelude.Text)
proactiveInsight_id :: (Maybe Text -> f (Maybe Text))
-> ProactiveInsight -> f ProactiveInsight
proactiveInsight_id = (ProactiveInsight -> Maybe Text)
-> (ProactiveInsight -> Maybe Text -> ProactiveInsight)
-> Lens ProactiveInsight ProactiveInsight (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProactiveInsight' {Maybe Text
id :: Maybe Text
$sel:id:ProactiveInsight' :: ProactiveInsight -> Maybe Text
id} -> Maybe Text
id) (\s :: ProactiveInsight
s@ProactiveInsight' {} Maybe Text
a -> ProactiveInsight
s {$sel:id:ProactiveInsight' :: Maybe Text
id = Maybe Text
a} :: ProactiveInsight)

instance Core.FromJSON ProactiveInsight where
  parseJSON :: Value -> Parser ProactiveInsight
parseJSON =
    String
-> (Object -> Parser ProactiveInsight)
-> Value
-> Parser ProactiveInsight
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProactiveInsight"
      ( \Object
x ->
          Maybe InsightStatus
-> Maybe ResourceCollection
-> Maybe InsightSeverity
-> Maybe Text
-> Maybe InsightTimeRange
-> Maybe Text
-> Maybe PredictionTimeRange
-> Maybe Text
-> ProactiveInsight
ProactiveInsight'
            (Maybe InsightStatus
 -> Maybe ResourceCollection
 -> Maybe InsightSeverity
 -> Maybe Text
 -> Maybe InsightTimeRange
 -> Maybe Text
 -> Maybe PredictionTimeRange
 -> Maybe Text
 -> ProactiveInsight)
-> Parser (Maybe InsightStatus)
-> Parser
     (Maybe ResourceCollection
      -> Maybe InsightSeverity
      -> Maybe Text
      -> Maybe InsightTimeRange
      -> Maybe Text
      -> Maybe PredictionTimeRange
      -> Maybe Text
      -> ProactiveInsight)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe InsightStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe ResourceCollection
   -> Maybe InsightSeverity
   -> Maybe Text
   -> Maybe InsightTimeRange
   -> Maybe Text
   -> Maybe PredictionTimeRange
   -> Maybe Text
   -> ProactiveInsight)
-> Parser (Maybe ResourceCollection)
-> Parser
     (Maybe InsightSeverity
      -> Maybe Text
      -> Maybe InsightTimeRange
      -> Maybe Text
      -> Maybe PredictionTimeRange
      -> Maybe Text
      -> ProactiveInsight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceCollection)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceCollection")
            Parser
  (Maybe InsightSeverity
   -> Maybe Text
   -> Maybe InsightTimeRange
   -> Maybe Text
   -> Maybe PredictionTimeRange
   -> Maybe Text
   -> ProactiveInsight)
-> Parser (Maybe InsightSeverity)
-> Parser
     (Maybe Text
      -> Maybe InsightTimeRange
      -> Maybe Text
      -> Maybe PredictionTimeRange
      -> Maybe Text
      -> ProactiveInsight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InsightSeverity)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Severity")
            Parser
  (Maybe Text
   -> Maybe InsightTimeRange
   -> Maybe Text
   -> Maybe PredictionTimeRange
   -> Maybe Text
   -> ProactiveInsight)
-> Parser (Maybe Text)
-> Parser
     (Maybe InsightTimeRange
      -> Maybe Text
      -> Maybe PredictionTimeRange
      -> Maybe Text
      -> ProactiveInsight)
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
"SsmOpsItemId")
            Parser
  (Maybe InsightTimeRange
   -> Maybe Text
   -> Maybe PredictionTimeRange
   -> Maybe Text
   -> ProactiveInsight)
-> Parser (Maybe InsightTimeRange)
-> Parser
     (Maybe Text
      -> Maybe PredictionTimeRange -> Maybe Text -> ProactiveInsight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InsightTimeRange)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InsightTimeRange")
            Parser
  (Maybe Text
   -> Maybe PredictionTimeRange -> Maybe Text -> ProactiveInsight)
-> Parser (Maybe Text)
-> Parser
     (Maybe PredictionTimeRange -> Maybe Text -> ProactiveInsight)
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")
            Parser
  (Maybe PredictionTimeRange -> Maybe Text -> ProactiveInsight)
-> Parser (Maybe PredictionTimeRange)
-> Parser (Maybe Text -> ProactiveInsight)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PredictionTimeRange)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PredictionTimeRange")
            Parser (Maybe Text -> ProactiveInsight)
-> Parser (Maybe Text) -> Parser ProactiveInsight
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
"Id")
      )

instance Prelude.Hashable ProactiveInsight

instance Prelude.NFData ProactiveInsight