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