{-# 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.SageMaker.Types.NotificationConfiguration
-- 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.SageMaker.Types.NotificationConfiguration 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

-- | Configures Amazon SNS notifications of available or expiring work items
-- for work teams.
--
-- /See:/ 'newNotificationConfiguration' smart constructor.
data NotificationConfiguration = NotificationConfiguration'
  { -- | The ARN for the Amazon SNS topic to which notifications should be
    -- published.
    NotificationConfiguration -> Maybe Text
notificationTopicArn :: Prelude.Maybe Prelude.Text
  }
  deriving (NotificationConfiguration -> NotificationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotificationConfiguration -> NotificationConfiguration -> Bool
$c/= :: NotificationConfiguration -> NotificationConfiguration -> Bool
== :: NotificationConfiguration -> NotificationConfiguration -> Bool
$c== :: NotificationConfiguration -> NotificationConfiguration -> Bool
Prelude.Eq, ReadPrec [NotificationConfiguration]
ReadPrec NotificationConfiguration
Int -> ReadS NotificationConfiguration
ReadS [NotificationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotificationConfiguration]
$creadListPrec :: ReadPrec [NotificationConfiguration]
readPrec :: ReadPrec NotificationConfiguration
$creadPrec :: ReadPrec NotificationConfiguration
readList :: ReadS [NotificationConfiguration]
$creadList :: ReadS [NotificationConfiguration]
readsPrec :: Int -> ReadS NotificationConfiguration
$creadsPrec :: Int -> ReadS NotificationConfiguration
Prelude.Read, Int -> NotificationConfiguration -> ShowS
[NotificationConfiguration] -> ShowS
NotificationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotificationConfiguration] -> ShowS
$cshowList :: [NotificationConfiguration] -> ShowS
show :: NotificationConfiguration -> String
$cshow :: NotificationConfiguration -> String
showsPrec :: Int -> NotificationConfiguration -> ShowS
$cshowsPrec :: Int -> NotificationConfiguration -> ShowS
Prelude.Show, forall x.
Rep NotificationConfiguration x -> NotificationConfiguration
forall x.
NotificationConfiguration -> Rep NotificationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NotificationConfiguration x -> NotificationConfiguration
$cfrom :: forall x.
NotificationConfiguration -> Rep NotificationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'NotificationConfiguration' 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:
--
-- 'notificationTopicArn', 'notificationConfiguration_notificationTopicArn' - The ARN for the Amazon SNS topic to which notifications should be
-- published.
newNotificationConfiguration ::
  NotificationConfiguration
newNotificationConfiguration :: NotificationConfiguration
newNotificationConfiguration =
  NotificationConfiguration'
    { $sel:notificationTopicArn:NotificationConfiguration' :: Maybe Text
notificationTopicArn =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN for the Amazon SNS topic to which notifications should be
-- published.
notificationConfiguration_notificationTopicArn :: Lens.Lens' NotificationConfiguration (Prelude.Maybe Prelude.Text)
notificationConfiguration_notificationTopicArn :: Lens' NotificationConfiguration (Maybe Text)
notificationConfiguration_notificationTopicArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotificationConfiguration' {Maybe Text
notificationTopicArn :: Maybe Text
$sel:notificationTopicArn:NotificationConfiguration' :: NotificationConfiguration -> Maybe Text
notificationTopicArn} -> Maybe Text
notificationTopicArn) (\s :: NotificationConfiguration
s@NotificationConfiguration' {} Maybe Text
a -> NotificationConfiguration
s {$sel:notificationTopicArn:NotificationConfiguration' :: Maybe Text
notificationTopicArn = Maybe Text
a} :: NotificationConfiguration)

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

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

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

instance Data.ToJSON NotificationConfiguration where
  toJSON :: NotificationConfiguration -> Value
toJSON NotificationConfiguration' {Maybe Text
notificationTopicArn :: Maybe Text
$sel:notificationTopicArn:NotificationConfiguration' :: NotificationConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"NotificationTopicArn" 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
notificationTopicArn
          ]
      )