{-# 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.ResilienceHub.Types.AlarmRecommendation
-- 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.ResilienceHub.Types.AlarmRecommendation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.ResilienceHub.Types.AlarmType
import Amazonka.ResilienceHub.Types.RecommendationItem

-- | Defines a recommendation for a CloudWatch alarm.
--
-- /See:/ 'newAlarmRecommendation' smart constructor.
data AlarmRecommendation = AlarmRecommendation'
  { -- | The application component for the CloudWatch alarm recommendation.
    AlarmRecommendation -> Maybe Text
appComponentName :: Prelude.Maybe Prelude.Text,
    -- | The description of the recommendation.
    AlarmRecommendation -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The list of CloudWatch alarm recommendations.
    AlarmRecommendation -> Maybe [RecommendationItem]
items :: Prelude.Maybe [RecommendationItem],
    -- | The prerequisite for the alarm recommendation.
    AlarmRecommendation -> Maybe Text
prerequisite :: Prelude.Maybe Prelude.Text,
    -- | The name of the alarm recommendation.
    AlarmRecommendation -> Text
name :: Prelude.Text,
    -- | The identifier of the alarm recommendation.
    AlarmRecommendation -> Text
recommendationId :: Prelude.Text,
    -- | The reference identifier of the alarm recommendation.
    AlarmRecommendation -> Text
referenceId :: Prelude.Text,
    -- | The type of alarm recommendation.
    AlarmRecommendation -> AlarmType
type' :: AlarmType
  }
  deriving (AlarmRecommendation -> AlarmRecommendation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlarmRecommendation -> AlarmRecommendation -> Bool
$c/= :: AlarmRecommendation -> AlarmRecommendation -> Bool
== :: AlarmRecommendation -> AlarmRecommendation -> Bool
$c== :: AlarmRecommendation -> AlarmRecommendation -> Bool
Prelude.Eq, ReadPrec [AlarmRecommendation]
ReadPrec AlarmRecommendation
Int -> ReadS AlarmRecommendation
ReadS [AlarmRecommendation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AlarmRecommendation]
$creadListPrec :: ReadPrec [AlarmRecommendation]
readPrec :: ReadPrec AlarmRecommendation
$creadPrec :: ReadPrec AlarmRecommendation
readList :: ReadS [AlarmRecommendation]
$creadList :: ReadS [AlarmRecommendation]
readsPrec :: Int -> ReadS AlarmRecommendation
$creadsPrec :: Int -> ReadS AlarmRecommendation
Prelude.Read, Int -> AlarmRecommendation -> ShowS
[AlarmRecommendation] -> ShowS
AlarmRecommendation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlarmRecommendation] -> ShowS
$cshowList :: [AlarmRecommendation] -> ShowS
show :: AlarmRecommendation -> String
$cshow :: AlarmRecommendation -> String
showsPrec :: Int -> AlarmRecommendation -> ShowS
$cshowsPrec :: Int -> AlarmRecommendation -> ShowS
Prelude.Show, forall x. Rep AlarmRecommendation x -> AlarmRecommendation
forall x. AlarmRecommendation -> Rep AlarmRecommendation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AlarmRecommendation x -> AlarmRecommendation
$cfrom :: forall x. AlarmRecommendation -> Rep AlarmRecommendation x
Prelude.Generic)

-- |
-- Create a value of 'AlarmRecommendation' 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:
--
-- 'appComponentName', 'alarmRecommendation_appComponentName' - The application component for the CloudWatch alarm recommendation.
--
-- 'description', 'alarmRecommendation_description' - The description of the recommendation.
--
-- 'items', 'alarmRecommendation_items' - The list of CloudWatch alarm recommendations.
--
-- 'prerequisite', 'alarmRecommendation_prerequisite' - The prerequisite for the alarm recommendation.
--
-- 'name', 'alarmRecommendation_name' - The name of the alarm recommendation.
--
-- 'recommendationId', 'alarmRecommendation_recommendationId' - The identifier of the alarm recommendation.
--
-- 'referenceId', 'alarmRecommendation_referenceId' - The reference identifier of the alarm recommendation.
--
-- 'type'', 'alarmRecommendation_type' - The type of alarm recommendation.
newAlarmRecommendation ::
  -- | 'name'
  Prelude.Text ->
  -- | 'recommendationId'
  Prelude.Text ->
  -- | 'referenceId'
  Prelude.Text ->
  -- | 'type''
  AlarmType ->
  AlarmRecommendation
newAlarmRecommendation :: Text -> Text -> Text -> AlarmType -> AlarmRecommendation
newAlarmRecommendation
  Text
pName_
  Text
pRecommendationId_
  Text
pReferenceId_
  AlarmType
pType_ =
    AlarmRecommendation'
      { $sel:appComponentName:AlarmRecommendation' :: Maybe Text
appComponentName =
          forall a. Maybe a
Prelude.Nothing,
        $sel:description:AlarmRecommendation' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:items:AlarmRecommendation' :: Maybe [RecommendationItem]
items = forall a. Maybe a
Prelude.Nothing,
        $sel:prerequisite:AlarmRecommendation' :: Maybe Text
prerequisite = forall a. Maybe a
Prelude.Nothing,
        $sel:name:AlarmRecommendation' :: Text
name = Text
pName_,
        $sel:recommendationId:AlarmRecommendation' :: Text
recommendationId = Text
pRecommendationId_,
        $sel:referenceId:AlarmRecommendation' :: Text
referenceId = Text
pReferenceId_,
        $sel:type':AlarmRecommendation' :: AlarmType
type' = AlarmType
pType_
      }

-- | The application component for the CloudWatch alarm recommendation.
alarmRecommendation_appComponentName :: Lens.Lens' AlarmRecommendation (Prelude.Maybe Prelude.Text)
alarmRecommendation_appComponentName :: Lens' AlarmRecommendation (Maybe Text)
alarmRecommendation_appComponentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmRecommendation' {Maybe Text
appComponentName :: Maybe Text
$sel:appComponentName:AlarmRecommendation' :: AlarmRecommendation -> Maybe Text
appComponentName} -> Maybe Text
appComponentName) (\s :: AlarmRecommendation
s@AlarmRecommendation' {} Maybe Text
a -> AlarmRecommendation
s {$sel:appComponentName:AlarmRecommendation' :: Maybe Text
appComponentName = Maybe Text
a} :: AlarmRecommendation)

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

-- | The list of CloudWatch alarm recommendations.
alarmRecommendation_items :: Lens.Lens' AlarmRecommendation (Prelude.Maybe [RecommendationItem])
alarmRecommendation_items :: Lens' AlarmRecommendation (Maybe [RecommendationItem])
alarmRecommendation_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmRecommendation' {Maybe [RecommendationItem]
items :: Maybe [RecommendationItem]
$sel:items:AlarmRecommendation' :: AlarmRecommendation -> Maybe [RecommendationItem]
items} -> Maybe [RecommendationItem]
items) (\s :: AlarmRecommendation
s@AlarmRecommendation' {} Maybe [RecommendationItem]
a -> AlarmRecommendation
s {$sel:items:AlarmRecommendation' :: Maybe [RecommendationItem]
items = Maybe [RecommendationItem]
a} :: AlarmRecommendation) 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

-- | The prerequisite for the alarm recommendation.
alarmRecommendation_prerequisite :: Lens.Lens' AlarmRecommendation (Prelude.Maybe Prelude.Text)
alarmRecommendation_prerequisite :: Lens' AlarmRecommendation (Maybe Text)
alarmRecommendation_prerequisite = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmRecommendation' {Maybe Text
prerequisite :: Maybe Text
$sel:prerequisite:AlarmRecommendation' :: AlarmRecommendation -> Maybe Text
prerequisite} -> Maybe Text
prerequisite) (\s :: AlarmRecommendation
s@AlarmRecommendation' {} Maybe Text
a -> AlarmRecommendation
s {$sel:prerequisite:AlarmRecommendation' :: Maybe Text
prerequisite = Maybe Text
a} :: AlarmRecommendation)

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

-- | The identifier of the alarm recommendation.
alarmRecommendation_recommendationId :: Lens.Lens' AlarmRecommendation Prelude.Text
alarmRecommendation_recommendationId :: Lens' AlarmRecommendation Text
alarmRecommendation_recommendationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmRecommendation' {Text
recommendationId :: Text
$sel:recommendationId:AlarmRecommendation' :: AlarmRecommendation -> Text
recommendationId} -> Text
recommendationId) (\s :: AlarmRecommendation
s@AlarmRecommendation' {} Text
a -> AlarmRecommendation
s {$sel:recommendationId:AlarmRecommendation' :: Text
recommendationId = Text
a} :: AlarmRecommendation)

-- | The reference identifier of the alarm recommendation.
alarmRecommendation_referenceId :: Lens.Lens' AlarmRecommendation Prelude.Text
alarmRecommendation_referenceId :: Lens' AlarmRecommendation Text
alarmRecommendation_referenceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmRecommendation' {Text
referenceId :: Text
$sel:referenceId:AlarmRecommendation' :: AlarmRecommendation -> Text
referenceId} -> Text
referenceId) (\s :: AlarmRecommendation
s@AlarmRecommendation' {} Text
a -> AlarmRecommendation
s {$sel:referenceId:AlarmRecommendation' :: Text
referenceId = Text
a} :: AlarmRecommendation)

-- | The type of alarm recommendation.
alarmRecommendation_type :: Lens.Lens' AlarmRecommendation AlarmType
alarmRecommendation_type :: Lens' AlarmRecommendation AlarmType
alarmRecommendation_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmRecommendation' {AlarmType
type' :: AlarmType
$sel:type':AlarmRecommendation' :: AlarmRecommendation -> AlarmType
type'} -> AlarmType
type') (\s :: AlarmRecommendation
s@AlarmRecommendation' {} AlarmType
a -> AlarmRecommendation
s {$sel:type':AlarmRecommendation' :: AlarmType
type' = AlarmType
a} :: AlarmRecommendation)

instance Data.FromJSON AlarmRecommendation where
  parseJSON :: Value -> Parser AlarmRecommendation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AlarmRecommendation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [RecommendationItem]
-> Maybe Text
-> Text
-> Text
-> Text
-> AlarmType
-> AlarmRecommendation
AlarmRecommendation'
            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
"appComponentName")
            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
"items" 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
"prerequisite")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser 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 a
Data..: Key
"recommendationId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"referenceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"type")
      )

instance Prelude.Hashable AlarmRecommendation where
  hashWithSalt :: Int -> AlarmRecommendation -> Int
hashWithSalt Int
_salt AlarmRecommendation' {Maybe [RecommendationItem]
Maybe Text
Text
AlarmType
type' :: AlarmType
referenceId :: Text
recommendationId :: Text
name :: Text
prerequisite :: Maybe Text
items :: Maybe [RecommendationItem]
description :: Maybe Text
appComponentName :: Maybe Text
$sel:type':AlarmRecommendation' :: AlarmRecommendation -> AlarmType
$sel:referenceId:AlarmRecommendation' :: AlarmRecommendation -> Text
$sel:recommendationId:AlarmRecommendation' :: AlarmRecommendation -> Text
$sel:name:AlarmRecommendation' :: AlarmRecommendation -> Text
$sel:prerequisite:AlarmRecommendation' :: AlarmRecommendation -> Maybe Text
$sel:items:AlarmRecommendation' :: AlarmRecommendation -> Maybe [RecommendationItem]
$sel:description:AlarmRecommendation' :: AlarmRecommendation -> Maybe Text
$sel:appComponentName:AlarmRecommendation' :: AlarmRecommendation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
appComponentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [RecommendationItem]
items
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
prerequisite
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
recommendationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
referenceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AlarmType
type'

instance Prelude.NFData AlarmRecommendation where
  rnf :: AlarmRecommendation -> ()
rnf AlarmRecommendation' {Maybe [RecommendationItem]
Maybe Text
Text
AlarmType
type' :: AlarmType
referenceId :: Text
recommendationId :: Text
name :: Text
prerequisite :: Maybe Text
items :: Maybe [RecommendationItem]
description :: Maybe Text
appComponentName :: Maybe Text
$sel:type':AlarmRecommendation' :: AlarmRecommendation -> AlarmType
$sel:referenceId:AlarmRecommendation' :: AlarmRecommendation -> Text
$sel:recommendationId:AlarmRecommendation' :: AlarmRecommendation -> Text
$sel:name:AlarmRecommendation' :: AlarmRecommendation -> Text
$sel:prerequisite:AlarmRecommendation' :: AlarmRecommendation -> Maybe Text
$sel:items:AlarmRecommendation' :: AlarmRecommendation -> Maybe [RecommendationItem]
$sel:description:AlarmRecommendation' :: AlarmRecommendation -> Maybe Text
$sel:appComponentName:AlarmRecommendation' :: AlarmRecommendation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
appComponentName
      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 [RecommendationItem]
items
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
prerequisite
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
recommendationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
referenceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AlarmType
type'