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