{-# 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.PinpointDestination
-- 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.PinpointDestination where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that defines an Amazon Pinpoint project destination for email
-- events. You can send email event data to a Amazon Pinpoint project to
-- view metrics using the Transactional Messaging dashboards that are built
-- in to Amazon Pinpoint. For more information, see
-- <https://docs.aws.amazon.com/pinpoint/latest/userguide/analytics-transactional-messages.html Transactional Messaging Charts>
-- in the /Amazon Pinpoint User Guide/.
--
-- /See:/ 'newPinpointDestination' smart constructor.
data PinpointDestination = PinpointDestination'
  { -- | The Amazon Resource Name (ARN) of the Amazon Pinpoint project to send
    -- email events to.
    PinpointDestination -> Maybe Text
applicationArn :: Prelude.Maybe Prelude.Text
  }
  deriving (PinpointDestination -> PinpointDestination -> Bool
(PinpointDestination -> PinpointDestination -> Bool)
-> (PinpointDestination -> PinpointDestination -> Bool)
-> Eq PinpointDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PinpointDestination -> PinpointDestination -> Bool
$c/= :: PinpointDestination -> PinpointDestination -> Bool
== :: PinpointDestination -> PinpointDestination -> Bool
$c== :: PinpointDestination -> PinpointDestination -> Bool
Prelude.Eq, ReadPrec [PinpointDestination]
ReadPrec PinpointDestination
Int -> ReadS PinpointDestination
ReadS [PinpointDestination]
(Int -> ReadS PinpointDestination)
-> ReadS [PinpointDestination]
-> ReadPrec PinpointDestination
-> ReadPrec [PinpointDestination]
-> Read PinpointDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PinpointDestination]
$creadListPrec :: ReadPrec [PinpointDestination]
readPrec :: ReadPrec PinpointDestination
$creadPrec :: ReadPrec PinpointDestination
readList :: ReadS [PinpointDestination]
$creadList :: ReadS [PinpointDestination]
readsPrec :: Int -> ReadS PinpointDestination
$creadsPrec :: Int -> ReadS PinpointDestination
Prelude.Read, Int -> PinpointDestination -> ShowS
[PinpointDestination] -> ShowS
PinpointDestination -> String
(Int -> PinpointDestination -> ShowS)
-> (PinpointDestination -> String)
-> ([PinpointDestination] -> ShowS)
-> Show PinpointDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PinpointDestination] -> ShowS
$cshowList :: [PinpointDestination] -> ShowS
show :: PinpointDestination -> String
$cshow :: PinpointDestination -> String
showsPrec :: Int -> PinpointDestination -> ShowS
$cshowsPrec :: Int -> PinpointDestination -> ShowS
Prelude.Show, (forall x. PinpointDestination -> Rep PinpointDestination x)
-> (forall x. Rep PinpointDestination x -> PinpointDestination)
-> Generic PinpointDestination
forall x. Rep PinpointDestination x -> PinpointDestination
forall x. PinpointDestination -> Rep PinpointDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PinpointDestination x -> PinpointDestination
$cfrom :: forall x. PinpointDestination -> Rep PinpointDestination x
Prelude.Generic)

-- |
-- Create a value of 'PinpointDestination' 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:
--
-- 'applicationArn', 'pinpointDestination_applicationArn' - The Amazon Resource Name (ARN) of the Amazon Pinpoint project to send
-- email events to.
newPinpointDestination ::
  PinpointDestination
newPinpointDestination :: PinpointDestination
newPinpointDestination =
  PinpointDestination' :: Maybe Text -> PinpointDestination
PinpointDestination'
    { $sel:applicationArn:PinpointDestination' :: Maybe Text
applicationArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the Amazon Pinpoint project to send
-- email events to.
pinpointDestination_applicationArn :: Lens.Lens' PinpointDestination (Prelude.Maybe Prelude.Text)
pinpointDestination_applicationArn :: (Maybe Text -> f (Maybe Text))
-> PinpointDestination -> f PinpointDestination
pinpointDestination_applicationArn = (PinpointDestination -> Maybe Text)
-> (PinpointDestination -> Maybe Text -> PinpointDestination)
-> Lens
     PinpointDestination PinpointDestination (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PinpointDestination' {Maybe Text
applicationArn :: Maybe Text
$sel:applicationArn:PinpointDestination' :: PinpointDestination -> Maybe Text
applicationArn} -> Maybe Text
applicationArn) (\s :: PinpointDestination
s@PinpointDestination' {} Maybe Text
a -> PinpointDestination
s {$sel:applicationArn:PinpointDestination' :: Maybe Text
applicationArn = Maybe Text
a} :: PinpointDestination)

instance Core.FromJSON PinpointDestination where
  parseJSON :: Value -> Parser PinpointDestination
parseJSON =
    String
-> (Object -> Parser PinpointDestination)
-> Value
-> Parser PinpointDestination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PinpointDestination"
      ( \Object
x ->
          Maybe Text -> PinpointDestination
PinpointDestination'
            (Maybe Text -> PinpointDestination)
-> Parser (Maybe Text) -> Parser PinpointDestination
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ApplicationArn")
      )

instance Prelude.Hashable PinpointDestination

instance Prelude.NFData PinpointDestination

instance Core.ToJSON PinpointDestination where
  toJSON :: PinpointDestination -> Value
toJSON PinpointDestination' {Maybe Text
applicationArn :: Maybe Text
$sel:applicationArn:PinpointDestination' :: PinpointDestination -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ApplicationArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
applicationArn
          ]
      )