{-# 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.GetSuppressedDestination
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves information about a specific email address that\'s on the
-- suppression list for your account.
module Amazonka.SESV2.GetSuppressedDestination
  ( -- * Creating a Request
    GetSuppressedDestination (..),
    newGetSuppressedDestination,

    -- * Request Lenses
    getSuppressedDestination_emailAddress,

    -- * Destructuring the Response
    GetSuppressedDestinationResponse (..),
    newGetSuppressedDestinationResponse,

    -- * Response Lenses
    getSuppressedDestinationResponse_httpStatus,
    getSuppressedDestinationResponse_suppressedDestination,
  )
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 retrieve information about an email address that\'s on the
-- suppression list for your account.
--
-- /See:/ 'newGetSuppressedDestination' smart constructor.
data GetSuppressedDestination = GetSuppressedDestination'
  { -- | The email address that\'s on the account suppression list.
    GetSuppressedDestination -> Text
emailAddress :: Prelude.Text
  }
  deriving (GetSuppressedDestination -> GetSuppressedDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSuppressedDestination -> GetSuppressedDestination -> Bool
$c/= :: GetSuppressedDestination -> GetSuppressedDestination -> Bool
== :: GetSuppressedDestination -> GetSuppressedDestination -> Bool
$c== :: GetSuppressedDestination -> GetSuppressedDestination -> Bool
Prelude.Eq, ReadPrec [GetSuppressedDestination]
ReadPrec GetSuppressedDestination
Int -> ReadS GetSuppressedDestination
ReadS [GetSuppressedDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSuppressedDestination]
$creadListPrec :: ReadPrec [GetSuppressedDestination]
readPrec :: ReadPrec GetSuppressedDestination
$creadPrec :: ReadPrec GetSuppressedDestination
readList :: ReadS [GetSuppressedDestination]
$creadList :: ReadS [GetSuppressedDestination]
readsPrec :: Int -> ReadS GetSuppressedDestination
$creadsPrec :: Int -> ReadS GetSuppressedDestination
Prelude.Read, Int -> GetSuppressedDestination -> ShowS
[GetSuppressedDestination] -> ShowS
GetSuppressedDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSuppressedDestination] -> ShowS
$cshowList :: [GetSuppressedDestination] -> ShowS
show :: GetSuppressedDestination -> String
$cshow :: GetSuppressedDestination -> String
showsPrec :: Int -> GetSuppressedDestination -> ShowS
$cshowsPrec :: Int -> GetSuppressedDestination -> ShowS
Prelude.Show, forall x.
Rep GetSuppressedDestination x -> GetSuppressedDestination
forall x.
GetSuppressedDestination -> Rep GetSuppressedDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSuppressedDestination x -> GetSuppressedDestination
$cfrom :: forall x.
GetSuppressedDestination -> Rep GetSuppressedDestination x
Prelude.Generic)

-- |
-- Create a value of 'GetSuppressedDestination' 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:
--
-- 'emailAddress', 'getSuppressedDestination_emailAddress' - The email address that\'s on the account suppression list.
newGetSuppressedDestination ::
  -- | 'emailAddress'
  Prelude.Text ->
  GetSuppressedDestination
newGetSuppressedDestination :: Text -> GetSuppressedDestination
newGetSuppressedDestination Text
pEmailAddress_ =
  GetSuppressedDestination'
    { $sel:emailAddress:GetSuppressedDestination' :: Text
emailAddress =
        Text
pEmailAddress_
    }

-- | The email address that\'s on the account suppression list.
getSuppressedDestination_emailAddress :: Lens.Lens' GetSuppressedDestination Prelude.Text
getSuppressedDestination_emailAddress :: Lens' GetSuppressedDestination Text
getSuppressedDestination_emailAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSuppressedDestination' {Text
emailAddress :: Text
$sel:emailAddress:GetSuppressedDestination' :: GetSuppressedDestination -> Text
emailAddress} -> Text
emailAddress) (\s :: GetSuppressedDestination
s@GetSuppressedDestination' {} Text
a -> GetSuppressedDestination
s {$sel:emailAddress:GetSuppressedDestination' :: Text
emailAddress = Text
a} :: GetSuppressedDestination)

instance Core.AWSRequest GetSuppressedDestination where
  type
    AWSResponse GetSuppressedDestination =
      GetSuppressedDestinationResponse
  request :: (Service -> Service)
-> GetSuppressedDestination -> Request GetSuppressedDestination
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetSuppressedDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSuppressedDestination)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> SuppressedDestination -> GetSuppressedDestinationResponse
GetSuppressedDestinationResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"SuppressedDestination")
      )

instance Prelude.Hashable GetSuppressedDestination where
  hashWithSalt :: Int -> GetSuppressedDestination -> Int
hashWithSalt Int
_salt GetSuppressedDestination' {Text
emailAddress :: Text
$sel:emailAddress:GetSuppressedDestination' :: GetSuppressedDestination -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
emailAddress

instance Prelude.NFData GetSuppressedDestination where
  rnf :: GetSuppressedDestination -> ()
rnf GetSuppressedDestination' {Text
emailAddress :: Text
$sel:emailAddress:GetSuppressedDestination' :: GetSuppressedDestination -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
emailAddress

instance Data.ToHeaders GetSuppressedDestination where
  toHeaders :: GetSuppressedDestination -> 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.ToPath GetSuppressedDestination where
  toPath :: GetSuppressedDestination -> ByteString
toPath GetSuppressedDestination' {Text
emailAddress :: Text
$sel:emailAddress:GetSuppressedDestination' :: GetSuppressedDestination -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v2/email/suppression/addresses/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
emailAddress
      ]

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

-- | Information about the suppressed email address.
--
-- /See:/ 'newGetSuppressedDestinationResponse' smart constructor.
data GetSuppressedDestinationResponse = GetSuppressedDestinationResponse'
  { -- | The response's http status code.
    GetSuppressedDestinationResponse -> Int
httpStatus :: Prelude.Int,
    -- | An object containing information about the suppressed email address.
    GetSuppressedDestinationResponse -> SuppressedDestination
suppressedDestination :: SuppressedDestination
  }
  deriving (GetSuppressedDestinationResponse
-> GetSuppressedDestinationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSuppressedDestinationResponse
-> GetSuppressedDestinationResponse -> Bool
$c/= :: GetSuppressedDestinationResponse
-> GetSuppressedDestinationResponse -> Bool
== :: GetSuppressedDestinationResponse
-> GetSuppressedDestinationResponse -> Bool
$c== :: GetSuppressedDestinationResponse
-> GetSuppressedDestinationResponse -> Bool
Prelude.Eq, ReadPrec [GetSuppressedDestinationResponse]
ReadPrec GetSuppressedDestinationResponse
Int -> ReadS GetSuppressedDestinationResponse
ReadS [GetSuppressedDestinationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSuppressedDestinationResponse]
$creadListPrec :: ReadPrec [GetSuppressedDestinationResponse]
readPrec :: ReadPrec GetSuppressedDestinationResponse
$creadPrec :: ReadPrec GetSuppressedDestinationResponse
readList :: ReadS [GetSuppressedDestinationResponse]
$creadList :: ReadS [GetSuppressedDestinationResponse]
readsPrec :: Int -> ReadS GetSuppressedDestinationResponse
$creadsPrec :: Int -> ReadS GetSuppressedDestinationResponse
Prelude.Read, Int -> GetSuppressedDestinationResponse -> ShowS
[GetSuppressedDestinationResponse] -> ShowS
GetSuppressedDestinationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSuppressedDestinationResponse] -> ShowS
$cshowList :: [GetSuppressedDestinationResponse] -> ShowS
show :: GetSuppressedDestinationResponse -> String
$cshow :: GetSuppressedDestinationResponse -> String
showsPrec :: Int -> GetSuppressedDestinationResponse -> ShowS
$cshowsPrec :: Int -> GetSuppressedDestinationResponse -> ShowS
Prelude.Show, forall x.
Rep GetSuppressedDestinationResponse x
-> GetSuppressedDestinationResponse
forall x.
GetSuppressedDestinationResponse
-> Rep GetSuppressedDestinationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSuppressedDestinationResponse x
-> GetSuppressedDestinationResponse
$cfrom :: forall x.
GetSuppressedDestinationResponse
-> Rep GetSuppressedDestinationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSuppressedDestinationResponse' 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', 'getSuppressedDestinationResponse_httpStatus' - The response's http status code.
--
-- 'suppressedDestination', 'getSuppressedDestinationResponse_suppressedDestination' - An object containing information about the suppressed email address.
newGetSuppressedDestinationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'suppressedDestination'
  SuppressedDestination ->
  GetSuppressedDestinationResponse
newGetSuppressedDestinationResponse :: Int -> SuppressedDestination -> GetSuppressedDestinationResponse
newGetSuppressedDestinationResponse
  Int
pHttpStatus_
  SuppressedDestination
pSuppressedDestination_ =
    GetSuppressedDestinationResponse'
      { $sel:httpStatus:GetSuppressedDestinationResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:suppressedDestination:GetSuppressedDestinationResponse' :: SuppressedDestination
suppressedDestination =
          SuppressedDestination
pSuppressedDestination_
      }

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

-- | An object containing information about the suppressed email address.
getSuppressedDestinationResponse_suppressedDestination :: Lens.Lens' GetSuppressedDestinationResponse SuppressedDestination
getSuppressedDestinationResponse_suppressedDestination :: Lens' GetSuppressedDestinationResponse SuppressedDestination
getSuppressedDestinationResponse_suppressedDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSuppressedDestinationResponse' {SuppressedDestination
suppressedDestination :: SuppressedDestination
$sel:suppressedDestination:GetSuppressedDestinationResponse' :: GetSuppressedDestinationResponse -> SuppressedDestination
suppressedDestination} -> SuppressedDestination
suppressedDestination) (\s :: GetSuppressedDestinationResponse
s@GetSuppressedDestinationResponse' {} SuppressedDestination
a -> GetSuppressedDestinationResponse
s {$sel:suppressedDestination:GetSuppressedDestinationResponse' :: SuppressedDestination
suppressedDestination = SuppressedDestination
a} :: GetSuppressedDestinationResponse)

instance
  Prelude.NFData
    GetSuppressedDestinationResponse
  where
  rnf :: GetSuppressedDestinationResponse -> ()
rnf GetSuppressedDestinationResponse' {Int
SuppressedDestination
suppressedDestination :: SuppressedDestination
httpStatus :: Int
$sel:suppressedDestination:GetSuppressedDestinationResponse' :: GetSuppressedDestinationResponse -> SuppressedDestination
$sel:httpStatus:GetSuppressedDestinationResponse' :: GetSuppressedDestinationResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SuppressedDestination
suppressedDestination