{-# 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.CloudFront.Types.CustomOriginConfig
-- 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.CloudFront.Types.CustomOriginConfig where

import Amazonka.CloudFront.Types.OriginProtocolPolicy
import Amazonka.CloudFront.Types.OriginSslProtocols
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A custom origin. A custom origin is any origin that is /not/ an Amazon
-- S3 bucket, with one exception. An Amazon S3 bucket that is
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html configured with static website hosting>
-- /is/ a custom origin.
--
-- /See:/ 'newCustomOriginConfig' smart constructor.
data CustomOriginConfig = CustomOriginConfig'
  { -- | Specifies how long, in seconds, CloudFront persists its connection to
    -- the origin. The minimum timeout is 1 second, the maximum is 60 seconds,
    -- and the default (if you don’t specify otherwise) is 5 seconds.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginKeepaliveTimeout Origin Keep-alive Timeout>
    -- in the /Amazon CloudFront Developer Guide/.
    CustomOriginConfig -> Maybe Int
originKeepaliveTimeout :: Prelude.Maybe Prelude.Int,
    -- | Specifies how long, in seconds, CloudFront waits for a response from the
    -- origin. This is also known as the /origin response timeout/. The minimum
    -- timeout is 1 second, the maximum is 60 seconds, and the default (if you
    -- don’t specify otherwise) is 30 seconds.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginResponseTimeout Origin Response Timeout>
    -- in the /Amazon CloudFront Developer Guide/.
    CustomOriginConfig -> Maybe Int
originReadTimeout :: Prelude.Maybe Prelude.Int,
    -- | Specifies the minimum SSL\/TLS protocol that CloudFront uses when
    -- connecting to your origin over HTTPS. Valid values include @SSLv3@,
    -- @TLSv1@, @TLSv1.1@, and @TLSv1.2@.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginSSLProtocols Minimum Origin SSL Protocol>
    -- in the /Amazon CloudFront Developer Guide/.
    CustomOriginConfig -> Maybe OriginSslProtocols
originSslProtocols :: Prelude.Maybe OriginSslProtocols,
    -- | The HTTP port that CloudFront uses to connect to the origin. Specify the
    -- HTTP port that the origin listens on.
    CustomOriginConfig -> Int
hTTPPort :: Prelude.Int,
    -- | The HTTPS port that CloudFront uses to connect to the origin. Specify
    -- the HTTPS port that the origin listens on.
    CustomOriginConfig -> Int
hTTPSPort :: Prelude.Int,
    -- | Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect
    -- to the origin. Valid values are:
    --
    -- -   @http-only@ – CloudFront always uses HTTP to connect to the origin.
    --
    -- -   @match-viewer@ – CloudFront connects to the origin using the same
    --     protocol that the viewer used to connect to CloudFront.
    --
    -- -   @https-only@ – CloudFront always uses HTTPS to connect to the
    --     origin.
    CustomOriginConfig -> OriginProtocolPolicy
originProtocolPolicy :: OriginProtocolPolicy
  }
  deriving (CustomOriginConfig -> CustomOriginConfig -> Bool
(CustomOriginConfig -> CustomOriginConfig -> Bool)
-> (CustomOriginConfig -> CustomOriginConfig -> Bool)
-> Eq CustomOriginConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomOriginConfig -> CustomOriginConfig -> Bool
$c/= :: CustomOriginConfig -> CustomOriginConfig -> Bool
== :: CustomOriginConfig -> CustomOriginConfig -> Bool
$c== :: CustomOriginConfig -> CustomOriginConfig -> Bool
Prelude.Eq, ReadPrec [CustomOriginConfig]
ReadPrec CustomOriginConfig
Int -> ReadS CustomOriginConfig
ReadS [CustomOriginConfig]
(Int -> ReadS CustomOriginConfig)
-> ReadS [CustomOriginConfig]
-> ReadPrec CustomOriginConfig
-> ReadPrec [CustomOriginConfig]
-> Read CustomOriginConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomOriginConfig]
$creadListPrec :: ReadPrec [CustomOriginConfig]
readPrec :: ReadPrec CustomOriginConfig
$creadPrec :: ReadPrec CustomOriginConfig
readList :: ReadS [CustomOriginConfig]
$creadList :: ReadS [CustomOriginConfig]
readsPrec :: Int -> ReadS CustomOriginConfig
$creadsPrec :: Int -> ReadS CustomOriginConfig
Prelude.Read, Int -> CustomOriginConfig -> ShowS
[CustomOriginConfig] -> ShowS
CustomOriginConfig -> String
(Int -> CustomOriginConfig -> ShowS)
-> (CustomOriginConfig -> String)
-> ([CustomOriginConfig] -> ShowS)
-> Show CustomOriginConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomOriginConfig] -> ShowS
$cshowList :: [CustomOriginConfig] -> ShowS
show :: CustomOriginConfig -> String
$cshow :: CustomOriginConfig -> String
showsPrec :: Int -> CustomOriginConfig -> ShowS
$cshowsPrec :: Int -> CustomOriginConfig -> ShowS
Prelude.Show, (forall x. CustomOriginConfig -> Rep CustomOriginConfig x)
-> (forall x. Rep CustomOriginConfig x -> CustomOriginConfig)
-> Generic CustomOriginConfig
forall x. Rep CustomOriginConfig x -> CustomOriginConfig
forall x. CustomOriginConfig -> Rep CustomOriginConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomOriginConfig x -> CustomOriginConfig
$cfrom :: forall x. CustomOriginConfig -> Rep CustomOriginConfig x
Prelude.Generic)

-- |
-- Create a value of 'CustomOriginConfig' 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:
--
-- 'originKeepaliveTimeout', 'customOriginConfig_originKeepaliveTimeout' - Specifies how long, in seconds, CloudFront persists its connection to
-- the origin. The minimum timeout is 1 second, the maximum is 60 seconds,
-- and the default (if you don’t specify otherwise) is 5 seconds.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginKeepaliveTimeout Origin Keep-alive Timeout>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'originReadTimeout', 'customOriginConfig_originReadTimeout' - Specifies how long, in seconds, CloudFront waits for a response from the
-- origin. This is also known as the /origin response timeout/. The minimum
-- timeout is 1 second, the maximum is 60 seconds, and the default (if you
-- don’t specify otherwise) is 30 seconds.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginResponseTimeout Origin Response Timeout>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'originSslProtocols', 'customOriginConfig_originSslProtocols' - Specifies the minimum SSL\/TLS protocol that CloudFront uses when
-- connecting to your origin over HTTPS. Valid values include @SSLv3@,
-- @TLSv1@, @TLSv1.1@, and @TLSv1.2@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginSSLProtocols Minimum Origin SSL Protocol>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'hTTPPort', 'customOriginConfig_hTTPPort' - The HTTP port that CloudFront uses to connect to the origin. Specify the
-- HTTP port that the origin listens on.
--
-- 'hTTPSPort', 'customOriginConfig_hTTPSPort' - The HTTPS port that CloudFront uses to connect to the origin. Specify
-- the HTTPS port that the origin listens on.
--
-- 'originProtocolPolicy', 'customOriginConfig_originProtocolPolicy' - Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect
-- to the origin. Valid values are:
--
-- -   @http-only@ – CloudFront always uses HTTP to connect to the origin.
--
-- -   @match-viewer@ – CloudFront connects to the origin using the same
--     protocol that the viewer used to connect to CloudFront.
--
-- -   @https-only@ – CloudFront always uses HTTPS to connect to the
--     origin.
newCustomOriginConfig ::
  -- | 'hTTPPort'
  Prelude.Int ->
  -- | 'hTTPSPort'
  Prelude.Int ->
  -- | 'originProtocolPolicy'
  OriginProtocolPolicy ->
  CustomOriginConfig
newCustomOriginConfig :: Int -> Int -> OriginProtocolPolicy -> CustomOriginConfig
newCustomOriginConfig
  Int
pHTTPPort_
  Int
pHTTPSPort_
  OriginProtocolPolicy
pOriginProtocolPolicy_ =
    CustomOriginConfig' :: Maybe Int
-> Maybe Int
-> Maybe OriginSslProtocols
-> Int
-> Int
-> OriginProtocolPolicy
-> CustomOriginConfig
CustomOriginConfig'
      { $sel:originKeepaliveTimeout:CustomOriginConfig' :: Maybe Int
originKeepaliveTimeout =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:originReadTimeout:CustomOriginConfig' :: Maybe Int
originReadTimeout = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:originSslProtocols:CustomOriginConfig' :: Maybe OriginSslProtocols
originSslProtocols = Maybe OriginSslProtocols
forall a. Maybe a
Prelude.Nothing,
        $sel:hTTPPort:CustomOriginConfig' :: Int
hTTPPort = Int
pHTTPPort_,
        $sel:hTTPSPort:CustomOriginConfig' :: Int
hTTPSPort = Int
pHTTPSPort_,
        $sel:originProtocolPolicy:CustomOriginConfig' :: OriginProtocolPolicy
originProtocolPolicy = OriginProtocolPolicy
pOriginProtocolPolicy_
      }

-- | Specifies how long, in seconds, CloudFront persists its connection to
-- the origin. The minimum timeout is 1 second, the maximum is 60 seconds,
-- and the default (if you don’t specify otherwise) is 5 seconds.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginKeepaliveTimeout Origin Keep-alive Timeout>
-- in the /Amazon CloudFront Developer Guide/.
customOriginConfig_originKeepaliveTimeout :: Lens.Lens' CustomOriginConfig (Prelude.Maybe Prelude.Int)
customOriginConfig_originKeepaliveTimeout :: (Maybe Int -> f (Maybe Int))
-> CustomOriginConfig -> f CustomOriginConfig
customOriginConfig_originKeepaliveTimeout = (CustomOriginConfig -> Maybe Int)
-> (CustomOriginConfig -> Maybe Int -> CustomOriginConfig)
-> Lens
     CustomOriginConfig CustomOriginConfig (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomOriginConfig' {Maybe Int
originKeepaliveTimeout :: Maybe Int
$sel:originKeepaliveTimeout:CustomOriginConfig' :: CustomOriginConfig -> Maybe Int
originKeepaliveTimeout} -> Maybe Int
originKeepaliveTimeout) (\s :: CustomOriginConfig
s@CustomOriginConfig' {} Maybe Int
a -> CustomOriginConfig
s {$sel:originKeepaliveTimeout:CustomOriginConfig' :: Maybe Int
originKeepaliveTimeout = Maybe Int
a} :: CustomOriginConfig)

-- | Specifies how long, in seconds, CloudFront waits for a response from the
-- origin. This is also known as the /origin response timeout/. The minimum
-- timeout is 1 second, the maximum is 60 seconds, and the default (if you
-- don’t specify otherwise) is 30 seconds.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginResponseTimeout Origin Response Timeout>
-- in the /Amazon CloudFront Developer Guide/.
customOriginConfig_originReadTimeout :: Lens.Lens' CustomOriginConfig (Prelude.Maybe Prelude.Int)
customOriginConfig_originReadTimeout :: (Maybe Int -> f (Maybe Int))
-> CustomOriginConfig -> f CustomOriginConfig
customOriginConfig_originReadTimeout = (CustomOriginConfig -> Maybe Int)
-> (CustomOriginConfig -> Maybe Int -> CustomOriginConfig)
-> Lens
     CustomOriginConfig CustomOriginConfig (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomOriginConfig' {Maybe Int
originReadTimeout :: Maybe Int
$sel:originReadTimeout:CustomOriginConfig' :: CustomOriginConfig -> Maybe Int
originReadTimeout} -> Maybe Int
originReadTimeout) (\s :: CustomOriginConfig
s@CustomOriginConfig' {} Maybe Int
a -> CustomOriginConfig
s {$sel:originReadTimeout:CustomOriginConfig' :: Maybe Int
originReadTimeout = Maybe Int
a} :: CustomOriginConfig)

-- | Specifies the minimum SSL\/TLS protocol that CloudFront uses when
-- connecting to your origin over HTTPS. Valid values include @SSLv3@,
-- @TLSv1@, @TLSv1.1@, and @TLSv1.2@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginSSLProtocols Minimum Origin SSL Protocol>
-- in the /Amazon CloudFront Developer Guide/.
customOriginConfig_originSslProtocols :: Lens.Lens' CustomOriginConfig (Prelude.Maybe OriginSslProtocols)
customOriginConfig_originSslProtocols :: (Maybe OriginSslProtocols -> f (Maybe OriginSslProtocols))
-> CustomOriginConfig -> f CustomOriginConfig
customOriginConfig_originSslProtocols = (CustomOriginConfig -> Maybe OriginSslProtocols)
-> (CustomOriginConfig
    -> Maybe OriginSslProtocols -> CustomOriginConfig)
-> Lens
     CustomOriginConfig
     CustomOriginConfig
     (Maybe OriginSslProtocols)
     (Maybe OriginSslProtocols)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomOriginConfig' {Maybe OriginSslProtocols
originSslProtocols :: Maybe OriginSslProtocols
$sel:originSslProtocols:CustomOriginConfig' :: CustomOriginConfig -> Maybe OriginSslProtocols
originSslProtocols} -> Maybe OriginSslProtocols
originSslProtocols) (\s :: CustomOriginConfig
s@CustomOriginConfig' {} Maybe OriginSslProtocols
a -> CustomOriginConfig
s {$sel:originSslProtocols:CustomOriginConfig' :: Maybe OriginSslProtocols
originSslProtocols = Maybe OriginSslProtocols
a} :: CustomOriginConfig)

-- | The HTTP port that CloudFront uses to connect to the origin. Specify the
-- HTTP port that the origin listens on.
customOriginConfig_hTTPPort :: Lens.Lens' CustomOriginConfig Prelude.Int
customOriginConfig_hTTPPort :: (Int -> f Int) -> CustomOriginConfig -> f CustomOriginConfig
customOriginConfig_hTTPPort = (CustomOriginConfig -> Int)
-> (CustomOriginConfig -> Int -> CustomOriginConfig)
-> Lens CustomOriginConfig CustomOriginConfig Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomOriginConfig' {Int
hTTPPort :: Int
$sel:hTTPPort:CustomOriginConfig' :: CustomOriginConfig -> Int
hTTPPort} -> Int
hTTPPort) (\s :: CustomOriginConfig
s@CustomOriginConfig' {} Int
a -> CustomOriginConfig
s {$sel:hTTPPort:CustomOriginConfig' :: Int
hTTPPort = Int
a} :: CustomOriginConfig)

-- | The HTTPS port that CloudFront uses to connect to the origin. Specify
-- the HTTPS port that the origin listens on.
customOriginConfig_hTTPSPort :: Lens.Lens' CustomOriginConfig Prelude.Int
customOriginConfig_hTTPSPort :: (Int -> f Int) -> CustomOriginConfig -> f CustomOriginConfig
customOriginConfig_hTTPSPort = (CustomOriginConfig -> Int)
-> (CustomOriginConfig -> Int -> CustomOriginConfig)
-> Lens CustomOriginConfig CustomOriginConfig Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomOriginConfig' {Int
hTTPSPort :: Int
$sel:hTTPSPort:CustomOriginConfig' :: CustomOriginConfig -> Int
hTTPSPort} -> Int
hTTPSPort) (\s :: CustomOriginConfig
s@CustomOriginConfig' {} Int
a -> CustomOriginConfig
s {$sel:hTTPSPort:CustomOriginConfig' :: Int
hTTPSPort = Int
a} :: CustomOriginConfig)

-- | Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect
-- to the origin. Valid values are:
--
-- -   @http-only@ – CloudFront always uses HTTP to connect to the origin.
--
-- -   @match-viewer@ – CloudFront connects to the origin using the same
--     protocol that the viewer used to connect to CloudFront.
--
-- -   @https-only@ – CloudFront always uses HTTPS to connect to the
--     origin.
customOriginConfig_originProtocolPolicy :: Lens.Lens' CustomOriginConfig OriginProtocolPolicy
customOriginConfig_originProtocolPolicy :: (OriginProtocolPolicy -> f OriginProtocolPolicy)
-> CustomOriginConfig -> f CustomOriginConfig
customOriginConfig_originProtocolPolicy = (CustomOriginConfig -> OriginProtocolPolicy)
-> (CustomOriginConfig
    -> OriginProtocolPolicy -> CustomOriginConfig)
-> Lens
     CustomOriginConfig
     CustomOriginConfig
     OriginProtocolPolicy
     OriginProtocolPolicy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomOriginConfig' {OriginProtocolPolicy
originProtocolPolicy :: OriginProtocolPolicy
$sel:originProtocolPolicy:CustomOriginConfig' :: CustomOriginConfig -> OriginProtocolPolicy
originProtocolPolicy} -> OriginProtocolPolicy
originProtocolPolicy) (\s :: CustomOriginConfig
s@CustomOriginConfig' {} OriginProtocolPolicy
a -> CustomOriginConfig
s {$sel:originProtocolPolicy:CustomOriginConfig' :: OriginProtocolPolicy
originProtocolPolicy = OriginProtocolPolicy
a} :: CustomOriginConfig)

instance Core.FromXML CustomOriginConfig where
  parseXML :: [Node] -> Either String CustomOriginConfig
parseXML [Node]
x =
    Maybe Int
-> Maybe Int
-> Maybe OriginSslProtocols
-> Int
-> Int
-> OriginProtocolPolicy
-> CustomOriginConfig
CustomOriginConfig'
      (Maybe Int
 -> Maybe Int
 -> Maybe OriginSslProtocols
 -> Int
 -> Int
 -> OriginProtocolPolicy
 -> CustomOriginConfig)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Int
      -> Maybe OriginSslProtocols
      -> Int
      -> Int
      -> OriginProtocolPolicy
      -> CustomOriginConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OriginKeepaliveTimeout")
      Either
  String
  (Maybe Int
   -> Maybe OriginSslProtocols
   -> Int
   -> Int
   -> OriginProtocolPolicy
   -> CustomOriginConfig)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe OriginSslProtocols
      -> Int -> Int -> OriginProtocolPolicy -> CustomOriginConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OriginReadTimeout")
      Either
  String
  (Maybe OriginSslProtocols
   -> Int -> Int -> OriginProtocolPolicy -> CustomOriginConfig)
-> Either String (Maybe OriginSslProtocols)
-> Either
     String (Int -> Int -> OriginProtocolPolicy -> CustomOriginConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe OriginSslProtocols)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OriginSslProtocols")
      Either
  String (Int -> Int -> OriginProtocolPolicy -> CustomOriginConfig)
-> Either String Int
-> Either
     String (Int -> OriginProtocolPolicy -> CustomOriginConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Int
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HTTPPort")
      Either String (Int -> OriginProtocolPolicy -> CustomOriginConfig)
-> Either String Int
-> Either String (OriginProtocolPolicy -> CustomOriginConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Int
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HTTPSPort")
      Either String (OriginProtocolPolicy -> CustomOriginConfig)
-> Either String OriginProtocolPolicy
-> Either String CustomOriginConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String OriginProtocolPolicy
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"OriginProtocolPolicy")

instance Prelude.Hashable CustomOriginConfig

instance Prelude.NFData CustomOriginConfig

instance Core.ToXML CustomOriginConfig where
  toXML :: CustomOriginConfig -> XML
toXML CustomOriginConfig' {Int
Maybe Int
Maybe OriginSslProtocols
OriginProtocolPolicy
originProtocolPolicy :: OriginProtocolPolicy
hTTPSPort :: Int
hTTPPort :: Int
originSslProtocols :: Maybe OriginSslProtocols
originReadTimeout :: Maybe Int
originKeepaliveTimeout :: Maybe Int
$sel:originProtocolPolicy:CustomOriginConfig' :: CustomOriginConfig -> OriginProtocolPolicy
$sel:hTTPSPort:CustomOriginConfig' :: CustomOriginConfig -> Int
$sel:hTTPPort:CustomOriginConfig' :: CustomOriginConfig -> Int
$sel:originSslProtocols:CustomOriginConfig' :: CustomOriginConfig -> Maybe OriginSslProtocols
$sel:originReadTimeout:CustomOriginConfig' :: CustomOriginConfig -> Maybe Int
$sel:originKeepaliveTimeout:CustomOriginConfig' :: CustomOriginConfig -> Maybe Int
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"OriginKeepaliveTimeout"
          Name -> Maybe Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Int
originKeepaliveTimeout,
        Name
"OriginReadTimeout" Name -> Maybe Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Int
originReadTimeout,
        Name
"OriginSslProtocols" Name -> Maybe OriginSslProtocols -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe OriginSslProtocols
originSslProtocols,
        Name
"HTTPPort" Name -> Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Int
hTTPPort,
        Name
"HTTPSPort" Name -> Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Int
hTTPSPort,
        Name
"OriginProtocolPolicy" Name -> OriginProtocolPolicy -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= OriginProtocolPolicy
originProtocolPolicy
      ]