{-# 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.OriginRequestPolicyHeadersConfig where
import Amazonka.CloudFront.Types.Headers
import Amazonka.CloudFront.Types.OriginRequestPolicyHeaderBehavior
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data =
{ :: Prelude.Maybe Headers,
:: OriginRequestPolicyHeaderBehavior
}
deriving (OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeadersConfig -> Bool
(OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeadersConfig -> Bool)
-> (OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeadersConfig -> Bool)
-> Eq OriginRequestPolicyHeadersConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeadersConfig -> Bool
$c/= :: OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeadersConfig -> Bool
== :: OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeadersConfig -> Bool
$c== :: OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeadersConfig -> Bool
Prelude.Eq, ReadPrec [OriginRequestPolicyHeadersConfig]
ReadPrec OriginRequestPolicyHeadersConfig
Int -> ReadS OriginRequestPolicyHeadersConfig
ReadS [OriginRequestPolicyHeadersConfig]
(Int -> ReadS OriginRequestPolicyHeadersConfig)
-> ReadS [OriginRequestPolicyHeadersConfig]
-> ReadPrec OriginRequestPolicyHeadersConfig
-> ReadPrec [OriginRequestPolicyHeadersConfig]
-> Read OriginRequestPolicyHeadersConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OriginRequestPolicyHeadersConfig]
$creadListPrec :: ReadPrec [OriginRequestPolicyHeadersConfig]
readPrec :: ReadPrec OriginRequestPolicyHeadersConfig
$creadPrec :: ReadPrec OriginRequestPolicyHeadersConfig
readList :: ReadS [OriginRequestPolicyHeadersConfig]
$creadList :: ReadS [OriginRequestPolicyHeadersConfig]
readsPrec :: Int -> ReadS OriginRequestPolicyHeadersConfig
$creadsPrec :: Int -> ReadS OriginRequestPolicyHeadersConfig
Prelude.Read, Int -> OriginRequestPolicyHeadersConfig -> ShowS
[OriginRequestPolicyHeadersConfig] -> ShowS
OriginRequestPolicyHeadersConfig -> String
(Int -> OriginRequestPolicyHeadersConfig -> ShowS)
-> (OriginRequestPolicyHeadersConfig -> String)
-> ([OriginRequestPolicyHeadersConfig] -> ShowS)
-> Show OriginRequestPolicyHeadersConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OriginRequestPolicyHeadersConfig] -> ShowS
$cshowList :: [OriginRequestPolicyHeadersConfig] -> ShowS
show :: OriginRequestPolicyHeadersConfig -> String
$cshow :: OriginRequestPolicyHeadersConfig -> String
showsPrec :: Int -> OriginRequestPolicyHeadersConfig -> ShowS
$cshowsPrec :: Int -> OriginRequestPolicyHeadersConfig -> ShowS
Prelude.Show, (forall x.
OriginRequestPolicyHeadersConfig
-> Rep OriginRequestPolicyHeadersConfig x)
-> (forall x.
Rep OriginRequestPolicyHeadersConfig x
-> OriginRequestPolicyHeadersConfig)
-> Generic OriginRequestPolicyHeadersConfig
forall x.
Rep OriginRequestPolicyHeadersConfig x
-> OriginRequestPolicyHeadersConfig
forall x.
OriginRequestPolicyHeadersConfig
-> Rep OriginRequestPolicyHeadersConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OriginRequestPolicyHeadersConfig x
-> OriginRequestPolicyHeadersConfig
$cfrom :: forall x.
OriginRequestPolicyHeadersConfig
-> Rep OriginRequestPolicyHeadersConfig x
Prelude.Generic)
newOriginRequestPolicyHeadersConfig ::
OriginRequestPolicyHeaderBehavior ->
OriginRequestPolicyHeadersConfig
OriginRequestPolicyHeaderBehavior
pHeaderBehavior_ =
OriginRequestPolicyHeadersConfig' :: Maybe Headers
-> OriginRequestPolicyHeaderBehavior
-> OriginRequestPolicyHeadersConfig
OriginRequestPolicyHeadersConfig'
{ $sel:headers:OriginRequestPolicyHeadersConfig' :: Maybe Headers
headers =
Maybe Headers
forall a. Maybe a
Prelude.Nothing,
$sel:headerBehavior:OriginRequestPolicyHeadersConfig' :: OriginRequestPolicyHeaderBehavior
headerBehavior = OriginRequestPolicyHeaderBehavior
pHeaderBehavior_
}
originRequestPolicyHeadersConfig_headers :: Lens.Lens' OriginRequestPolicyHeadersConfig (Prelude.Maybe Headers)
= (OriginRequestPolicyHeadersConfig -> Maybe Headers)
-> (OriginRequestPolicyHeadersConfig
-> Maybe Headers -> OriginRequestPolicyHeadersConfig)
-> Lens
OriginRequestPolicyHeadersConfig
OriginRequestPolicyHeadersConfig
(Maybe Headers)
(Maybe Headers)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginRequestPolicyHeadersConfig' {Maybe Headers
headers :: Maybe Headers
$sel:headers:OriginRequestPolicyHeadersConfig' :: OriginRequestPolicyHeadersConfig -> Maybe Headers
headers} -> Maybe Headers
headers) (\s :: OriginRequestPolicyHeadersConfig
s@OriginRequestPolicyHeadersConfig' {} Maybe Headers
a -> OriginRequestPolicyHeadersConfig
s {$sel:headers:OriginRequestPolicyHeadersConfig' :: Maybe Headers
headers = Maybe Headers
a} :: OriginRequestPolicyHeadersConfig)
originRequestPolicyHeadersConfig_headerBehavior :: Lens.Lens' OriginRequestPolicyHeadersConfig OriginRequestPolicyHeaderBehavior
= (OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeaderBehavior)
-> (OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeaderBehavior
-> OriginRequestPolicyHeadersConfig)
-> Lens
OriginRequestPolicyHeadersConfig
OriginRequestPolicyHeadersConfig
OriginRequestPolicyHeaderBehavior
OriginRequestPolicyHeaderBehavior
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginRequestPolicyHeadersConfig' {OriginRequestPolicyHeaderBehavior
headerBehavior :: OriginRequestPolicyHeaderBehavior
$sel:headerBehavior:OriginRequestPolicyHeadersConfig' :: OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeaderBehavior
headerBehavior} -> OriginRequestPolicyHeaderBehavior
headerBehavior) (\s :: OriginRequestPolicyHeadersConfig
s@OriginRequestPolicyHeadersConfig' {} OriginRequestPolicyHeaderBehavior
a -> OriginRequestPolicyHeadersConfig
s {$sel:headerBehavior:OriginRequestPolicyHeadersConfig' :: OriginRequestPolicyHeaderBehavior
headerBehavior = OriginRequestPolicyHeaderBehavior
a} :: OriginRequestPolicyHeadersConfig)
instance
Core.FromXML
OriginRequestPolicyHeadersConfig
where
parseXML :: [Node] -> Either String OriginRequestPolicyHeadersConfig
parseXML [Node]
x =
Maybe Headers
-> OriginRequestPolicyHeaderBehavior
-> OriginRequestPolicyHeadersConfig
OriginRequestPolicyHeadersConfig'
(Maybe Headers
-> OriginRequestPolicyHeaderBehavior
-> OriginRequestPolicyHeadersConfig)
-> Either String (Maybe Headers)
-> Either
String
(OriginRequestPolicyHeaderBehavior
-> OriginRequestPolicyHeadersConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Headers)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Headers")
Either
String
(OriginRequestPolicyHeaderBehavior
-> OriginRequestPolicyHeadersConfig)
-> Either String OriginRequestPolicyHeaderBehavior
-> Either String OriginRequestPolicyHeadersConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String OriginRequestPolicyHeaderBehavior
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HeaderBehavior")
instance
Prelude.Hashable
OriginRequestPolicyHeadersConfig
instance
Prelude.NFData
OriginRequestPolicyHeadersConfig
instance Core.ToXML OriginRequestPolicyHeadersConfig where
toXML :: OriginRequestPolicyHeadersConfig -> XML
toXML OriginRequestPolicyHeadersConfig' {Maybe Headers
OriginRequestPolicyHeaderBehavior
headerBehavior :: OriginRequestPolicyHeaderBehavior
headers :: Maybe Headers
$sel:headerBehavior:OriginRequestPolicyHeadersConfig' :: OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyHeaderBehavior
$sel:headers:OriginRequestPolicyHeadersConfig' :: OriginRequestPolicyHeadersConfig -> Maybe Headers
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Headers" Name -> Maybe Headers -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Headers
headers,
Name
"HeaderBehavior" Name -> OriginRequestPolicyHeaderBehavior -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= OriginRequestPolicyHeaderBehavior
headerBehavior
]