{-# 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.SSM.Types.OpsItemNotification
-- 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.SSM.Types.OpsItemNotification 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

-- | A notification about the OpsItem.
--
-- /See:/ 'newOpsItemNotification' smart constructor.
data OpsItemNotification = OpsItemNotification'
  { -- | The Amazon Resource Name (ARN) of an Amazon Simple Notification Service
    -- (Amazon SNS) topic where notifications are sent when this OpsItem is
    -- edited or changed.
    OpsItemNotification -> Maybe Text
arn :: Prelude.Maybe Prelude.Text
  }
  deriving (OpsItemNotification -> OpsItemNotification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OpsItemNotification -> OpsItemNotification -> Bool
$c/= :: OpsItemNotification -> OpsItemNotification -> Bool
== :: OpsItemNotification -> OpsItemNotification -> Bool
$c== :: OpsItemNotification -> OpsItemNotification -> Bool
Prelude.Eq, ReadPrec [OpsItemNotification]
ReadPrec OpsItemNotification
Int -> ReadS OpsItemNotification
ReadS [OpsItemNotification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OpsItemNotification]
$creadListPrec :: ReadPrec [OpsItemNotification]
readPrec :: ReadPrec OpsItemNotification
$creadPrec :: ReadPrec OpsItemNotification
readList :: ReadS [OpsItemNotification]
$creadList :: ReadS [OpsItemNotification]
readsPrec :: Int -> ReadS OpsItemNotification
$creadsPrec :: Int -> ReadS OpsItemNotification
Prelude.Read, Int -> OpsItemNotification -> ShowS
[OpsItemNotification] -> ShowS
OpsItemNotification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OpsItemNotification] -> ShowS
$cshowList :: [OpsItemNotification] -> ShowS
show :: OpsItemNotification -> String
$cshow :: OpsItemNotification -> String
showsPrec :: Int -> OpsItemNotification -> ShowS
$cshowsPrec :: Int -> OpsItemNotification -> ShowS
Prelude.Show, forall x. Rep OpsItemNotification x -> OpsItemNotification
forall x. OpsItemNotification -> Rep OpsItemNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OpsItemNotification x -> OpsItemNotification
$cfrom :: forall x. OpsItemNotification -> Rep OpsItemNotification x
Prelude.Generic)

-- |
-- Create a value of 'OpsItemNotification' 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:
--
-- 'arn', 'opsItemNotification_arn' - The Amazon Resource Name (ARN) of an Amazon Simple Notification Service
-- (Amazon SNS) topic where notifications are sent when this OpsItem is
-- edited or changed.
newOpsItemNotification ::
  OpsItemNotification
newOpsItemNotification :: OpsItemNotification
newOpsItemNotification =
  OpsItemNotification' {$sel:arn:OpsItemNotification' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing}

-- | The Amazon Resource Name (ARN) of an Amazon Simple Notification Service
-- (Amazon SNS) topic where notifications are sent when this OpsItem is
-- edited or changed.
opsItemNotification_arn :: Lens.Lens' OpsItemNotification (Prelude.Maybe Prelude.Text)
opsItemNotification_arn :: Lens' OpsItemNotification (Maybe Text)
opsItemNotification_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpsItemNotification' {Maybe Text
arn :: Maybe Text
$sel:arn:OpsItemNotification' :: OpsItemNotification -> Maybe Text
arn} -> Maybe Text
arn) (\s :: OpsItemNotification
s@OpsItemNotification' {} Maybe Text
a -> OpsItemNotification
s {$sel:arn:OpsItemNotification' :: Maybe Text
arn = Maybe Text
a} :: OpsItemNotification)

instance Data.FromJSON OpsItemNotification where
  parseJSON :: Value -> Parser OpsItemNotification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OpsItemNotification"
      ( \Object
x ->
          Maybe Text -> OpsItemNotification
OpsItemNotification' 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
"Arn")
      )

instance Prelude.Hashable OpsItemNotification where
  hashWithSalt :: Int -> OpsItemNotification -> Int
hashWithSalt Int
_salt OpsItemNotification' {Maybe Text
arn :: Maybe Text
$sel:arn:OpsItemNotification' :: OpsItemNotification -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn

instance Prelude.NFData OpsItemNotification where
  rnf :: OpsItemNotification -> ()
rnf OpsItemNotification' {Maybe Text
arn :: Maybe Text
$sel:arn:OpsItemNotification' :: OpsItemNotification -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn

instance Data.ToJSON OpsItemNotification where
  toJSON :: OpsItemNotification -> Value
toJSON OpsItemNotification' {Maybe Text
arn :: Maybe Text
$sel:arn:OpsItemNotification' :: OpsItemNotification -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      (forall a. [Maybe a] -> [a]
Prelude.catMaybes [(Key
"Arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
arn])