{-# 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.AuditManager.Types.Notification
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AuditManager.Types.Notification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The notification used to inform a user of an update in Audit Manager.
-- For example, this includes the notification that is sent when a control
-- set is delegated for review.
--
-- /See:/ 'newNotification' smart constructor.
data Notification = Notification'
  { -- | Specifies the name of the control set that the notification is about.
    Notification -> Maybe Text
controlSetName :: Prelude.Maybe Prelude.Text,
    -- | The identifier for the specified control set.
    Notification -> Maybe Text
controlSetId :: Prelude.Maybe Prelude.Text,
    -- | The time when the notification was sent.
    Notification -> Maybe POSIX
eventTime :: Prelude.Maybe Core.POSIX,
    -- | The sender of the notification.
    Notification -> Maybe Text
source :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the notification.
    Notification -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The identifier for the specified assessment.
    Notification -> Maybe Text
assessmentId :: Prelude.Maybe Prelude.Text,
    -- | The description of the notification.
    Notification -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the related assessment.
    Notification -> Maybe Text
assessmentName :: Prelude.Maybe Prelude.Text
  }
  deriving (Notification -> Notification -> Bool
(Notification -> Notification -> Bool)
-> (Notification -> Notification -> Bool) -> Eq Notification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Notification -> Notification -> Bool
$c/= :: Notification -> Notification -> Bool
== :: Notification -> Notification -> Bool
$c== :: Notification -> Notification -> Bool
Prelude.Eq, ReadPrec [Notification]
ReadPrec Notification
Int -> ReadS Notification
ReadS [Notification]
(Int -> ReadS Notification)
-> ReadS [Notification]
-> ReadPrec Notification
-> ReadPrec [Notification]
-> Read Notification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Notification]
$creadListPrec :: ReadPrec [Notification]
readPrec :: ReadPrec Notification
$creadPrec :: ReadPrec Notification
readList :: ReadS [Notification]
$creadList :: ReadS [Notification]
readsPrec :: Int -> ReadS Notification
$creadsPrec :: Int -> ReadS Notification
Prelude.Read, Int -> Notification -> ShowS
[Notification] -> ShowS
Notification -> String
(Int -> Notification -> ShowS)
-> (Notification -> String)
-> ([Notification] -> ShowS)
-> Show Notification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Notification] -> ShowS
$cshowList :: [Notification] -> ShowS
show :: Notification -> String
$cshow :: Notification -> String
showsPrec :: Int -> Notification -> ShowS
$cshowsPrec :: Int -> Notification -> ShowS
Prelude.Show, (forall x. Notification -> Rep Notification x)
-> (forall x. Rep Notification x -> Notification)
-> Generic Notification
forall x. Rep Notification x -> Notification
forall x. Notification -> Rep Notification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Notification x -> Notification
$cfrom :: forall x. Notification -> Rep Notification x
Prelude.Generic)

-- |
-- Create a value of 'Notification' 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:
--
-- 'controlSetName', 'notification_controlSetName' - Specifies the name of the control set that the notification is about.
--
-- 'controlSetId', 'notification_controlSetId' - The identifier for the specified control set.
--
-- 'eventTime', 'notification_eventTime' - The time when the notification was sent.
--
-- 'source', 'notification_source' - The sender of the notification.
--
-- 'id', 'notification_id' - The unique identifier for the notification.
--
-- 'assessmentId', 'notification_assessmentId' - The identifier for the specified assessment.
--
-- 'description', 'notification_description' - The description of the notification.
--
-- 'assessmentName', 'notification_assessmentName' - The name of the related assessment.
newNotification ::
  Notification
newNotification :: Notification
newNotification =
  Notification' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Notification
Notification'
    { $sel:controlSetName:Notification' :: Maybe Text
controlSetName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:controlSetId:Notification' :: Maybe Text
controlSetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventTime:Notification' :: Maybe POSIX
eventTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:source:Notification' :: Maybe Text
source = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:Notification' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:assessmentId:Notification' :: Maybe Text
assessmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Notification' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:assessmentName:Notification' :: Maybe Text
assessmentName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the name of the control set that the notification is about.
notification_controlSetName :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_controlSetName :: (Maybe Text -> f (Maybe Text)) -> Notification -> f Notification
notification_controlSetName = (Notification -> Maybe Text)
-> (Notification -> Maybe Text -> Notification)
-> Lens Notification Notification (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
controlSetName :: Maybe Text
$sel:controlSetName:Notification' :: Notification -> Maybe Text
controlSetName} -> Maybe Text
controlSetName) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:controlSetName:Notification' :: Maybe Text
controlSetName = Maybe Text
a} :: Notification)

-- | The identifier for the specified control set.
notification_controlSetId :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_controlSetId :: (Maybe Text -> f (Maybe Text)) -> Notification -> f Notification
notification_controlSetId = (Notification -> Maybe Text)
-> (Notification -> Maybe Text -> Notification)
-> Lens Notification Notification (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
controlSetId :: Maybe Text
$sel:controlSetId:Notification' :: Notification -> Maybe Text
controlSetId} -> Maybe Text
controlSetId) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:controlSetId:Notification' :: Maybe Text
controlSetId = Maybe Text
a} :: Notification)

-- | The time when the notification was sent.
notification_eventTime :: Lens.Lens' Notification (Prelude.Maybe Prelude.UTCTime)
notification_eventTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> Notification -> f Notification
notification_eventTime = (Notification -> Maybe POSIX)
-> (Notification -> Maybe POSIX -> Notification)
-> Lens Notification Notification (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe POSIX
eventTime :: Maybe POSIX
$sel:eventTime:Notification' :: Notification -> Maybe POSIX
eventTime} -> Maybe POSIX
eventTime) (\s :: Notification
s@Notification' {} Maybe POSIX
a -> Notification
s {$sel:eventTime:Notification' :: Maybe POSIX
eventTime = Maybe POSIX
a} :: Notification) ((Maybe POSIX -> f (Maybe POSIX))
 -> Notification -> f Notification)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Notification
-> f Notification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The sender of the notification.
notification_source :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_source :: (Maybe Text -> f (Maybe Text)) -> Notification -> f Notification
notification_source = (Notification -> Maybe Text)
-> (Notification -> Maybe Text -> Notification)
-> Lens Notification Notification (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
source :: Maybe Text
$sel:source:Notification' :: Notification -> Maybe Text
source} -> Maybe Text
source) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:source:Notification' :: Maybe Text
source = Maybe Text
a} :: Notification)

-- | The unique identifier for the notification.
notification_id :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_id :: (Maybe Text -> f (Maybe Text)) -> Notification -> f Notification
notification_id = (Notification -> Maybe Text)
-> (Notification -> Maybe Text -> Notification)
-> Lens Notification Notification (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
id :: Maybe Text
$sel:id:Notification' :: Notification -> Maybe Text
id} -> Maybe Text
id) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:id:Notification' :: Maybe Text
id = Maybe Text
a} :: Notification)

-- | The identifier for the specified assessment.
notification_assessmentId :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_assessmentId :: (Maybe Text -> f (Maybe Text)) -> Notification -> f Notification
notification_assessmentId = (Notification -> Maybe Text)
-> (Notification -> Maybe Text -> Notification)
-> Lens Notification Notification (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
assessmentId :: Maybe Text
$sel:assessmentId:Notification' :: Notification -> Maybe Text
assessmentId} -> Maybe Text
assessmentId) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:assessmentId:Notification' :: Maybe Text
assessmentId = Maybe Text
a} :: Notification)

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

-- | The name of the related assessment.
notification_assessmentName :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_assessmentName :: (Maybe Text -> f (Maybe Text)) -> Notification -> f Notification
notification_assessmentName = (Notification -> Maybe Text)
-> (Notification -> Maybe Text -> Notification)
-> Lens Notification Notification (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
assessmentName :: Maybe Text
$sel:assessmentName:Notification' :: Notification -> Maybe Text
assessmentName} -> Maybe Text
assessmentName) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:assessmentName:Notification' :: Maybe Text
assessmentName = Maybe Text
a} :: Notification)

instance Core.FromJSON Notification where
  parseJSON :: Value -> Parser Notification
parseJSON =
    String
-> (Object -> Parser Notification) -> Value -> Parser Notification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Notification"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Notification
Notification'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Notification)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Notification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"controlSetName")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Notification)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Notification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"controlSetId")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Notification)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Notification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eventTime")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Notification)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> Notification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"source")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> Notification)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Notification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"id")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> Notification)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Notification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"assessmentId")
            Parser (Maybe Text -> Maybe Text -> Notification)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Notification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
            Parser (Maybe Text -> Notification)
-> Parser (Maybe Text) -> Parser Notification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"assessmentName")
      )

instance Prelude.Hashable Notification

instance Prelude.NFData Notification