{-# 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.SuppressionListDestination
-- 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.SuppressionListDestination 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
import Amazonka.SESV2.Types.SuppressionListImportAction

-- | An object that contains details about the action of suppression list.
--
-- /See:/ 'newSuppressionListDestination' smart constructor.
data SuppressionListDestination = SuppressionListDestination'
  { -- | The type of action to perform on the address. The following are possible
    -- values:
    --
    -- -   PUT: add the addresses to the suppression list. If the record
    --     already exists, it will override it with the new value.
    --
    -- -   DELETE: remove the addresses from the suppression list.
    SuppressionListDestination -> SuppressionListImportAction
suppressionListImportAction :: SuppressionListImportAction
  }
  deriving (SuppressionListDestination -> SuppressionListDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuppressionListDestination -> SuppressionListDestination -> Bool
$c/= :: SuppressionListDestination -> SuppressionListDestination -> Bool
== :: SuppressionListDestination -> SuppressionListDestination -> Bool
$c== :: SuppressionListDestination -> SuppressionListDestination -> Bool
Prelude.Eq, ReadPrec [SuppressionListDestination]
ReadPrec SuppressionListDestination
Int -> ReadS SuppressionListDestination
ReadS [SuppressionListDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuppressionListDestination]
$creadListPrec :: ReadPrec [SuppressionListDestination]
readPrec :: ReadPrec SuppressionListDestination
$creadPrec :: ReadPrec SuppressionListDestination
readList :: ReadS [SuppressionListDestination]
$creadList :: ReadS [SuppressionListDestination]
readsPrec :: Int -> ReadS SuppressionListDestination
$creadsPrec :: Int -> ReadS SuppressionListDestination
Prelude.Read, Int -> SuppressionListDestination -> ShowS
[SuppressionListDestination] -> ShowS
SuppressionListDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuppressionListDestination] -> ShowS
$cshowList :: [SuppressionListDestination] -> ShowS
show :: SuppressionListDestination -> String
$cshow :: SuppressionListDestination -> String
showsPrec :: Int -> SuppressionListDestination -> ShowS
$cshowsPrec :: Int -> SuppressionListDestination -> ShowS
Prelude.Show, forall x.
Rep SuppressionListDestination x -> SuppressionListDestination
forall x.
SuppressionListDestination -> Rep SuppressionListDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SuppressionListDestination x -> SuppressionListDestination
$cfrom :: forall x.
SuppressionListDestination -> Rep SuppressionListDestination x
Prelude.Generic)

-- |
-- Create a value of 'SuppressionListDestination' 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:
--
-- 'suppressionListImportAction', 'suppressionListDestination_suppressionListImportAction' - The type of action to perform on the address. The following are possible
-- values:
--
-- -   PUT: add the addresses to the suppression list. If the record
--     already exists, it will override it with the new value.
--
-- -   DELETE: remove the addresses from the suppression list.
newSuppressionListDestination ::
  -- | 'suppressionListImportAction'
  SuppressionListImportAction ->
  SuppressionListDestination
newSuppressionListDestination :: SuppressionListImportAction -> SuppressionListDestination
newSuppressionListDestination
  SuppressionListImportAction
pSuppressionListImportAction_ =
    SuppressionListDestination'
      { $sel:suppressionListImportAction:SuppressionListDestination' :: SuppressionListImportAction
suppressionListImportAction =
          SuppressionListImportAction
pSuppressionListImportAction_
      }

-- | The type of action to perform on the address. The following are possible
-- values:
--
-- -   PUT: add the addresses to the suppression list. If the record
--     already exists, it will override it with the new value.
--
-- -   DELETE: remove the addresses from the suppression list.
suppressionListDestination_suppressionListImportAction :: Lens.Lens' SuppressionListDestination SuppressionListImportAction
suppressionListDestination_suppressionListImportAction :: Lens' SuppressionListDestination SuppressionListImportAction
suppressionListDestination_suppressionListImportAction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuppressionListDestination' {SuppressionListImportAction
suppressionListImportAction :: SuppressionListImportAction
$sel:suppressionListImportAction:SuppressionListDestination' :: SuppressionListDestination -> SuppressionListImportAction
suppressionListImportAction} -> SuppressionListImportAction
suppressionListImportAction) (\s :: SuppressionListDestination
s@SuppressionListDestination' {} SuppressionListImportAction
a -> SuppressionListDestination
s {$sel:suppressionListImportAction:SuppressionListDestination' :: SuppressionListImportAction
suppressionListImportAction = SuppressionListImportAction
a} :: SuppressionListDestination)

instance Data.FromJSON SuppressionListDestination where
  parseJSON :: Value -> Parser SuppressionListDestination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SuppressionListDestination"
      ( \Object
x ->
          SuppressionListImportAction -> SuppressionListDestination
SuppressionListDestination'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SuppressionListImportAction")
      )

instance Prelude.Hashable SuppressionListDestination where
  hashWithSalt :: Int -> SuppressionListDestination -> Int
hashWithSalt Int
_salt SuppressionListDestination' {SuppressionListImportAction
suppressionListImportAction :: SuppressionListImportAction
$sel:suppressionListImportAction:SuppressionListDestination' :: SuppressionListDestination -> SuppressionListImportAction
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SuppressionListImportAction
suppressionListImportAction

instance Prelude.NFData SuppressionListDestination where
  rnf :: SuppressionListDestination -> ()
rnf SuppressionListDestination' {SuppressionListImportAction
suppressionListImportAction :: SuppressionListImportAction
$sel:suppressionListImportAction:SuppressionListDestination' :: SuppressionListDestination -> SuppressionListImportAction
..} =
    forall a. NFData a => a -> ()
Prelude.rnf SuppressionListImportAction
suppressionListImportAction

instance Data.ToJSON SuppressionListDestination where
  toJSON :: SuppressionListDestination -> Value
toJSON SuppressionListDestination' {SuppressionListImportAction
suppressionListImportAction :: SuppressionListImportAction
$sel:suppressionListImportAction:SuppressionListDestination' :: SuppressionListDestination -> SuppressionListImportAction
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"SuppressionListImportAction"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SuppressionListImportAction
suppressionListImportAction
              )
          ]
      )