{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.PutConfigurationSetSuppressionOptions
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Specify the account suppression list preferences for a configuration
-- set.
module Amazonka.SESV2.PutConfigurationSetSuppressionOptions
  ( -- * Creating a Request
    PutConfigurationSetSuppressionOptions (..),
    newPutConfigurationSetSuppressionOptions,

    -- * Request Lenses
    putConfigurationSetSuppressionOptions_suppressedReasons,
    putConfigurationSetSuppressionOptions_configurationSetName,

    -- * Destructuring the Response
    PutConfigurationSetSuppressionOptionsResponse (..),
    newPutConfigurationSetSuppressionOptionsResponse,

    -- * Response Lenses
    putConfigurationSetSuppressionOptionsResponse_httpStatus,
  )
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SESV2.Types

-- | A request to change the account suppression list preferences for a
-- specific configuration set.
--
-- /See:/ 'newPutConfigurationSetSuppressionOptions' smart constructor.
data PutConfigurationSetSuppressionOptions = PutConfigurationSetSuppressionOptions'
  { -- | A list that contains the reasons that email addresses are automatically
    -- added to the suppression list for your account. This list can contain
    -- any or all of the following:
    --
    -- -   @COMPLAINT@ – Amazon SES adds an email address to the suppression
    --     list for your account when a message sent to that address results in
    --     a complaint.
    --
    -- -   @BOUNCE@ – Amazon SES adds an email address to the suppression list
    --     for your account when a message sent to that address results in a
    --     hard bounce.
    PutConfigurationSetSuppressionOptions
-> Maybe [SuppressionListReason]
suppressedReasons :: Prelude.Maybe [SuppressionListReason],
    -- | The name of the configuration set to change the suppression list
    -- preferences for.
    PutConfigurationSetSuppressionOptions -> Text
configurationSetName :: Prelude.Text
  }
  deriving (PutConfigurationSetSuppressionOptions
-> PutConfigurationSetSuppressionOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutConfigurationSetSuppressionOptions
-> PutConfigurationSetSuppressionOptions -> Bool
$c/= :: PutConfigurationSetSuppressionOptions
-> PutConfigurationSetSuppressionOptions -> Bool
== :: PutConfigurationSetSuppressionOptions
-> PutConfigurationSetSuppressionOptions -> Bool
$c== :: PutConfigurationSetSuppressionOptions
-> PutConfigurationSetSuppressionOptions -> Bool
Prelude.Eq, ReadPrec [PutConfigurationSetSuppressionOptions]
ReadPrec PutConfigurationSetSuppressionOptions
Int -> ReadS PutConfigurationSetSuppressionOptions
ReadS [PutConfigurationSetSuppressionOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutConfigurationSetSuppressionOptions]
$creadListPrec :: ReadPrec [PutConfigurationSetSuppressionOptions]
readPrec :: ReadPrec PutConfigurationSetSuppressionOptions
$creadPrec :: ReadPrec PutConfigurationSetSuppressionOptions
readList :: ReadS [PutConfigurationSetSuppressionOptions]
$creadList :: ReadS [PutConfigurationSetSuppressionOptions]
readsPrec :: Int -> ReadS PutConfigurationSetSuppressionOptions
$creadsPrec :: Int -> ReadS PutConfigurationSetSuppressionOptions
Prelude.Read, Int -> PutConfigurationSetSuppressionOptions -> ShowS
[PutConfigurationSetSuppressionOptions] -> ShowS
PutConfigurationSetSuppressionOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutConfigurationSetSuppressionOptions] -> ShowS
$cshowList :: [PutConfigurationSetSuppressionOptions] -> ShowS
show :: PutConfigurationSetSuppressionOptions -> String
$cshow :: PutConfigurationSetSuppressionOptions -> String
showsPrec :: Int -> PutConfigurationSetSuppressionOptions -> ShowS
$cshowsPrec :: Int -> PutConfigurationSetSuppressionOptions -> ShowS
Prelude.Show, forall x.
Rep PutConfigurationSetSuppressionOptions x
-> PutConfigurationSetSuppressionOptions
forall x.
PutConfigurationSetSuppressionOptions
-> Rep PutConfigurationSetSuppressionOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutConfigurationSetSuppressionOptions x
-> PutConfigurationSetSuppressionOptions
$cfrom :: forall x.
PutConfigurationSetSuppressionOptions
-> Rep PutConfigurationSetSuppressionOptions x
Prelude.Generic)

-- |
-- Create a value of 'PutConfigurationSetSuppressionOptions' 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:
--
-- 'suppressedReasons', 'putConfigurationSetSuppressionOptions_suppressedReasons' - A list that contains the reasons that email addresses are automatically
-- added to the suppression list for your account. This list can contain
-- any or all of the following:
--
-- -   @COMPLAINT@ – Amazon SES adds an email address to the suppression
--     list for your account when a message sent to that address results in
--     a complaint.
--
-- -   @BOUNCE@ – Amazon SES adds an email address to the suppression list
--     for your account when a message sent to that address results in a
--     hard bounce.
--
-- 'configurationSetName', 'putConfigurationSetSuppressionOptions_configurationSetName' - The name of the configuration set to change the suppression list
-- preferences for.
newPutConfigurationSetSuppressionOptions ::
  -- | 'configurationSetName'
  Prelude.Text ->
  PutConfigurationSetSuppressionOptions
newPutConfigurationSetSuppressionOptions :: Text -> PutConfigurationSetSuppressionOptions
newPutConfigurationSetSuppressionOptions
  Text
pConfigurationSetName_ =
    PutConfigurationSetSuppressionOptions'
      { $sel:suppressedReasons:PutConfigurationSetSuppressionOptions' :: Maybe [SuppressionListReason]
suppressedReasons =
          forall a. Maybe a
Prelude.Nothing,
        $sel:configurationSetName:PutConfigurationSetSuppressionOptions' :: Text
configurationSetName =
          Text
pConfigurationSetName_
      }

-- | A list that contains the reasons that email addresses are automatically
-- added to the suppression list for your account. This list can contain
-- any or all of the following:
--
-- -   @COMPLAINT@ – Amazon SES adds an email address to the suppression
--     list for your account when a message sent to that address results in
--     a complaint.
--
-- -   @BOUNCE@ – Amazon SES adds an email address to the suppression list
--     for your account when a message sent to that address results in a
--     hard bounce.
putConfigurationSetSuppressionOptions_suppressedReasons :: Lens.Lens' PutConfigurationSetSuppressionOptions (Prelude.Maybe [SuppressionListReason])
putConfigurationSetSuppressionOptions_suppressedReasons :: Lens'
  PutConfigurationSetSuppressionOptions
  (Maybe [SuppressionListReason])
putConfigurationSetSuppressionOptions_suppressedReasons = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutConfigurationSetSuppressionOptions' {Maybe [SuppressionListReason]
suppressedReasons :: Maybe [SuppressionListReason]
$sel:suppressedReasons:PutConfigurationSetSuppressionOptions' :: PutConfigurationSetSuppressionOptions
-> Maybe [SuppressionListReason]
suppressedReasons} -> Maybe [SuppressionListReason]
suppressedReasons) (\s :: PutConfigurationSetSuppressionOptions
s@PutConfigurationSetSuppressionOptions' {} Maybe [SuppressionListReason]
a -> PutConfigurationSetSuppressionOptions
s {$sel:suppressedReasons:PutConfigurationSetSuppressionOptions' :: Maybe [SuppressionListReason]
suppressedReasons = Maybe [SuppressionListReason]
a} :: PutConfigurationSetSuppressionOptions) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the configuration set to change the suppression list
-- preferences for.
putConfigurationSetSuppressionOptions_configurationSetName :: Lens.Lens' PutConfigurationSetSuppressionOptions Prelude.Text
putConfigurationSetSuppressionOptions_configurationSetName :: Lens' PutConfigurationSetSuppressionOptions Text
putConfigurationSetSuppressionOptions_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutConfigurationSetSuppressionOptions' {Text
configurationSetName :: Text
$sel:configurationSetName:PutConfigurationSetSuppressionOptions' :: PutConfigurationSetSuppressionOptions -> Text
configurationSetName} -> Text
configurationSetName) (\s :: PutConfigurationSetSuppressionOptions
s@PutConfigurationSetSuppressionOptions' {} Text
a -> PutConfigurationSetSuppressionOptions
s {$sel:configurationSetName:PutConfigurationSetSuppressionOptions' :: Text
configurationSetName = Text
a} :: PutConfigurationSetSuppressionOptions)

instance
  Core.AWSRequest
    PutConfigurationSetSuppressionOptions
  where
  type
    AWSResponse
      PutConfigurationSetSuppressionOptions =
      PutConfigurationSetSuppressionOptionsResponse
  request :: (Service -> Service)
-> PutConfigurationSetSuppressionOptions
-> Request PutConfigurationSetSuppressionOptions
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutConfigurationSetSuppressionOptions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse PutConfigurationSetSuppressionOptions)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutConfigurationSetSuppressionOptionsResponse
PutConfigurationSetSuppressionOptionsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    PutConfigurationSetSuppressionOptions
  where
  hashWithSalt :: Int -> PutConfigurationSetSuppressionOptions -> Int
hashWithSalt
    Int
_salt
    PutConfigurationSetSuppressionOptions' {Maybe [SuppressionListReason]
Text
configurationSetName :: Text
suppressedReasons :: Maybe [SuppressionListReason]
$sel:configurationSetName:PutConfigurationSetSuppressionOptions' :: PutConfigurationSetSuppressionOptions -> Text
$sel:suppressedReasons:PutConfigurationSetSuppressionOptions' :: PutConfigurationSetSuppressionOptions
-> Maybe [SuppressionListReason]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SuppressionListReason]
suppressedReasons
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
configurationSetName

instance
  Prelude.NFData
    PutConfigurationSetSuppressionOptions
  where
  rnf :: PutConfigurationSetSuppressionOptions -> ()
rnf PutConfigurationSetSuppressionOptions' {Maybe [SuppressionListReason]
Text
configurationSetName :: Text
suppressedReasons :: Maybe [SuppressionListReason]
$sel:configurationSetName:PutConfigurationSetSuppressionOptions' :: PutConfigurationSetSuppressionOptions -> Text
$sel:suppressedReasons:PutConfigurationSetSuppressionOptions' :: PutConfigurationSetSuppressionOptions
-> Maybe [SuppressionListReason]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SuppressionListReason]
suppressedReasons
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
configurationSetName

instance
  Data.ToHeaders
    PutConfigurationSetSuppressionOptions
  where
  toHeaders :: PutConfigurationSetSuppressionOptions -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance
  Data.ToPath
    PutConfigurationSetSuppressionOptions
  where
  toPath :: PutConfigurationSetSuppressionOptions -> ByteString
toPath PutConfigurationSetSuppressionOptions' {Maybe [SuppressionListReason]
Text
configurationSetName :: Text
suppressedReasons :: Maybe [SuppressionListReason]
$sel:configurationSetName:PutConfigurationSetSuppressionOptions' :: PutConfigurationSetSuppressionOptions -> Text
$sel:suppressedReasons:PutConfigurationSetSuppressionOptions' :: PutConfigurationSetSuppressionOptions
-> Maybe [SuppressionListReason]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v2/email/configuration-sets/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
configurationSetName,
        ByteString
"/suppression-options"
      ]

instance
  Data.ToQuery
    PutConfigurationSetSuppressionOptions
  where
  toQuery :: PutConfigurationSetSuppressionOptions -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | An HTTP 200 response if the request succeeds, or an error message if the
-- request fails.
--
-- /See:/ 'newPutConfigurationSetSuppressionOptionsResponse' smart constructor.
data PutConfigurationSetSuppressionOptionsResponse = PutConfigurationSetSuppressionOptionsResponse'
  { -- | The response's http status code.
    PutConfigurationSetSuppressionOptionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutConfigurationSetSuppressionOptionsResponse
-> PutConfigurationSetSuppressionOptionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutConfigurationSetSuppressionOptionsResponse
-> PutConfigurationSetSuppressionOptionsResponse -> Bool
$c/= :: PutConfigurationSetSuppressionOptionsResponse
-> PutConfigurationSetSuppressionOptionsResponse -> Bool
== :: PutConfigurationSetSuppressionOptionsResponse
-> PutConfigurationSetSuppressionOptionsResponse -> Bool
$c== :: PutConfigurationSetSuppressionOptionsResponse
-> PutConfigurationSetSuppressionOptionsResponse -> Bool
Prelude.Eq, ReadPrec [PutConfigurationSetSuppressionOptionsResponse]
ReadPrec PutConfigurationSetSuppressionOptionsResponse
Int -> ReadS PutConfigurationSetSuppressionOptionsResponse
ReadS [PutConfigurationSetSuppressionOptionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutConfigurationSetSuppressionOptionsResponse]
$creadListPrec :: ReadPrec [PutConfigurationSetSuppressionOptionsResponse]
readPrec :: ReadPrec PutConfigurationSetSuppressionOptionsResponse
$creadPrec :: ReadPrec PutConfigurationSetSuppressionOptionsResponse
readList :: ReadS [PutConfigurationSetSuppressionOptionsResponse]
$creadList :: ReadS [PutConfigurationSetSuppressionOptionsResponse]
readsPrec :: Int -> ReadS PutConfigurationSetSuppressionOptionsResponse
$creadsPrec :: Int -> ReadS PutConfigurationSetSuppressionOptionsResponse
Prelude.Read, Int -> PutConfigurationSetSuppressionOptionsResponse -> ShowS
[PutConfigurationSetSuppressionOptionsResponse] -> ShowS
PutConfigurationSetSuppressionOptionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutConfigurationSetSuppressionOptionsResponse] -> ShowS
$cshowList :: [PutConfigurationSetSuppressionOptionsResponse] -> ShowS
show :: PutConfigurationSetSuppressionOptionsResponse -> String
$cshow :: PutConfigurationSetSuppressionOptionsResponse -> String
showsPrec :: Int -> PutConfigurationSetSuppressionOptionsResponse -> ShowS
$cshowsPrec :: Int -> PutConfigurationSetSuppressionOptionsResponse -> ShowS
Prelude.Show, forall x.
Rep PutConfigurationSetSuppressionOptionsResponse x
-> PutConfigurationSetSuppressionOptionsResponse
forall x.
PutConfigurationSetSuppressionOptionsResponse
-> Rep PutConfigurationSetSuppressionOptionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutConfigurationSetSuppressionOptionsResponse x
-> PutConfigurationSetSuppressionOptionsResponse
$cfrom :: forall x.
PutConfigurationSetSuppressionOptionsResponse
-> Rep PutConfigurationSetSuppressionOptionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutConfigurationSetSuppressionOptionsResponse' 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:
--
-- 'httpStatus', 'putConfigurationSetSuppressionOptionsResponse_httpStatus' - The response's http status code.
newPutConfigurationSetSuppressionOptionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutConfigurationSetSuppressionOptionsResponse
newPutConfigurationSetSuppressionOptionsResponse :: Int -> PutConfigurationSetSuppressionOptionsResponse
newPutConfigurationSetSuppressionOptionsResponse
  Int
pHttpStatus_ =
    PutConfigurationSetSuppressionOptionsResponse'
      { $sel:httpStatus:PutConfigurationSetSuppressionOptionsResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | The response's http status code.
putConfigurationSetSuppressionOptionsResponse_httpStatus :: Lens.Lens' PutConfigurationSetSuppressionOptionsResponse Prelude.Int
putConfigurationSetSuppressionOptionsResponse_httpStatus :: Lens' PutConfigurationSetSuppressionOptionsResponse Int
putConfigurationSetSuppressionOptionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutConfigurationSetSuppressionOptionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutConfigurationSetSuppressionOptionsResponse' :: PutConfigurationSetSuppressionOptionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutConfigurationSetSuppressionOptionsResponse
s@PutConfigurationSetSuppressionOptionsResponse' {} Int
a -> PutConfigurationSetSuppressionOptionsResponse
s {$sel:httpStatus:PutConfigurationSetSuppressionOptionsResponse' :: Int
httpStatus = Int
a} :: PutConfigurationSetSuppressionOptionsResponse)

instance
  Prelude.NFData
    PutConfigurationSetSuppressionOptionsResponse
  where
  rnf :: PutConfigurationSetSuppressionOptionsResponse -> ()
rnf
    PutConfigurationSetSuppressionOptionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutConfigurationSetSuppressionOptionsResponse' :: PutConfigurationSetSuppressionOptionsResponse -> Int
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus