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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(SuppressionListDestination -> SuppressionListDestination -> Bool)
-> (SuppressionListDestination
    -> SuppressionListDestination -> Bool)
-> Eq SuppressionListDestination
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]
(Int -> ReadS SuppressionListDestination)
-> ReadS [SuppressionListDestination]
-> ReadPrec SuppressionListDestination
-> ReadPrec [SuppressionListDestination]
-> Read 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
(Int -> SuppressionListDestination -> ShowS)
-> (SuppressionListDestination -> String)
-> ([SuppressionListDestination] -> ShowS)
-> Show SuppressionListDestination
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.
 SuppressionListDestination -> Rep SuppressionListDestination x)
-> (forall x.
    Rep SuppressionListDestination x -> SuppressionListDestination)
-> Generic SuppressionListDestination
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' :: SuppressionListImportAction -> SuppressionListDestination
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 :: (SuppressionListImportAction -> f SuppressionListImportAction)
-> SuppressionListDestination -> f SuppressionListDestination
suppressionListDestination_suppressionListImportAction = (SuppressionListDestination -> SuppressionListImportAction)
-> (SuppressionListDestination
    -> SuppressionListImportAction -> SuppressionListDestination)
-> Lens
     SuppressionListDestination
     SuppressionListDestination
     SuppressionListImportAction
     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 Core.FromJSON SuppressionListDestination where
  parseJSON :: Value -> Parser SuppressionListDestination
parseJSON =
    String
-> (Object -> Parser SuppressionListDestination)
-> Value
-> Parser SuppressionListDestination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SuppressionListDestination"
      ( \Object
x ->
          SuppressionListImportAction -> SuppressionListDestination
SuppressionListDestination'
            (SuppressionListImportAction -> SuppressionListDestination)
-> Parser SuppressionListImportAction
-> Parser SuppressionListDestination
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser SuppressionListImportAction
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SuppressionListImportAction")
      )

instance Prelude.Hashable SuppressionListDestination

instance Prelude.NFData SuppressionListDestination

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