{-# 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-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.ProactiveInsight 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.InsightSeverity
import Amazonka.DevOpsGuru.Types.InsightStatus
import Amazonka.DevOpsGuru.Types.InsightTimeRange
import Amazonka.DevOpsGuru.Types.PredictionTimeRange
import Amazonka.DevOpsGuru.Types.ResourceCollection
import qualified Amazonka.Prelude as Prelude

-- | Details about a proactive insight. This object is returned by
-- @ListInsights@.
--
-- /See:/ 'newProactiveInsight' smart constructor.
data ProactiveInsight = ProactiveInsight'
  { -- | Describes the proactive insight.
    ProactiveInsight -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the proactive insight.
    ProactiveInsight -> Maybe Text
id :: 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,
    ProactiveInsight -> Maybe ResourceCollection
resourceCollection :: Prelude.Maybe ResourceCollection,
    -- | The severity of the insight. For more information, see
    -- <https://docs.aws.amazon.com/devops-guru/latest/userguide/working-with-insights.html#understanding-insights-severities Understanding insight severities>
    -- in the /Amazon DevOps Guru User Guide/.
    ProactiveInsight -> Maybe InsightSeverity
severity :: Prelude.Maybe InsightSeverity,
    -- | The ID of the Amazon Web Services 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,
    -- | The status of the proactive insight.
    ProactiveInsight -> Maybe InsightStatus
status :: Prelude.Maybe InsightStatus
  }
  deriving (ProactiveInsight -> ProactiveInsight -> Bool
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]
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
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. 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:
--
-- 'description', 'proactiveInsight_description' - Describes the proactive insight.
--
-- 'id', 'proactiveInsight_id' - The ID of the proactive insight.
--
-- 'insightTimeRange', 'proactiveInsight_insightTimeRange' - Undocumented member.
--
-- 'name', 'proactiveInsight_name' - The name of the proactive insight.
--
-- 'predictionTimeRange', 'proactiveInsight_predictionTimeRange' - Undocumented member.
--
-- 'resourceCollection', 'proactiveInsight_resourceCollection' - Undocumented member.
--
-- 'severity', 'proactiveInsight_severity' - The severity of the insight. For more information, see
-- <https://docs.aws.amazon.com/devops-guru/latest/userguide/working-with-insights.html#understanding-insights-severities Understanding insight severities>
-- in the /Amazon DevOps Guru User Guide/.
--
-- 'ssmOpsItemId', 'proactiveInsight_ssmOpsItemId' - The ID of the Amazon Web Services System Manager OpsItem created for
-- this insight. You must enable the creation of OpstItems insights before
-- they are created for each insight.
--
-- 'status', 'proactiveInsight_status' - The status of the proactive insight.
newProactiveInsight ::
  ProactiveInsight
newProactiveInsight :: ProactiveInsight
newProactiveInsight =
  ProactiveInsight'
    { $sel:description:ProactiveInsight' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ProactiveInsight' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:insightTimeRange:ProactiveInsight' :: Maybe InsightTimeRange
insightTimeRange = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ProactiveInsight' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:predictionTimeRange:ProactiveInsight' :: Maybe PredictionTimeRange
predictionTimeRange = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceCollection:ProactiveInsight' :: Maybe ResourceCollection
resourceCollection = forall a. Maybe a
Prelude.Nothing,
      $sel:severity:ProactiveInsight' :: Maybe InsightSeverity
severity = forall a. Maybe a
Prelude.Nothing,
      $sel:ssmOpsItemId:ProactiveInsight' :: Maybe Text
ssmOpsItemId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ProactiveInsight' :: Maybe InsightStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the proactive insight.
proactiveInsight_description :: Lens.Lens' ProactiveInsight (Prelude.Maybe Prelude.Text)
proactiveInsight_description :: Lens' ProactiveInsight (Maybe Text)
proactiveInsight_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProactiveInsight' {Maybe Text
description :: Maybe Text
$sel:description:ProactiveInsight' :: ProactiveInsight -> Maybe Text
description} -> Maybe Text
description) (\s :: ProactiveInsight
s@ProactiveInsight' {} Maybe Text
a -> ProactiveInsight
s {$sel:description:ProactiveInsight' :: Maybe Text
description = Maybe Text
a} :: ProactiveInsight)

-- | The ID of the proactive insight.
proactiveInsight_id :: Lens.Lens' ProactiveInsight (Prelude.Maybe Prelude.Text)
proactiveInsight_id :: Lens' ProactiveInsight (Maybe Text)
proactiveInsight_id = 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)

-- | Undocumented member.
proactiveInsight_insightTimeRange :: Lens.Lens' ProactiveInsight (Prelude.Maybe InsightTimeRange)
proactiveInsight_insightTimeRange :: Lens' ProactiveInsight (Maybe InsightTimeRange)
proactiveInsight_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 :: Lens' ProactiveInsight (Maybe Text)
proactiveInsight_name = 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 :: Lens' ProactiveInsight (Maybe PredictionTimeRange)
proactiveInsight_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)

-- | Undocumented member.
proactiveInsight_resourceCollection :: Lens.Lens' ProactiveInsight (Prelude.Maybe ResourceCollection)
proactiveInsight_resourceCollection :: Lens' ProactiveInsight (Maybe ResourceCollection)
proactiveInsight_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 insight. For more information, see
-- <https://docs.aws.amazon.com/devops-guru/latest/userguide/working-with-insights.html#understanding-insights-severities Understanding insight severities>
-- in the /Amazon DevOps Guru User Guide/.
proactiveInsight_severity :: Lens.Lens' ProactiveInsight (Prelude.Maybe InsightSeverity)
proactiveInsight_severity :: Lens' ProactiveInsight (Maybe InsightSeverity)
proactiveInsight_severity = 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 Amazon Web Services 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 :: Lens' ProactiveInsight (Maybe Text)
proactiveInsight_ssmOpsItemId = 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)

-- | The status of the proactive insight.
proactiveInsight_status :: Lens.Lens' ProactiveInsight (Prelude.Maybe InsightStatus)
proactiveInsight_status :: Lens' ProactiveInsight (Maybe InsightStatus)
proactiveInsight_status = 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)

instance Data.FromJSON ProactiveInsight where
  parseJSON :: Value -> Parser ProactiveInsight
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProactiveInsight"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe InsightTimeRange
-> Maybe Text
-> Maybe PredictionTimeRange
-> Maybe ResourceCollection
-> Maybe InsightSeverity
-> Maybe Text
-> Maybe InsightStatus
-> ProactiveInsight
ProactiveInsight'
            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
"Id")
            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
"InsightTimeRange")
            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
"Name")
            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
"PredictionTimeRange")
            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
"ResourceCollection")
            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
"Severity")
            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
"SsmOpsItemId")
            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
"Status")
      )

instance Prelude.Hashable ProactiveInsight where
  hashWithSalt :: Int -> ProactiveInsight -> Int
hashWithSalt Int
_salt ProactiveInsight' {Maybe Text
Maybe InsightSeverity
Maybe InsightStatus
Maybe InsightTimeRange
Maybe PredictionTimeRange
Maybe ResourceCollection
status :: Maybe InsightStatus
ssmOpsItemId :: Maybe Text
severity :: Maybe InsightSeverity
resourceCollection :: Maybe ResourceCollection
predictionTimeRange :: Maybe PredictionTimeRange
name :: Maybe Text
insightTimeRange :: Maybe InsightTimeRange
id :: Maybe Text
description :: Maybe Text
$sel:status:ProactiveInsight' :: ProactiveInsight -> Maybe InsightStatus
$sel:ssmOpsItemId:ProactiveInsight' :: ProactiveInsight -> Maybe Text
$sel:severity:ProactiveInsight' :: ProactiveInsight -> Maybe InsightSeverity
$sel:resourceCollection:ProactiveInsight' :: ProactiveInsight -> Maybe ResourceCollection
$sel:predictionTimeRange:ProactiveInsight' :: ProactiveInsight -> Maybe PredictionTimeRange
$sel:name:ProactiveInsight' :: ProactiveInsight -> Maybe Text
$sel:insightTimeRange:ProactiveInsight' :: ProactiveInsight -> Maybe InsightTimeRange
$sel:id:ProactiveInsight' :: ProactiveInsight -> Maybe Text
$sel:description:ProactiveInsight' :: ProactiveInsight -> 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
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InsightTimeRange
insightTimeRange
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PredictionTimeRange
predictionTimeRange
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceCollection
resourceCollection
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InsightSeverity
severity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ssmOpsItemId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InsightStatus
status

instance Prelude.NFData ProactiveInsight where
  rnf :: ProactiveInsight -> ()
rnf ProactiveInsight' {Maybe Text
Maybe InsightSeverity
Maybe InsightStatus
Maybe InsightTimeRange
Maybe PredictionTimeRange
Maybe ResourceCollection
status :: Maybe InsightStatus
ssmOpsItemId :: Maybe Text
severity :: Maybe InsightSeverity
resourceCollection :: Maybe ResourceCollection
predictionTimeRange :: Maybe PredictionTimeRange
name :: Maybe Text
insightTimeRange :: Maybe InsightTimeRange
id :: Maybe Text
description :: Maybe Text
$sel:status:ProactiveInsight' :: ProactiveInsight -> Maybe InsightStatus
$sel:ssmOpsItemId:ProactiveInsight' :: ProactiveInsight -> Maybe Text
$sel:severity:ProactiveInsight' :: ProactiveInsight -> Maybe InsightSeverity
$sel:resourceCollection:ProactiveInsight' :: ProactiveInsight -> Maybe ResourceCollection
$sel:predictionTimeRange:ProactiveInsight' :: ProactiveInsight -> Maybe PredictionTimeRange
$sel:name:ProactiveInsight' :: ProactiveInsight -> Maybe Text
$sel:insightTimeRange:ProactiveInsight' :: ProactiveInsight -> Maybe InsightTimeRange
$sel:id:ProactiveInsight' :: ProactiveInsight -> Maybe Text
$sel:description:ProactiveInsight' :: ProactiveInsight -> 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
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InsightTimeRange
insightTimeRange
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PredictionTimeRange
predictionTimeRange
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceCollection
resourceCollection
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InsightSeverity
severity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ssmOpsItemId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InsightStatus
status