{-# 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.Pinpoint.Types.EmailChannelRequest
-- 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.Pinpoint.Types.EmailChannelRequest where

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

-- | Specifies the status and settings of the email channel for an
-- application.
--
-- /See:/ 'newEmailChannelRequest' smart constructor.
data EmailChannelRequest = EmailChannelRequest'
  { -- | Specifies whether to enable the email channel for the application.
    EmailChannelRequest -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The
    -- <https://docs.aws.amazon.com/ses/latest/APIReference/API_ConfigurationSet.html Amazon SES configuration set>
    -- that you want to apply to messages that you send through the channel.
    EmailChannelRequest -> Maybe Text
configurationSet :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the AWS Identity and Access Management (IAM) role that you
    -- want Amazon Pinpoint to use when it submits email-related event data for
    -- the channel.
    EmailChannelRequest -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | The verified email address that you want to send email from when you
    -- send email through the channel.
    EmailChannelRequest -> Text
fromAddress :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the identity, verified with Amazon
    -- Simple Email Service (Amazon SES), that you want to use when you send
    -- email through the channel.
    EmailChannelRequest -> Text
identity :: Prelude.Text
  }
  deriving (EmailChannelRequest -> EmailChannelRequest -> Bool
(EmailChannelRequest -> EmailChannelRequest -> Bool)
-> (EmailChannelRequest -> EmailChannelRequest -> Bool)
-> Eq EmailChannelRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EmailChannelRequest -> EmailChannelRequest -> Bool
$c/= :: EmailChannelRequest -> EmailChannelRequest -> Bool
== :: EmailChannelRequest -> EmailChannelRequest -> Bool
$c== :: EmailChannelRequest -> EmailChannelRequest -> Bool
Prelude.Eq, ReadPrec [EmailChannelRequest]
ReadPrec EmailChannelRequest
Int -> ReadS EmailChannelRequest
ReadS [EmailChannelRequest]
(Int -> ReadS EmailChannelRequest)
-> ReadS [EmailChannelRequest]
-> ReadPrec EmailChannelRequest
-> ReadPrec [EmailChannelRequest]
-> Read EmailChannelRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EmailChannelRequest]
$creadListPrec :: ReadPrec [EmailChannelRequest]
readPrec :: ReadPrec EmailChannelRequest
$creadPrec :: ReadPrec EmailChannelRequest
readList :: ReadS [EmailChannelRequest]
$creadList :: ReadS [EmailChannelRequest]
readsPrec :: Int -> ReadS EmailChannelRequest
$creadsPrec :: Int -> ReadS EmailChannelRequest
Prelude.Read, Int -> EmailChannelRequest -> ShowS
[EmailChannelRequest] -> ShowS
EmailChannelRequest -> String
(Int -> EmailChannelRequest -> ShowS)
-> (EmailChannelRequest -> String)
-> ([EmailChannelRequest] -> ShowS)
-> Show EmailChannelRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EmailChannelRequest] -> ShowS
$cshowList :: [EmailChannelRequest] -> ShowS
show :: EmailChannelRequest -> String
$cshow :: EmailChannelRequest -> String
showsPrec :: Int -> EmailChannelRequest -> ShowS
$cshowsPrec :: Int -> EmailChannelRequest -> ShowS
Prelude.Show, (forall x. EmailChannelRequest -> Rep EmailChannelRequest x)
-> (forall x. Rep EmailChannelRequest x -> EmailChannelRequest)
-> Generic EmailChannelRequest
forall x. Rep EmailChannelRequest x -> EmailChannelRequest
forall x. EmailChannelRequest -> Rep EmailChannelRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EmailChannelRequest x -> EmailChannelRequest
$cfrom :: forall x. EmailChannelRequest -> Rep EmailChannelRequest x
Prelude.Generic)

-- |
-- Create a value of 'EmailChannelRequest' 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:
--
-- 'enabled', 'emailChannelRequest_enabled' - Specifies whether to enable the email channel for the application.
--
-- 'configurationSet', 'emailChannelRequest_configurationSet' - The
-- <https://docs.aws.amazon.com/ses/latest/APIReference/API_ConfigurationSet.html Amazon SES configuration set>
-- that you want to apply to messages that you send through the channel.
--
-- 'roleArn', 'emailChannelRequest_roleArn' - The ARN of the AWS Identity and Access Management (IAM) role that you
-- want Amazon Pinpoint to use when it submits email-related event data for
-- the channel.
--
-- 'fromAddress', 'emailChannelRequest_fromAddress' - The verified email address that you want to send email from when you
-- send email through the channel.
--
-- 'identity', 'emailChannelRequest_identity' - The Amazon Resource Name (ARN) of the identity, verified with Amazon
-- Simple Email Service (Amazon SES), that you want to use when you send
-- email through the channel.
newEmailChannelRequest ::
  -- | 'fromAddress'
  Prelude.Text ->
  -- | 'identity'
  Prelude.Text ->
  EmailChannelRequest
newEmailChannelRequest :: Text -> Text -> EmailChannelRequest
newEmailChannelRequest Text
pFromAddress_ Text
pIdentity_ =
  EmailChannelRequest' :: Maybe Bool
-> Maybe Text -> Maybe Text -> Text -> Text -> EmailChannelRequest
EmailChannelRequest'
    { $sel:enabled:EmailChannelRequest' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationSet:EmailChannelRequest' :: Maybe Text
configurationSet = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:EmailChannelRequest' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fromAddress:EmailChannelRequest' :: Text
fromAddress = Text
pFromAddress_,
      $sel:identity:EmailChannelRequest' :: Text
identity = Text
pIdentity_
    }

-- | Specifies whether to enable the email channel for the application.
emailChannelRequest_enabled :: Lens.Lens' EmailChannelRequest (Prelude.Maybe Prelude.Bool)
emailChannelRequest_enabled :: (Maybe Bool -> f (Maybe Bool))
-> EmailChannelRequest -> f EmailChannelRequest
emailChannelRequest_enabled = (EmailChannelRequest -> Maybe Bool)
-> (EmailChannelRequest -> Maybe Bool -> EmailChannelRequest)
-> Lens
     EmailChannelRequest EmailChannelRequest (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailChannelRequest' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:EmailChannelRequest' :: EmailChannelRequest -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: EmailChannelRequest
s@EmailChannelRequest' {} Maybe Bool
a -> EmailChannelRequest
s {$sel:enabled:EmailChannelRequest' :: Maybe Bool
enabled = Maybe Bool
a} :: EmailChannelRequest)

-- | The
-- <https://docs.aws.amazon.com/ses/latest/APIReference/API_ConfigurationSet.html Amazon SES configuration set>
-- that you want to apply to messages that you send through the channel.
emailChannelRequest_configurationSet :: Lens.Lens' EmailChannelRequest (Prelude.Maybe Prelude.Text)
emailChannelRequest_configurationSet :: (Maybe Text -> f (Maybe Text))
-> EmailChannelRequest -> f EmailChannelRequest
emailChannelRequest_configurationSet = (EmailChannelRequest -> Maybe Text)
-> (EmailChannelRequest -> Maybe Text -> EmailChannelRequest)
-> Lens
     EmailChannelRequest EmailChannelRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailChannelRequest' {Maybe Text
configurationSet :: Maybe Text
$sel:configurationSet:EmailChannelRequest' :: EmailChannelRequest -> Maybe Text
configurationSet} -> Maybe Text
configurationSet) (\s :: EmailChannelRequest
s@EmailChannelRequest' {} Maybe Text
a -> EmailChannelRequest
s {$sel:configurationSet:EmailChannelRequest' :: Maybe Text
configurationSet = Maybe Text
a} :: EmailChannelRequest)

-- | The ARN of the AWS Identity and Access Management (IAM) role that you
-- want Amazon Pinpoint to use when it submits email-related event data for
-- the channel.
emailChannelRequest_roleArn :: Lens.Lens' EmailChannelRequest (Prelude.Maybe Prelude.Text)
emailChannelRequest_roleArn :: (Maybe Text -> f (Maybe Text))
-> EmailChannelRequest -> f EmailChannelRequest
emailChannelRequest_roleArn = (EmailChannelRequest -> Maybe Text)
-> (EmailChannelRequest -> Maybe Text -> EmailChannelRequest)
-> Lens
     EmailChannelRequest EmailChannelRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailChannelRequest' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:EmailChannelRequest' :: EmailChannelRequest -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: EmailChannelRequest
s@EmailChannelRequest' {} Maybe Text
a -> EmailChannelRequest
s {$sel:roleArn:EmailChannelRequest' :: Maybe Text
roleArn = Maybe Text
a} :: EmailChannelRequest)

-- | The verified email address that you want to send email from when you
-- send email through the channel.
emailChannelRequest_fromAddress :: Lens.Lens' EmailChannelRequest Prelude.Text
emailChannelRequest_fromAddress :: (Text -> f Text) -> EmailChannelRequest -> f EmailChannelRequest
emailChannelRequest_fromAddress = (EmailChannelRequest -> Text)
-> (EmailChannelRequest -> Text -> EmailChannelRequest)
-> Lens EmailChannelRequest EmailChannelRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailChannelRequest' {Text
fromAddress :: Text
$sel:fromAddress:EmailChannelRequest' :: EmailChannelRequest -> Text
fromAddress} -> Text
fromAddress) (\s :: EmailChannelRequest
s@EmailChannelRequest' {} Text
a -> EmailChannelRequest
s {$sel:fromAddress:EmailChannelRequest' :: Text
fromAddress = Text
a} :: EmailChannelRequest)

-- | The Amazon Resource Name (ARN) of the identity, verified with Amazon
-- Simple Email Service (Amazon SES), that you want to use when you send
-- email through the channel.
emailChannelRequest_identity :: Lens.Lens' EmailChannelRequest Prelude.Text
emailChannelRequest_identity :: (Text -> f Text) -> EmailChannelRequest -> f EmailChannelRequest
emailChannelRequest_identity = (EmailChannelRequest -> Text)
-> (EmailChannelRequest -> Text -> EmailChannelRequest)
-> Lens EmailChannelRequest EmailChannelRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailChannelRequest' {Text
identity :: Text
$sel:identity:EmailChannelRequest' :: EmailChannelRequest -> Text
identity} -> Text
identity) (\s :: EmailChannelRequest
s@EmailChannelRequest' {} Text
a -> EmailChannelRequest
s {$sel:identity:EmailChannelRequest' :: Text
identity = Text
a} :: EmailChannelRequest)

instance Prelude.Hashable EmailChannelRequest

instance Prelude.NFData EmailChannelRequest

instance Core.ToJSON EmailChannelRequest where
  toJSON :: EmailChannelRequest -> Value
toJSON EmailChannelRequest' {Maybe Bool
Maybe Text
Text
identity :: Text
fromAddress :: Text
roleArn :: Maybe Text
configurationSet :: Maybe Text
enabled :: Maybe Bool
$sel:identity:EmailChannelRequest' :: EmailChannelRequest -> Text
$sel:fromAddress:EmailChannelRequest' :: EmailChannelRequest -> Text
$sel:roleArn:EmailChannelRequest' :: EmailChannelRequest -> Maybe Text
$sel:configurationSet:EmailChannelRequest' :: EmailChannelRequest -> Maybe Text
$sel:enabled:EmailChannelRequest' :: EmailChannelRequest -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
            (Text
"ConfigurationSet" 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
configurationSet,
            (Text
"RoleArn" 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
roleArn,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FromAddress" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fromAddress),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Identity" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identity)
          ]
      )