{-# 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.GetDomainDeliverabilityCampaign
-- 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)
--
-- Retrieve all the deliverability data for a specific campaign. This data
-- is available for a campaign only if the campaign sent email by using a
-- domain that the Deliverability dashboard is enabled for.
module Amazonka.SESV2.GetDomainDeliverabilityCampaign
  ( -- * Creating a Request
    GetDomainDeliverabilityCampaign (..),
    newGetDomainDeliverabilityCampaign,

    -- * Request Lenses
    getDomainDeliverabilityCampaign_campaignId,

    -- * Destructuring the Response
    GetDomainDeliverabilityCampaignResponse (..),
    newGetDomainDeliverabilityCampaignResponse,

    -- * Response Lenses
    getDomainDeliverabilityCampaignResponse_httpStatus,
    getDomainDeliverabilityCampaignResponse_domainDeliverabilityCampaign,
  )
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

-- | Retrieve all the deliverability data for a specific campaign. This data
-- is available for a campaign only if the campaign sent email by using a
-- domain that the Deliverability dashboard is enabled for
-- (@PutDeliverabilityDashboardOption@ operation).
--
-- /See:/ 'newGetDomainDeliverabilityCampaign' smart constructor.
data GetDomainDeliverabilityCampaign = GetDomainDeliverabilityCampaign'
  { -- | The unique identifier for the campaign. The Deliverability dashboard
    -- automatically generates and assigns this identifier to a campaign.
    GetDomainDeliverabilityCampaign -> Text
campaignId :: Prelude.Text
  }
  deriving (GetDomainDeliverabilityCampaign
-> GetDomainDeliverabilityCampaign -> Bool
(GetDomainDeliverabilityCampaign
 -> GetDomainDeliverabilityCampaign -> Bool)
-> (GetDomainDeliverabilityCampaign
    -> GetDomainDeliverabilityCampaign -> Bool)
-> Eq GetDomainDeliverabilityCampaign
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDomainDeliverabilityCampaign
-> GetDomainDeliverabilityCampaign -> Bool
$c/= :: GetDomainDeliverabilityCampaign
-> GetDomainDeliverabilityCampaign -> Bool
== :: GetDomainDeliverabilityCampaign
-> GetDomainDeliverabilityCampaign -> Bool
$c== :: GetDomainDeliverabilityCampaign
-> GetDomainDeliverabilityCampaign -> Bool
Prelude.Eq, ReadPrec [GetDomainDeliverabilityCampaign]
ReadPrec GetDomainDeliverabilityCampaign
Int -> ReadS GetDomainDeliverabilityCampaign
ReadS [GetDomainDeliverabilityCampaign]
(Int -> ReadS GetDomainDeliverabilityCampaign)
-> ReadS [GetDomainDeliverabilityCampaign]
-> ReadPrec GetDomainDeliverabilityCampaign
-> ReadPrec [GetDomainDeliverabilityCampaign]
-> Read GetDomainDeliverabilityCampaign
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDomainDeliverabilityCampaign]
$creadListPrec :: ReadPrec [GetDomainDeliverabilityCampaign]
readPrec :: ReadPrec GetDomainDeliverabilityCampaign
$creadPrec :: ReadPrec GetDomainDeliverabilityCampaign
readList :: ReadS [GetDomainDeliverabilityCampaign]
$creadList :: ReadS [GetDomainDeliverabilityCampaign]
readsPrec :: Int -> ReadS GetDomainDeliverabilityCampaign
$creadsPrec :: Int -> ReadS GetDomainDeliverabilityCampaign
Prelude.Read, Int -> GetDomainDeliverabilityCampaign -> ShowS
[GetDomainDeliverabilityCampaign] -> ShowS
GetDomainDeliverabilityCampaign -> String
(Int -> GetDomainDeliverabilityCampaign -> ShowS)
-> (GetDomainDeliverabilityCampaign -> String)
-> ([GetDomainDeliverabilityCampaign] -> ShowS)
-> Show GetDomainDeliverabilityCampaign
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDomainDeliverabilityCampaign] -> ShowS
$cshowList :: [GetDomainDeliverabilityCampaign] -> ShowS
show :: GetDomainDeliverabilityCampaign -> String
$cshow :: GetDomainDeliverabilityCampaign -> String
showsPrec :: Int -> GetDomainDeliverabilityCampaign -> ShowS
$cshowsPrec :: Int -> GetDomainDeliverabilityCampaign -> ShowS
Prelude.Show, (forall x.
 GetDomainDeliverabilityCampaign
 -> Rep GetDomainDeliverabilityCampaign x)
-> (forall x.
    Rep GetDomainDeliverabilityCampaign x
    -> GetDomainDeliverabilityCampaign)
-> Generic GetDomainDeliverabilityCampaign
forall x.
Rep GetDomainDeliverabilityCampaign x
-> GetDomainDeliverabilityCampaign
forall x.
GetDomainDeliverabilityCampaign
-> Rep GetDomainDeliverabilityCampaign x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDomainDeliverabilityCampaign x
-> GetDomainDeliverabilityCampaign
$cfrom :: forall x.
GetDomainDeliverabilityCampaign
-> Rep GetDomainDeliverabilityCampaign x
Prelude.Generic)

-- |
-- Create a value of 'GetDomainDeliverabilityCampaign' 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:
--
-- 'campaignId', 'getDomainDeliverabilityCampaign_campaignId' - The unique identifier for the campaign. The Deliverability dashboard
-- automatically generates and assigns this identifier to a campaign.
newGetDomainDeliverabilityCampaign ::
  -- | 'campaignId'
  Prelude.Text ->
  GetDomainDeliverabilityCampaign
newGetDomainDeliverabilityCampaign :: Text -> GetDomainDeliverabilityCampaign
newGetDomainDeliverabilityCampaign Text
pCampaignId_ =
  GetDomainDeliverabilityCampaign' :: Text -> GetDomainDeliverabilityCampaign
GetDomainDeliverabilityCampaign'
    { $sel:campaignId:GetDomainDeliverabilityCampaign' :: Text
campaignId =
        Text
pCampaignId_
    }

-- | The unique identifier for the campaign. The Deliverability dashboard
-- automatically generates and assigns this identifier to a campaign.
getDomainDeliverabilityCampaign_campaignId :: Lens.Lens' GetDomainDeliverabilityCampaign Prelude.Text
getDomainDeliverabilityCampaign_campaignId :: (Text -> f Text)
-> GetDomainDeliverabilityCampaign
-> f GetDomainDeliverabilityCampaign
getDomainDeliverabilityCampaign_campaignId = (GetDomainDeliverabilityCampaign -> Text)
-> (GetDomainDeliverabilityCampaign
    -> Text -> GetDomainDeliverabilityCampaign)
-> Lens
     GetDomainDeliverabilityCampaign
     GetDomainDeliverabilityCampaign
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDomainDeliverabilityCampaign' {Text
campaignId :: Text
$sel:campaignId:GetDomainDeliverabilityCampaign' :: GetDomainDeliverabilityCampaign -> Text
campaignId} -> Text
campaignId) (\s :: GetDomainDeliverabilityCampaign
s@GetDomainDeliverabilityCampaign' {} Text
a -> GetDomainDeliverabilityCampaign
s {$sel:campaignId:GetDomainDeliverabilityCampaign' :: Text
campaignId = Text
a} :: GetDomainDeliverabilityCampaign)

instance
  Core.AWSRequest
    GetDomainDeliverabilityCampaign
  where
  type
    AWSResponse GetDomainDeliverabilityCampaign =
      GetDomainDeliverabilityCampaignResponse
  request :: GetDomainDeliverabilityCampaign
-> Request GetDomainDeliverabilityCampaign
request = Service
-> GetDomainDeliverabilityCampaign
-> Request GetDomainDeliverabilityCampaign
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetDomainDeliverabilityCampaign
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetDomainDeliverabilityCampaign)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetDomainDeliverabilityCampaign))
-> Logger
-> Service
-> Proxy GetDomainDeliverabilityCampaign
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetDomainDeliverabilityCampaign)))
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
-> DomainDeliverabilityCampaign
-> GetDomainDeliverabilityCampaignResponse
GetDomainDeliverabilityCampaignResponse'
            (Int
 -> DomainDeliverabilityCampaign
 -> GetDomainDeliverabilityCampaignResponse)
-> Either String Int
-> Either
     String
     (DomainDeliverabilityCampaign
      -> GetDomainDeliverabilityCampaignResponse)
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
  (DomainDeliverabilityCampaign
   -> GetDomainDeliverabilityCampaignResponse)
-> Either String DomainDeliverabilityCampaign
-> Either String GetDomainDeliverabilityCampaignResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String DomainDeliverabilityCampaign
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"DomainDeliverabilityCampaign")
      )

instance
  Prelude.Hashable
    GetDomainDeliverabilityCampaign

instance
  Prelude.NFData
    GetDomainDeliverabilityCampaign

instance
  Core.ToHeaders
    GetDomainDeliverabilityCampaign
  where
  toHeaders :: GetDomainDeliverabilityCampaign -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetDomainDeliverabilityCampaign -> 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 GetDomainDeliverabilityCampaign where
  toPath :: GetDomainDeliverabilityCampaign -> ByteString
toPath GetDomainDeliverabilityCampaign' {Text
campaignId :: Text
$sel:campaignId:GetDomainDeliverabilityCampaign' :: GetDomainDeliverabilityCampaign -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v2/email/deliverability-dashboard/campaigns/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
campaignId
      ]

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

-- | An object that contains all the deliverability data for a specific
-- campaign. This data is available for a campaign only if the campaign
-- sent email by using a domain that the Deliverability dashboard is
-- enabled for.
--
-- /See:/ 'newGetDomainDeliverabilityCampaignResponse' smart constructor.
data GetDomainDeliverabilityCampaignResponse = GetDomainDeliverabilityCampaignResponse'
  { -- | The response's http status code.
    GetDomainDeliverabilityCampaignResponse -> Int
httpStatus :: Prelude.Int,
    -- | An object that contains the deliverability data for the campaign.
    GetDomainDeliverabilityCampaignResponse
-> DomainDeliverabilityCampaign
domainDeliverabilityCampaign :: DomainDeliverabilityCampaign
  }
  deriving (GetDomainDeliverabilityCampaignResponse
-> GetDomainDeliverabilityCampaignResponse -> Bool
(GetDomainDeliverabilityCampaignResponse
 -> GetDomainDeliverabilityCampaignResponse -> Bool)
-> (GetDomainDeliverabilityCampaignResponse
    -> GetDomainDeliverabilityCampaignResponse -> Bool)
-> Eq GetDomainDeliverabilityCampaignResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDomainDeliverabilityCampaignResponse
-> GetDomainDeliverabilityCampaignResponse -> Bool
$c/= :: GetDomainDeliverabilityCampaignResponse
-> GetDomainDeliverabilityCampaignResponse -> Bool
== :: GetDomainDeliverabilityCampaignResponse
-> GetDomainDeliverabilityCampaignResponse -> Bool
$c== :: GetDomainDeliverabilityCampaignResponse
-> GetDomainDeliverabilityCampaignResponse -> Bool
Prelude.Eq, ReadPrec [GetDomainDeliverabilityCampaignResponse]
ReadPrec GetDomainDeliverabilityCampaignResponse
Int -> ReadS GetDomainDeliverabilityCampaignResponse
ReadS [GetDomainDeliverabilityCampaignResponse]
(Int -> ReadS GetDomainDeliverabilityCampaignResponse)
-> ReadS [GetDomainDeliverabilityCampaignResponse]
-> ReadPrec GetDomainDeliverabilityCampaignResponse
-> ReadPrec [GetDomainDeliverabilityCampaignResponse]
-> Read GetDomainDeliverabilityCampaignResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDomainDeliverabilityCampaignResponse]
$creadListPrec :: ReadPrec [GetDomainDeliverabilityCampaignResponse]
readPrec :: ReadPrec GetDomainDeliverabilityCampaignResponse
$creadPrec :: ReadPrec GetDomainDeliverabilityCampaignResponse
readList :: ReadS [GetDomainDeliverabilityCampaignResponse]
$creadList :: ReadS [GetDomainDeliverabilityCampaignResponse]
readsPrec :: Int -> ReadS GetDomainDeliverabilityCampaignResponse
$creadsPrec :: Int -> ReadS GetDomainDeliverabilityCampaignResponse
Prelude.Read, Int -> GetDomainDeliverabilityCampaignResponse -> ShowS
[GetDomainDeliverabilityCampaignResponse] -> ShowS
GetDomainDeliverabilityCampaignResponse -> String
(Int -> GetDomainDeliverabilityCampaignResponse -> ShowS)
-> (GetDomainDeliverabilityCampaignResponse -> String)
-> ([GetDomainDeliverabilityCampaignResponse] -> ShowS)
-> Show GetDomainDeliverabilityCampaignResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDomainDeliverabilityCampaignResponse] -> ShowS
$cshowList :: [GetDomainDeliverabilityCampaignResponse] -> ShowS
show :: GetDomainDeliverabilityCampaignResponse -> String
$cshow :: GetDomainDeliverabilityCampaignResponse -> String
showsPrec :: Int -> GetDomainDeliverabilityCampaignResponse -> ShowS
$cshowsPrec :: Int -> GetDomainDeliverabilityCampaignResponse -> ShowS
Prelude.Show, (forall x.
 GetDomainDeliverabilityCampaignResponse
 -> Rep GetDomainDeliverabilityCampaignResponse x)
-> (forall x.
    Rep GetDomainDeliverabilityCampaignResponse x
    -> GetDomainDeliverabilityCampaignResponse)
-> Generic GetDomainDeliverabilityCampaignResponse
forall x.
Rep GetDomainDeliverabilityCampaignResponse x
-> GetDomainDeliverabilityCampaignResponse
forall x.
GetDomainDeliverabilityCampaignResponse
-> Rep GetDomainDeliverabilityCampaignResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDomainDeliverabilityCampaignResponse x
-> GetDomainDeliverabilityCampaignResponse
$cfrom :: forall x.
GetDomainDeliverabilityCampaignResponse
-> Rep GetDomainDeliverabilityCampaignResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetDomainDeliverabilityCampaignResponse' 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', 'getDomainDeliverabilityCampaignResponse_httpStatus' - The response's http status code.
--
-- 'domainDeliverabilityCampaign', 'getDomainDeliverabilityCampaignResponse_domainDeliverabilityCampaign' - An object that contains the deliverability data for the campaign.
newGetDomainDeliverabilityCampaignResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'domainDeliverabilityCampaign'
  DomainDeliverabilityCampaign ->
  GetDomainDeliverabilityCampaignResponse
newGetDomainDeliverabilityCampaignResponse :: Int
-> DomainDeliverabilityCampaign
-> GetDomainDeliverabilityCampaignResponse
newGetDomainDeliverabilityCampaignResponse
  Int
pHttpStatus_
  DomainDeliverabilityCampaign
pDomainDeliverabilityCampaign_ =
    GetDomainDeliverabilityCampaignResponse' :: Int
-> DomainDeliverabilityCampaign
-> GetDomainDeliverabilityCampaignResponse
GetDomainDeliverabilityCampaignResponse'
      { $sel:httpStatus:GetDomainDeliverabilityCampaignResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:domainDeliverabilityCampaign:GetDomainDeliverabilityCampaignResponse' :: DomainDeliverabilityCampaign
domainDeliverabilityCampaign =
          DomainDeliverabilityCampaign
pDomainDeliverabilityCampaign_
      }

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

-- | An object that contains the deliverability data for the campaign.
getDomainDeliverabilityCampaignResponse_domainDeliverabilityCampaign :: Lens.Lens' GetDomainDeliverabilityCampaignResponse DomainDeliverabilityCampaign
getDomainDeliverabilityCampaignResponse_domainDeliverabilityCampaign :: (DomainDeliverabilityCampaign -> f DomainDeliverabilityCampaign)
-> GetDomainDeliverabilityCampaignResponse
-> f GetDomainDeliverabilityCampaignResponse
getDomainDeliverabilityCampaignResponse_domainDeliverabilityCampaign = (GetDomainDeliverabilityCampaignResponse
 -> DomainDeliverabilityCampaign)
-> (GetDomainDeliverabilityCampaignResponse
    -> DomainDeliverabilityCampaign
    -> GetDomainDeliverabilityCampaignResponse)
-> Lens
     GetDomainDeliverabilityCampaignResponse
     GetDomainDeliverabilityCampaignResponse
     DomainDeliverabilityCampaign
     DomainDeliverabilityCampaign
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDomainDeliverabilityCampaignResponse' {DomainDeliverabilityCampaign
domainDeliverabilityCampaign :: DomainDeliverabilityCampaign
$sel:domainDeliverabilityCampaign:GetDomainDeliverabilityCampaignResponse' :: GetDomainDeliverabilityCampaignResponse
-> DomainDeliverabilityCampaign
domainDeliverabilityCampaign} -> DomainDeliverabilityCampaign
domainDeliverabilityCampaign) (\s :: GetDomainDeliverabilityCampaignResponse
s@GetDomainDeliverabilityCampaignResponse' {} DomainDeliverabilityCampaign
a -> GetDomainDeliverabilityCampaignResponse
s {$sel:domainDeliverabilityCampaign:GetDomainDeliverabilityCampaignResponse' :: DomainDeliverabilityCampaign
domainDeliverabilityCampaign = DomainDeliverabilityCampaign
a} :: GetDomainDeliverabilityCampaignResponse)

instance
  Prelude.NFData
    GetDomainDeliverabilityCampaignResponse