{-# 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.SES.Types.DeliveryOptions
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SES.Types.DeliveryOptions 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 Amazonka.SES.Types.TlsPolicy

-- | Specifies whether messages that use the configuration set are required
-- to use Transport Layer Security (TLS).
--
-- /See:/ 'newDeliveryOptions' smart constructor.
data DeliveryOptions = DeliveryOptions'
  { -- | Specifies whether messages that use the configuration set are required
    -- to use Transport Layer Security (TLS). If the value is @Require@,
    -- messages are only delivered if a TLS connection can be established. If
    -- the value is @Optional@, messages can be delivered in plain text if a
    -- TLS connection can\'t be established.
    DeliveryOptions -> Maybe TlsPolicy
tlsPolicy :: Prelude.Maybe TlsPolicy
  }
  deriving (DeliveryOptions -> DeliveryOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeliveryOptions -> DeliveryOptions -> Bool
$c/= :: DeliveryOptions -> DeliveryOptions -> Bool
== :: DeliveryOptions -> DeliveryOptions -> Bool
$c== :: DeliveryOptions -> DeliveryOptions -> Bool
Prelude.Eq, ReadPrec [DeliveryOptions]
ReadPrec DeliveryOptions
Int -> ReadS DeliveryOptions
ReadS [DeliveryOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeliveryOptions]
$creadListPrec :: ReadPrec [DeliveryOptions]
readPrec :: ReadPrec DeliveryOptions
$creadPrec :: ReadPrec DeliveryOptions
readList :: ReadS [DeliveryOptions]
$creadList :: ReadS [DeliveryOptions]
readsPrec :: Int -> ReadS DeliveryOptions
$creadsPrec :: Int -> ReadS DeliveryOptions
Prelude.Read, Int -> DeliveryOptions -> ShowS
[DeliveryOptions] -> ShowS
DeliveryOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeliveryOptions] -> ShowS
$cshowList :: [DeliveryOptions] -> ShowS
show :: DeliveryOptions -> String
$cshow :: DeliveryOptions -> String
showsPrec :: Int -> DeliveryOptions -> ShowS
$cshowsPrec :: Int -> DeliveryOptions -> ShowS
Prelude.Show, forall x. Rep DeliveryOptions x -> DeliveryOptions
forall x. DeliveryOptions -> Rep DeliveryOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeliveryOptions x -> DeliveryOptions
$cfrom :: forall x. DeliveryOptions -> Rep DeliveryOptions x
Prelude.Generic)

-- |
-- Create a value of 'DeliveryOptions' 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:
--
-- 'tlsPolicy', 'deliveryOptions_tlsPolicy' - Specifies whether messages that use the configuration set are required
-- to use Transport Layer Security (TLS). If the value is @Require@,
-- messages are only delivered if a TLS connection can be established. If
-- the value is @Optional@, messages can be delivered in plain text if a
-- TLS connection can\'t be established.
newDeliveryOptions ::
  DeliveryOptions
newDeliveryOptions :: DeliveryOptions
newDeliveryOptions =
  DeliveryOptions' {$sel:tlsPolicy:DeliveryOptions' :: Maybe TlsPolicy
tlsPolicy = forall a. Maybe a
Prelude.Nothing}

-- | Specifies whether messages that use the configuration set are required
-- to use Transport Layer Security (TLS). If the value is @Require@,
-- messages are only delivered if a TLS connection can be established. If
-- the value is @Optional@, messages can be delivered in plain text if a
-- TLS connection can\'t be established.
deliveryOptions_tlsPolicy :: Lens.Lens' DeliveryOptions (Prelude.Maybe TlsPolicy)
deliveryOptions_tlsPolicy :: Lens' DeliveryOptions (Maybe TlsPolicy)
deliveryOptions_tlsPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliveryOptions' {Maybe TlsPolicy
tlsPolicy :: Maybe TlsPolicy
$sel:tlsPolicy:DeliveryOptions' :: DeliveryOptions -> Maybe TlsPolicy
tlsPolicy} -> Maybe TlsPolicy
tlsPolicy) (\s :: DeliveryOptions
s@DeliveryOptions' {} Maybe TlsPolicy
a -> DeliveryOptions
s {$sel:tlsPolicy:DeliveryOptions' :: Maybe TlsPolicy
tlsPolicy = Maybe TlsPolicy
a} :: DeliveryOptions)

instance Data.FromXML DeliveryOptions where
  parseXML :: [Node] -> Either String DeliveryOptions
parseXML [Node]
x =
    Maybe TlsPolicy -> DeliveryOptions
DeliveryOptions'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"TlsPolicy")

instance Prelude.Hashable DeliveryOptions where
  hashWithSalt :: Int -> DeliveryOptions -> Int
hashWithSalt Int
_salt DeliveryOptions' {Maybe TlsPolicy
tlsPolicy :: Maybe TlsPolicy
$sel:tlsPolicy:DeliveryOptions' :: DeliveryOptions -> Maybe TlsPolicy
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TlsPolicy
tlsPolicy

instance Prelude.NFData DeliveryOptions where
  rnf :: DeliveryOptions -> ()
rnf DeliveryOptions' {Maybe TlsPolicy
tlsPolicy :: Maybe TlsPolicy
$sel:tlsPolicy:DeliveryOptions' :: DeliveryOptions -> Maybe TlsPolicy
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe TlsPolicy
tlsPolicy

instance Data.ToQuery DeliveryOptions where
  toQuery :: DeliveryOptions -> QueryString
toQuery DeliveryOptions' {Maybe TlsPolicy
tlsPolicy :: Maybe TlsPolicy
$sel:tlsPolicy:DeliveryOptions' :: DeliveryOptions -> Maybe TlsPolicy
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"TlsPolicy" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe TlsPolicy
tlsPolicy]