{-# 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 #-}
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
data CustomOriginConfig = CustomOriginConfig'
{
CustomOriginConfig -> Maybe Int
originKeepaliveTimeout :: Prelude.Maybe Prelude.Int,
CustomOriginConfig -> Maybe Int
originReadTimeout :: Prelude.Maybe Prelude.Int,
CustomOriginConfig -> Maybe OriginSslProtocols
originSslProtocols :: Prelude.Maybe OriginSslProtocols,
CustomOriginConfig -> Int
hTTPPort :: Prelude.Int,
CustomOriginConfig -> Int
hTTPSPort :: Prelude.Int,
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)
newCustomOriginConfig ::
Prelude.Int ->
Prelude.Int ->
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_
}
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)
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)
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)
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)
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)
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
]