{-# 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.Recommendation
-- 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.Recommendation 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.RecommendationRelatedAnomaly
import Amazonka.DevOpsGuru.Types.RecommendationRelatedEvent
import qualified Amazonka.Prelude as Prelude

-- | Recommendation information to help you remediate detected anomalous
-- behavior that generated an insight.
--
-- /See:/ 'newRecommendation' smart constructor.
data Recommendation = Recommendation'
  { -- | The category type of the recommendation.
    Recommendation -> Maybe Text
category :: Prelude.Maybe Prelude.Text,
    -- | A description of the problem.
    Recommendation -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A hyperlink to information to help you address the problem.
    Recommendation -> Maybe Text
link :: Prelude.Maybe Prelude.Text,
    -- | The name of the recommendation.
    Recommendation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The reason DevOps Guru flagged the anomalous behavior as a problem.
    Recommendation -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | Anomalies that are related to the problem. Use these Anomalies to learn
    -- more about what\'s happening and to help address the issue.
    Recommendation -> Maybe [RecommendationRelatedAnomaly]
relatedAnomalies :: Prelude.Maybe [RecommendationRelatedAnomaly],
    -- | Events that are related to the problem. Use these events to learn more
    -- about what\'s happening and to help address the issue.
    Recommendation -> Maybe [RecommendationRelatedEvent]
relatedEvents :: Prelude.Maybe [RecommendationRelatedEvent]
  }
  deriving (Recommendation -> Recommendation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Recommendation -> Recommendation -> Bool
$c/= :: Recommendation -> Recommendation -> Bool
== :: Recommendation -> Recommendation -> Bool
$c== :: Recommendation -> Recommendation -> Bool
Prelude.Eq, ReadPrec [Recommendation]
ReadPrec Recommendation
Int -> ReadS Recommendation
ReadS [Recommendation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Recommendation]
$creadListPrec :: ReadPrec [Recommendation]
readPrec :: ReadPrec Recommendation
$creadPrec :: ReadPrec Recommendation
readList :: ReadS [Recommendation]
$creadList :: ReadS [Recommendation]
readsPrec :: Int -> ReadS Recommendation
$creadsPrec :: Int -> ReadS Recommendation
Prelude.Read, Int -> Recommendation -> ShowS
[Recommendation] -> ShowS
Recommendation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Recommendation] -> ShowS
$cshowList :: [Recommendation] -> ShowS
show :: Recommendation -> String
$cshow :: Recommendation -> String
showsPrec :: Int -> Recommendation -> ShowS
$cshowsPrec :: Int -> Recommendation -> ShowS
Prelude.Show, forall x. Rep Recommendation x -> Recommendation
forall x. Recommendation -> Rep Recommendation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Recommendation x -> Recommendation
$cfrom :: forall x. Recommendation -> Rep Recommendation x
Prelude.Generic)

-- |
-- Create a value of 'Recommendation' 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:
--
-- 'category', 'recommendation_category' - The category type of the recommendation.
--
-- 'description', 'recommendation_description' - A description of the problem.
--
-- 'link', 'recommendation_link' - A hyperlink to information to help you address the problem.
--
-- 'name', 'recommendation_name' - The name of the recommendation.
--
-- 'reason', 'recommendation_reason' - The reason DevOps Guru flagged the anomalous behavior as a problem.
--
-- 'relatedAnomalies', 'recommendation_relatedAnomalies' - Anomalies that are related to the problem. Use these Anomalies to learn
-- more about what\'s happening and to help address the issue.
--
-- 'relatedEvents', 'recommendation_relatedEvents' - Events that are related to the problem. Use these events to learn more
-- about what\'s happening and to help address the issue.
newRecommendation ::
  Recommendation
newRecommendation :: Recommendation
newRecommendation =
  Recommendation'
    { $sel:category:Recommendation' :: Maybe Text
category = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Recommendation' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:link:Recommendation' :: Maybe Text
link = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Recommendation' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:reason:Recommendation' :: Maybe Text
reason = forall a. Maybe a
Prelude.Nothing,
      $sel:relatedAnomalies:Recommendation' :: Maybe [RecommendationRelatedAnomaly]
relatedAnomalies = forall a. Maybe a
Prelude.Nothing,
      $sel:relatedEvents:Recommendation' :: Maybe [RecommendationRelatedEvent]
relatedEvents = forall a. Maybe a
Prelude.Nothing
    }

-- | The category type of the recommendation.
recommendation_category :: Lens.Lens' Recommendation (Prelude.Maybe Prelude.Text)
recommendation_category :: Lens' Recommendation (Maybe Text)
recommendation_category = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {Maybe Text
category :: Maybe Text
$sel:category:Recommendation' :: Recommendation -> Maybe Text
category} -> Maybe Text
category) (\s :: Recommendation
s@Recommendation' {} Maybe Text
a -> Recommendation
s {$sel:category:Recommendation' :: Maybe Text
category = Maybe Text
a} :: Recommendation)

-- | A description of the problem.
recommendation_description :: Lens.Lens' Recommendation (Prelude.Maybe Prelude.Text)
recommendation_description :: Lens' Recommendation (Maybe Text)
recommendation_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {Maybe Text
description :: Maybe Text
$sel:description:Recommendation' :: Recommendation -> Maybe Text
description} -> Maybe Text
description) (\s :: Recommendation
s@Recommendation' {} Maybe Text
a -> Recommendation
s {$sel:description:Recommendation' :: Maybe Text
description = Maybe Text
a} :: Recommendation)

-- | A hyperlink to information to help you address the problem.
recommendation_link :: Lens.Lens' Recommendation (Prelude.Maybe Prelude.Text)
recommendation_link :: Lens' Recommendation (Maybe Text)
recommendation_link = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {Maybe Text
link :: Maybe Text
$sel:link:Recommendation' :: Recommendation -> Maybe Text
link} -> Maybe Text
link) (\s :: Recommendation
s@Recommendation' {} Maybe Text
a -> Recommendation
s {$sel:link:Recommendation' :: Maybe Text
link = Maybe Text
a} :: Recommendation)

-- | The name of the recommendation.
recommendation_name :: Lens.Lens' Recommendation (Prelude.Maybe Prelude.Text)
recommendation_name :: Lens' Recommendation (Maybe Text)
recommendation_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {Maybe Text
name :: Maybe Text
$sel:name:Recommendation' :: Recommendation -> Maybe Text
name} -> Maybe Text
name) (\s :: Recommendation
s@Recommendation' {} Maybe Text
a -> Recommendation
s {$sel:name:Recommendation' :: Maybe Text
name = Maybe Text
a} :: Recommendation)

-- | The reason DevOps Guru flagged the anomalous behavior as a problem.
recommendation_reason :: Lens.Lens' Recommendation (Prelude.Maybe Prelude.Text)
recommendation_reason :: Lens' Recommendation (Maybe Text)
recommendation_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {Maybe Text
reason :: Maybe Text
$sel:reason:Recommendation' :: Recommendation -> Maybe Text
reason} -> Maybe Text
reason) (\s :: Recommendation
s@Recommendation' {} Maybe Text
a -> Recommendation
s {$sel:reason:Recommendation' :: Maybe Text
reason = Maybe Text
a} :: Recommendation)

-- | Anomalies that are related to the problem. Use these Anomalies to learn
-- more about what\'s happening and to help address the issue.
recommendation_relatedAnomalies :: Lens.Lens' Recommendation (Prelude.Maybe [RecommendationRelatedAnomaly])
recommendation_relatedAnomalies :: Lens' Recommendation (Maybe [RecommendationRelatedAnomaly])
recommendation_relatedAnomalies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {Maybe [RecommendationRelatedAnomaly]
relatedAnomalies :: Maybe [RecommendationRelatedAnomaly]
$sel:relatedAnomalies:Recommendation' :: Recommendation -> Maybe [RecommendationRelatedAnomaly]
relatedAnomalies} -> Maybe [RecommendationRelatedAnomaly]
relatedAnomalies) (\s :: Recommendation
s@Recommendation' {} Maybe [RecommendationRelatedAnomaly]
a -> Recommendation
s {$sel:relatedAnomalies:Recommendation' :: Maybe [RecommendationRelatedAnomaly]
relatedAnomalies = Maybe [RecommendationRelatedAnomaly]
a} :: Recommendation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Events that are related to the problem. Use these events to learn more
-- about what\'s happening and to help address the issue.
recommendation_relatedEvents :: Lens.Lens' Recommendation (Prelude.Maybe [RecommendationRelatedEvent])
recommendation_relatedEvents :: Lens' Recommendation (Maybe [RecommendationRelatedEvent])
recommendation_relatedEvents = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {Maybe [RecommendationRelatedEvent]
relatedEvents :: Maybe [RecommendationRelatedEvent]
$sel:relatedEvents:Recommendation' :: Recommendation -> Maybe [RecommendationRelatedEvent]
relatedEvents} -> Maybe [RecommendationRelatedEvent]
relatedEvents) (\s :: Recommendation
s@Recommendation' {} Maybe [RecommendationRelatedEvent]
a -> Recommendation
s {$sel:relatedEvents:Recommendation' :: Maybe [RecommendationRelatedEvent]
relatedEvents = Maybe [RecommendationRelatedEvent]
a} :: Recommendation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON Recommendation where
  parseJSON :: Value -> Parser Recommendation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Recommendation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [RecommendationRelatedAnomaly]
-> Maybe [RecommendationRelatedEvent]
-> Recommendation
Recommendation'
            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
"Category")
            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
"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
"Link")
            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
"Reason")
            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
"RelatedAnomalies"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"RelatedEvents" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Recommendation where
  hashWithSalt :: Int -> Recommendation -> Int
hashWithSalt Int
_salt Recommendation' {Maybe [RecommendationRelatedAnomaly]
Maybe [RecommendationRelatedEvent]
Maybe Text
relatedEvents :: Maybe [RecommendationRelatedEvent]
relatedAnomalies :: Maybe [RecommendationRelatedAnomaly]
reason :: Maybe Text
name :: Maybe Text
link :: Maybe Text
description :: Maybe Text
category :: Maybe Text
$sel:relatedEvents:Recommendation' :: Recommendation -> Maybe [RecommendationRelatedEvent]
$sel:relatedAnomalies:Recommendation' :: Recommendation -> Maybe [RecommendationRelatedAnomaly]
$sel:reason:Recommendation' :: Recommendation -> Maybe Text
$sel:name:Recommendation' :: Recommendation -> Maybe Text
$sel:link:Recommendation' :: Recommendation -> Maybe Text
$sel:description:Recommendation' :: Recommendation -> Maybe Text
$sel:category:Recommendation' :: Recommendation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
category
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
link
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [RecommendationRelatedAnomaly]
relatedAnomalies
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [RecommendationRelatedEvent]
relatedEvents

instance Prelude.NFData Recommendation where
  rnf :: Recommendation -> ()
rnf Recommendation' {Maybe [RecommendationRelatedAnomaly]
Maybe [RecommendationRelatedEvent]
Maybe Text
relatedEvents :: Maybe [RecommendationRelatedEvent]
relatedAnomalies :: Maybe [RecommendationRelatedAnomaly]
reason :: Maybe Text
name :: Maybe Text
link :: Maybe Text
description :: Maybe Text
category :: Maybe Text
$sel:relatedEvents:Recommendation' :: Recommendation -> Maybe [RecommendationRelatedEvent]
$sel:relatedAnomalies:Recommendation' :: Recommendation -> Maybe [RecommendationRelatedAnomaly]
$sel:reason:Recommendation' :: Recommendation -> Maybe Text
$sel:name:Recommendation' :: Recommendation -> Maybe Text
$sel:link:Recommendation' :: Recommendation -> Maybe Text
$sel:description:Recommendation' :: Recommendation -> Maybe Text
$sel:category:Recommendation' :: Recommendation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
category
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
link
      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 Text
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [RecommendationRelatedAnomaly]
relatedAnomalies
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [RecommendationRelatedEvent]
relatedEvents