{-# 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.OriginRequestPolicyConfig where
import Amazonka.CloudFront.Types.OriginRequestPolicyCookiesConfig
import Amazonka.CloudFront.Types.OriginRequestPolicyHeadersConfig
import Amazonka.CloudFront.Types.OriginRequestPolicyQueryStringsConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data OriginRequestPolicyConfig = OriginRequestPolicyConfig'
{
:: Prelude.Maybe Prelude.Text,
OriginRequestPolicyConfig -> Text
name :: Prelude.Text,
:: OriginRequestPolicyHeadersConfig,
OriginRequestPolicyConfig -> OriginRequestPolicyCookiesConfig
cookiesConfig :: OriginRequestPolicyCookiesConfig,
OriginRequestPolicyConfig -> OriginRequestPolicyQueryStringsConfig
queryStringsConfig :: OriginRequestPolicyQueryStringsConfig
}
deriving (OriginRequestPolicyConfig -> OriginRequestPolicyConfig -> Bool
(OriginRequestPolicyConfig -> OriginRequestPolicyConfig -> Bool)
-> (OriginRequestPolicyConfig -> OriginRequestPolicyConfig -> Bool)
-> Eq OriginRequestPolicyConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OriginRequestPolicyConfig -> OriginRequestPolicyConfig -> Bool
$c/= :: OriginRequestPolicyConfig -> OriginRequestPolicyConfig -> Bool
== :: OriginRequestPolicyConfig -> OriginRequestPolicyConfig -> Bool
$c== :: OriginRequestPolicyConfig -> OriginRequestPolicyConfig -> Bool
Prelude.Eq, ReadPrec [OriginRequestPolicyConfig]
ReadPrec OriginRequestPolicyConfig
Int -> ReadS OriginRequestPolicyConfig
ReadS [OriginRequestPolicyConfig]
(Int -> ReadS OriginRequestPolicyConfig)
-> ReadS [OriginRequestPolicyConfig]
-> ReadPrec OriginRequestPolicyConfig
-> ReadPrec [OriginRequestPolicyConfig]
-> Read OriginRequestPolicyConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OriginRequestPolicyConfig]
$creadListPrec :: ReadPrec [OriginRequestPolicyConfig]
readPrec :: ReadPrec OriginRequestPolicyConfig
$creadPrec :: ReadPrec OriginRequestPolicyConfig
readList :: ReadS [OriginRequestPolicyConfig]
$creadList :: ReadS [OriginRequestPolicyConfig]
readsPrec :: Int -> ReadS OriginRequestPolicyConfig
$creadsPrec :: Int -> ReadS OriginRequestPolicyConfig
Prelude.Read, Int -> OriginRequestPolicyConfig -> ShowS
[OriginRequestPolicyConfig] -> ShowS
OriginRequestPolicyConfig -> String
(Int -> OriginRequestPolicyConfig -> ShowS)
-> (OriginRequestPolicyConfig -> String)
-> ([OriginRequestPolicyConfig] -> ShowS)
-> Show OriginRequestPolicyConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OriginRequestPolicyConfig] -> ShowS
$cshowList :: [OriginRequestPolicyConfig] -> ShowS
show :: OriginRequestPolicyConfig -> String
$cshow :: OriginRequestPolicyConfig -> String
showsPrec :: Int -> OriginRequestPolicyConfig -> ShowS
$cshowsPrec :: Int -> OriginRequestPolicyConfig -> ShowS
Prelude.Show, (forall x.
OriginRequestPolicyConfig -> Rep OriginRequestPolicyConfig x)
-> (forall x.
Rep OriginRequestPolicyConfig x -> OriginRequestPolicyConfig)
-> Generic OriginRequestPolicyConfig
forall x.
Rep OriginRequestPolicyConfig x -> OriginRequestPolicyConfig
forall x.
OriginRequestPolicyConfig -> Rep OriginRequestPolicyConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OriginRequestPolicyConfig x -> OriginRequestPolicyConfig
$cfrom :: forall x.
OriginRequestPolicyConfig -> Rep OriginRequestPolicyConfig x
Prelude.Generic)
newOriginRequestPolicyConfig ::
Prelude.Text ->
OriginRequestPolicyHeadersConfig ->
OriginRequestPolicyCookiesConfig ->
OriginRequestPolicyQueryStringsConfig ->
OriginRequestPolicyConfig
newOriginRequestPolicyConfig :: Text
-> OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyCookiesConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig
newOriginRequestPolicyConfig
Text
pName_
OriginRequestPolicyHeadersConfig
pHeadersConfig_
OriginRequestPolicyCookiesConfig
pCookiesConfig_
OriginRequestPolicyQueryStringsConfig
pQueryStringsConfig_ =
OriginRequestPolicyConfig' :: Maybe Text
-> Text
-> OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyCookiesConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig
OriginRequestPolicyConfig'
{ $sel:comment:OriginRequestPolicyConfig' :: Maybe Text
comment =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:OriginRequestPolicyConfig' :: Text
name = Text
pName_,
$sel:headersConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyHeadersConfig
headersConfig = OriginRequestPolicyHeadersConfig
pHeadersConfig_,
$sel:cookiesConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyCookiesConfig
cookiesConfig = OriginRequestPolicyCookiesConfig
pCookiesConfig_,
$sel:queryStringsConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyQueryStringsConfig
queryStringsConfig = OriginRequestPolicyQueryStringsConfig
pQueryStringsConfig_
}
originRequestPolicyConfig_comment :: Lens.Lens' OriginRequestPolicyConfig (Prelude.Maybe Prelude.Text)
= (OriginRequestPolicyConfig -> Maybe Text)
-> (OriginRequestPolicyConfig
-> Maybe Text -> OriginRequestPolicyConfig)
-> Lens
OriginRequestPolicyConfig
OriginRequestPolicyConfig
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginRequestPolicyConfig' {Maybe Text
comment :: Maybe Text
$sel:comment:OriginRequestPolicyConfig' :: OriginRequestPolicyConfig -> Maybe Text
comment} -> Maybe Text
comment) (\s :: OriginRequestPolicyConfig
s@OriginRequestPolicyConfig' {} Maybe Text
a -> OriginRequestPolicyConfig
s {$sel:comment:OriginRequestPolicyConfig' :: Maybe Text
comment = Maybe Text
a} :: OriginRequestPolicyConfig)
originRequestPolicyConfig_name :: Lens.Lens' OriginRequestPolicyConfig Prelude.Text
originRequestPolicyConfig_name :: (Text -> f Text)
-> OriginRequestPolicyConfig -> f OriginRequestPolicyConfig
originRequestPolicyConfig_name = (OriginRequestPolicyConfig -> Text)
-> (OriginRequestPolicyConfig -> Text -> OriginRequestPolicyConfig)
-> Lens
OriginRequestPolicyConfig OriginRequestPolicyConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginRequestPolicyConfig' {Text
name :: Text
$sel:name:OriginRequestPolicyConfig' :: OriginRequestPolicyConfig -> Text
name} -> Text
name) (\s :: OriginRequestPolicyConfig
s@OriginRequestPolicyConfig' {} Text
a -> OriginRequestPolicyConfig
s {$sel:name:OriginRequestPolicyConfig' :: Text
name = Text
a} :: OriginRequestPolicyConfig)
originRequestPolicyConfig_headersConfig :: Lens.Lens' OriginRequestPolicyConfig OriginRequestPolicyHeadersConfig
= (OriginRequestPolicyConfig -> OriginRequestPolicyHeadersConfig)
-> (OriginRequestPolicyConfig
-> OriginRequestPolicyHeadersConfig -> OriginRequestPolicyConfig)
-> Lens
OriginRequestPolicyConfig
OriginRequestPolicyConfig
OriginRequestPolicyHeadersConfig
OriginRequestPolicyHeadersConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginRequestPolicyConfig' {OriginRequestPolicyHeadersConfig
headersConfig :: OriginRequestPolicyHeadersConfig
$sel:headersConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyConfig -> OriginRequestPolicyHeadersConfig
headersConfig} -> OriginRequestPolicyHeadersConfig
headersConfig) (\s :: OriginRequestPolicyConfig
s@OriginRequestPolicyConfig' {} OriginRequestPolicyHeadersConfig
a -> OriginRequestPolicyConfig
s {$sel:headersConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyHeadersConfig
headersConfig = OriginRequestPolicyHeadersConfig
a} :: OriginRequestPolicyConfig)
originRequestPolicyConfig_cookiesConfig :: Lens.Lens' OriginRequestPolicyConfig OriginRequestPolicyCookiesConfig
originRequestPolicyConfig_cookiesConfig :: (OriginRequestPolicyCookiesConfig
-> f OriginRequestPolicyCookiesConfig)
-> OriginRequestPolicyConfig -> f OriginRequestPolicyConfig
originRequestPolicyConfig_cookiesConfig = (OriginRequestPolicyConfig -> OriginRequestPolicyCookiesConfig)
-> (OriginRequestPolicyConfig
-> OriginRequestPolicyCookiesConfig -> OriginRequestPolicyConfig)
-> Lens
OriginRequestPolicyConfig
OriginRequestPolicyConfig
OriginRequestPolicyCookiesConfig
OriginRequestPolicyCookiesConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginRequestPolicyConfig' {OriginRequestPolicyCookiesConfig
cookiesConfig :: OriginRequestPolicyCookiesConfig
$sel:cookiesConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyConfig -> OriginRequestPolicyCookiesConfig
cookiesConfig} -> OriginRequestPolicyCookiesConfig
cookiesConfig) (\s :: OriginRequestPolicyConfig
s@OriginRequestPolicyConfig' {} OriginRequestPolicyCookiesConfig
a -> OriginRequestPolicyConfig
s {$sel:cookiesConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyCookiesConfig
cookiesConfig = OriginRequestPolicyCookiesConfig
a} :: OriginRequestPolicyConfig)
originRequestPolicyConfig_queryStringsConfig :: Lens.Lens' OriginRequestPolicyConfig OriginRequestPolicyQueryStringsConfig
originRequestPolicyConfig_queryStringsConfig :: (OriginRequestPolicyQueryStringsConfig
-> f OriginRequestPolicyQueryStringsConfig)
-> OriginRequestPolicyConfig -> f OriginRequestPolicyConfig
originRequestPolicyConfig_queryStringsConfig = (OriginRequestPolicyConfig
-> OriginRequestPolicyQueryStringsConfig)
-> (OriginRequestPolicyConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig)
-> Lens
OriginRequestPolicyConfig
OriginRequestPolicyConfig
OriginRequestPolicyQueryStringsConfig
OriginRequestPolicyQueryStringsConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginRequestPolicyConfig' {OriginRequestPolicyQueryStringsConfig
queryStringsConfig :: OriginRequestPolicyQueryStringsConfig
$sel:queryStringsConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyConfig -> OriginRequestPolicyQueryStringsConfig
queryStringsConfig} -> OriginRequestPolicyQueryStringsConfig
queryStringsConfig) (\s :: OriginRequestPolicyConfig
s@OriginRequestPolicyConfig' {} OriginRequestPolicyQueryStringsConfig
a -> OriginRequestPolicyConfig
s {$sel:queryStringsConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyQueryStringsConfig
queryStringsConfig = OriginRequestPolicyQueryStringsConfig
a} :: OriginRequestPolicyConfig)
instance Core.FromXML OriginRequestPolicyConfig where
parseXML :: [Node] -> Either String OriginRequestPolicyConfig
parseXML [Node]
x =
Maybe Text
-> Text
-> OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyCookiesConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig
OriginRequestPolicyConfig'
(Maybe Text
-> Text
-> OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyCookiesConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig)
-> Either String (Maybe Text)
-> Either
String
(Text
-> OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyCookiesConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Comment")
Either
String
(Text
-> OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyCookiesConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig)
-> Either String Text
-> Either
String
(OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyCookiesConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Name")
Either
String
(OriginRequestPolicyHeadersConfig
-> OriginRequestPolicyCookiesConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig)
-> Either String OriginRequestPolicyHeadersConfig
-> Either
String
(OriginRequestPolicyCookiesConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String OriginRequestPolicyHeadersConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HeadersConfig")
Either
String
(OriginRequestPolicyCookiesConfig
-> OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig)
-> Either String OriginRequestPolicyCookiesConfig
-> Either
String
(OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String OriginRequestPolicyCookiesConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CookiesConfig")
Either
String
(OriginRequestPolicyQueryStringsConfig
-> OriginRequestPolicyConfig)
-> Either String OriginRequestPolicyQueryStringsConfig
-> Either String OriginRequestPolicyConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node]
-> Text -> Either String OriginRequestPolicyQueryStringsConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"QueryStringsConfig")
instance Prelude.Hashable OriginRequestPolicyConfig
instance Prelude.NFData OriginRequestPolicyConfig
instance Core.ToXML OriginRequestPolicyConfig where
toXML :: OriginRequestPolicyConfig -> XML
toXML OriginRequestPolicyConfig' {Maybe Text
Text
OriginRequestPolicyCookiesConfig
OriginRequestPolicyHeadersConfig
OriginRequestPolicyQueryStringsConfig
queryStringsConfig :: OriginRequestPolicyQueryStringsConfig
cookiesConfig :: OriginRequestPolicyCookiesConfig
headersConfig :: OriginRequestPolicyHeadersConfig
name :: Text
comment :: Maybe Text
$sel:queryStringsConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyConfig -> OriginRequestPolicyQueryStringsConfig
$sel:cookiesConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyConfig -> OriginRequestPolicyCookiesConfig
$sel:headersConfig:OriginRequestPolicyConfig' :: OriginRequestPolicyConfig -> OriginRequestPolicyHeadersConfig
$sel:name:OriginRequestPolicyConfig' :: OriginRequestPolicyConfig -> Text
$sel:comment:OriginRequestPolicyConfig' :: OriginRequestPolicyConfig -> Maybe Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Comment" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
comment,
Name
"Name" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
name,
Name
"HeadersConfig" Name -> OriginRequestPolicyHeadersConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= OriginRequestPolicyHeadersConfig
headersConfig,
Name
"CookiesConfig" Name -> OriginRequestPolicyCookiesConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= OriginRequestPolicyCookiesConfig
cookiesConfig,
Name
"QueryStringsConfig" Name -> OriginRequestPolicyQueryStringsConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= OriginRequestPolicyQueryStringsConfig
queryStringsConfig
]