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