{-# 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-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)
--
-- 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.Lens as Lens
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
(GetSuppressedDestination -> GetSuppressedDestination -> Bool)
-> (GetSuppressedDestination -> GetSuppressedDestination -> Bool)
-> Eq GetSuppressedDestination
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]
(Int -> ReadS GetSuppressedDestination)
-> ReadS [GetSuppressedDestination]
-> ReadPrec GetSuppressedDestination
-> ReadPrec [GetSuppressedDestination]
-> Read 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
(Int -> GetSuppressedDestination -> ShowS)
-> (GetSuppressedDestination -> String)
-> ([GetSuppressedDestination] -> ShowS)
-> Show GetSuppressedDestination
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.
 GetSuppressedDestination -> Rep GetSuppressedDestination x)
-> (forall x.
    Rep GetSuppressedDestination x -> GetSuppressedDestination)
-> Generic GetSuppressedDestination
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' :: Text -> GetSuppressedDestination
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 :: (Text -> f Text)
-> GetSuppressedDestination -> f GetSuppressedDestination
getSuppressedDestination_emailAddress = (GetSuppressedDestination -> Text)
-> (GetSuppressedDestination -> Text -> GetSuppressedDestination)
-> Lens GetSuppressedDestination GetSuppressedDestination Text Text
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 :: GetSuppressedDestination -> Request GetSuppressedDestination
request = Service
-> GetSuppressedDestination -> Request GetSuppressedDestination
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSuppressedDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSuppressedDestination)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetSuppressedDestination))
-> Logger
-> Service
-> Proxy GetSuppressedDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSuppressedDestination)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> SuppressedDestination -> GetSuppressedDestinationResponse
GetSuppressedDestinationResponse'
            (Int -> SuppressedDestination -> GetSuppressedDestinationResponse)
-> Either String Int
-> Either
     String (SuppressedDestination -> GetSuppressedDestinationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either
  String (SuppressedDestination -> GetSuppressedDestinationResponse)
-> Either String SuppressedDestination
-> Either String GetSuppressedDestinationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String SuppressedDestination
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"SuppressedDestination")
      )

instance Prelude.Hashable GetSuppressedDestination

instance Prelude.NFData GetSuppressedDestination

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

instance Core.ToPath GetSuppressedDestination where
  toPath :: GetSuppressedDestination -> ByteString
toPath GetSuppressedDestination' {Text
emailAddress :: Text
$sel:emailAddress:GetSuppressedDestination' :: GetSuppressedDestination -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v2/email/suppression/addresses/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
emailAddress
      ]

instance Core.ToQuery GetSuppressedDestination where
  toQuery :: GetSuppressedDestination -> QueryString
toQuery = QueryString -> GetSuppressedDestination -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetSuppressedDestinationResponse
 -> GetSuppressedDestinationResponse -> Bool)
-> (GetSuppressedDestinationResponse
    -> GetSuppressedDestinationResponse -> Bool)
-> Eq GetSuppressedDestinationResponse
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]
(Int -> ReadS GetSuppressedDestinationResponse)
-> ReadS [GetSuppressedDestinationResponse]
-> ReadPrec GetSuppressedDestinationResponse
-> ReadPrec [GetSuppressedDestinationResponse]
-> Read 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
(Int -> GetSuppressedDestinationResponse -> ShowS)
-> (GetSuppressedDestinationResponse -> String)
-> ([GetSuppressedDestinationResponse] -> ShowS)
-> Show GetSuppressedDestinationResponse
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.
 GetSuppressedDestinationResponse
 -> Rep GetSuppressedDestinationResponse x)
-> (forall x.
    Rep GetSuppressedDestinationResponse x
    -> GetSuppressedDestinationResponse)
-> Generic GetSuppressedDestinationResponse
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' :: Int -> SuppressedDestination -> GetSuppressedDestinationResponse
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 :: (Int -> f Int)
-> GetSuppressedDestinationResponse
-> f GetSuppressedDestinationResponse
getSuppressedDestinationResponse_httpStatus = (GetSuppressedDestinationResponse -> Int)
-> (GetSuppressedDestinationResponse
    -> Int -> GetSuppressedDestinationResponse)
-> Lens
     GetSuppressedDestinationResponse
     GetSuppressedDestinationResponse
     Int
     Int
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 :: (SuppressedDestination -> f SuppressedDestination)
-> GetSuppressedDestinationResponse
-> f GetSuppressedDestinationResponse
getSuppressedDestinationResponse_suppressedDestination = (GetSuppressedDestinationResponse -> SuppressedDestination)
-> (GetSuppressedDestinationResponse
    -> SuppressedDestination -> GetSuppressedDestinationResponse)
-> Lens
     GetSuppressedDestinationResponse
     GetSuppressedDestinationResponse
     SuppressedDestination
     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