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