{-# 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.SESV2.Types.BlacklistEntry
-- 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.SESV2.Types.BlacklistEntry 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

-- | An object that contains information about a blacklisting event that
-- impacts one of the dedicated IP addresses that is associated with your
-- account.
--
-- /See:/ 'newBlacklistEntry' smart constructor.
data BlacklistEntry = BlacklistEntry'
  { -- | Additional information about the blacklisting event, as provided by the
    -- blacklist maintainer.
    BlacklistEntry -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The time when the blacklisting event occurred.
    BlacklistEntry -> Maybe POSIX
listingTime :: Prelude.Maybe Data.POSIX,
    -- | The name of the blacklist that the IP address appears on.
    BlacklistEntry -> Maybe Text
rblName :: Prelude.Maybe Prelude.Text
  }
  deriving (BlacklistEntry -> BlacklistEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BlacklistEntry -> BlacklistEntry -> Bool
$c/= :: BlacklistEntry -> BlacklistEntry -> Bool
== :: BlacklistEntry -> BlacklistEntry -> Bool
$c== :: BlacklistEntry -> BlacklistEntry -> Bool
Prelude.Eq, ReadPrec [BlacklistEntry]
ReadPrec BlacklistEntry
Int -> ReadS BlacklistEntry
ReadS [BlacklistEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BlacklistEntry]
$creadListPrec :: ReadPrec [BlacklistEntry]
readPrec :: ReadPrec BlacklistEntry
$creadPrec :: ReadPrec BlacklistEntry
readList :: ReadS [BlacklistEntry]
$creadList :: ReadS [BlacklistEntry]
readsPrec :: Int -> ReadS BlacklistEntry
$creadsPrec :: Int -> ReadS BlacklistEntry
Prelude.Read, Int -> BlacklistEntry -> ShowS
[BlacklistEntry] -> ShowS
BlacklistEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BlacklistEntry] -> ShowS
$cshowList :: [BlacklistEntry] -> ShowS
show :: BlacklistEntry -> String
$cshow :: BlacklistEntry -> String
showsPrec :: Int -> BlacklistEntry -> ShowS
$cshowsPrec :: Int -> BlacklistEntry -> ShowS
Prelude.Show, forall x. Rep BlacklistEntry x -> BlacklistEntry
forall x. BlacklistEntry -> Rep BlacklistEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BlacklistEntry x -> BlacklistEntry
$cfrom :: forall x. BlacklistEntry -> Rep BlacklistEntry x
Prelude.Generic)

-- |
-- Create a value of 'BlacklistEntry' 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:
--
-- 'description', 'blacklistEntry_description' - Additional information about the blacklisting event, as provided by the
-- blacklist maintainer.
--
-- 'listingTime', 'blacklistEntry_listingTime' - The time when the blacklisting event occurred.
--
-- 'rblName', 'blacklistEntry_rblName' - The name of the blacklist that the IP address appears on.
newBlacklistEntry ::
  BlacklistEntry
newBlacklistEntry :: BlacklistEntry
newBlacklistEntry =
  BlacklistEntry'
    { $sel:description:BlacklistEntry' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:listingTime:BlacklistEntry' :: Maybe POSIX
listingTime = forall a. Maybe a
Prelude.Nothing,
      $sel:rblName:BlacklistEntry' :: Maybe Text
rblName = forall a. Maybe a
Prelude.Nothing
    }

-- | Additional information about the blacklisting event, as provided by the
-- blacklist maintainer.
blacklistEntry_description :: Lens.Lens' BlacklistEntry (Prelude.Maybe Prelude.Text)
blacklistEntry_description :: Lens' BlacklistEntry (Maybe Text)
blacklistEntry_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlacklistEntry' {Maybe Text
description :: Maybe Text
$sel:description:BlacklistEntry' :: BlacklistEntry -> Maybe Text
description} -> Maybe Text
description) (\s :: BlacklistEntry
s@BlacklistEntry' {} Maybe Text
a -> BlacklistEntry
s {$sel:description:BlacklistEntry' :: Maybe Text
description = Maybe Text
a} :: BlacklistEntry)

-- | The time when the blacklisting event occurred.
blacklistEntry_listingTime :: Lens.Lens' BlacklistEntry (Prelude.Maybe Prelude.UTCTime)
blacklistEntry_listingTime :: Lens' BlacklistEntry (Maybe UTCTime)
blacklistEntry_listingTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlacklistEntry' {Maybe POSIX
listingTime :: Maybe POSIX
$sel:listingTime:BlacklistEntry' :: BlacklistEntry -> Maybe POSIX
listingTime} -> Maybe POSIX
listingTime) (\s :: BlacklistEntry
s@BlacklistEntry' {} Maybe POSIX
a -> BlacklistEntry
s {$sel:listingTime:BlacklistEntry' :: Maybe POSIX
listingTime = Maybe POSIX
a} :: BlacklistEntry) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the blacklist that the IP address appears on.
blacklistEntry_rblName :: Lens.Lens' BlacklistEntry (Prelude.Maybe Prelude.Text)
blacklistEntry_rblName :: Lens' BlacklistEntry (Maybe Text)
blacklistEntry_rblName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlacklistEntry' {Maybe Text
rblName :: Maybe Text
$sel:rblName:BlacklistEntry' :: BlacklistEntry -> Maybe Text
rblName} -> Maybe Text
rblName) (\s :: BlacklistEntry
s@BlacklistEntry' {} Maybe Text
a -> BlacklistEntry
s {$sel:rblName:BlacklistEntry' :: Maybe Text
rblName = Maybe Text
a} :: BlacklistEntry)

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

instance Prelude.Hashable BlacklistEntry where
  hashWithSalt :: Int -> BlacklistEntry -> Int
hashWithSalt Int
_salt BlacklistEntry' {Maybe Text
Maybe POSIX
rblName :: Maybe Text
listingTime :: Maybe POSIX
description :: Maybe Text
$sel:rblName:BlacklistEntry' :: BlacklistEntry -> Maybe Text
$sel:listingTime:BlacklistEntry' :: BlacklistEntry -> Maybe POSIX
$sel:description:BlacklistEntry' :: BlacklistEntry -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
listingTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
rblName

instance Prelude.NFData BlacklistEntry where
  rnf :: BlacklistEntry -> ()
rnf BlacklistEntry' {Maybe Text
Maybe POSIX
rblName :: Maybe Text
listingTime :: Maybe POSIX
description :: Maybe Text
$sel:rblName:BlacklistEntry' :: BlacklistEntry -> Maybe Text
$sel:listingTime:BlacklistEntry' :: BlacklistEntry -> Maybe POSIX
$sel:description:BlacklistEntry' :: BlacklistEntry -> Maybe Text
..} =
    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 POSIX
listingTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
rblName