packages feed

amazonka-ssm-incidents-2.0: gen/Amazonka/SSMIncidents/Types/NotificationTargetItem.hs

{-# 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.SSMIncidents.Types.NotificationTargetItem
-- 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.SSMIncidents.Types.NotificationTargetItem 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

-- | The SNS targets that are notified when updates are made to an incident.
--
-- /See:/ 'newNotificationTargetItem' smart constructor.
data NotificationTargetItem = NotificationTargetItem'
  { -- | The Amazon Resource Name (ARN) of the SNS topic.
    snsTopicArn :: Prelude.Maybe Prelude.Text
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'NotificationTargetItem' 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:
--
-- 'snsTopicArn', 'notificationTargetItem_snsTopicArn' - The Amazon Resource Name (ARN) of the SNS topic.
newNotificationTargetItem ::
  NotificationTargetItem
newNotificationTargetItem =
  NotificationTargetItem'
    { snsTopicArn =
        Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the SNS topic.
notificationTargetItem_snsTopicArn :: Lens.Lens' NotificationTargetItem (Prelude.Maybe Prelude.Text)
notificationTargetItem_snsTopicArn = Lens.lens (\NotificationTargetItem' {snsTopicArn} -> snsTopicArn) (\s@NotificationTargetItem' {} a -> s {snsTopicArn = a} :: NotificationTargetItem)

instance Data.FromJSON NotificationTargetItem where
  parseJSON =
    Data.withObject
      "NotificationTargetItem"
      ( \x ->
          NotificationTargetItem'
            Prelude.<$> (x Data..:? "snsTopicArn")
      )

instance Prelude.Hashable NotificationTargetItem where
  hashWithSalt _salt NotificationTargetItem' {..} =
    _salt `Prelude.hashWithSalt` snsTopicArn

instance Prelude.NFData NotificationTargetItem where
  rnf NotificationTargetItem' {..} =
    Prelude.rnf snsTopicArn

instance Data.ToJSON NotificationTargetItem where
  toJSON NotificationTargetItem' {..} =
    Data.object
      ( Prelude.catMaybes
          [("snsTopicArn" Data..=) Prelude.<$> snsTopicArn]
      )