{-# 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.CachePolicyConfig where
import Amazonka.CloudFront.Types.ParametersInCacheKeyAndForwardedToOrigin
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CachePolicyConfig = CachePolicyConfig'
{
CachePolicyConfig -> Maybe Integer
maxTTL :: Prelude.Maybe Prelude.Integer,
CachePolicyConfig -> Maybe ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin :: Prelude.Maybe ParametersInCacheKeyAndForwardedToOrigin,
CachePolicyConfig -> Maybe Integer
defaultTTL :: Prelude.Maybe Prelude.Integer,
:: Prelude.Maybe Prelude.Text,
CachePolicyConfig -> Text
name :: Prelude.Text,
CachePolicyConfig -> Integer
minTTL :: Prelude.Integer
}
deriving (CachePolicyConfig -> CachePolicyConfig -> Bool
(CachePolicyConfig -> CachePolicyConfig -> Bool)
-> (CachePolicyConfig -> CachePolicyConfig -> Bool)
-> Eq CachePolicyConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CachePolicyConfig -> CachePolicyConfig -> Bool
$c/= :: CachePolicyConfig -> CachePolicyConfig -> Bool
== :: CachePolicyConfig -> CachePolicyConfig -> Bool
$c== :: CachePolicyConfig -> CachePolicyConfig -> Bool
Prelude.Eq, ReadPrec [CachePolicyConfig]
ReadPrec CachePolicyConfig
Int -> ReadS CachePolicyConfig
ReadS [CachePolicyConfig]
(Int -> ReadS CachePolicyConfig)
-> ReadS [CachePolicyConfig]
-> ReadPrec CachePolicyConfig
-> ReadPrec [CachePolicyConfig]
-> Read CachePolicyConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CachePolicyConfig]
$creadListPrec :: ReadPrec [CachePolicyConfig]
readPrec :: ReadPrec CachePolicyConfig
$creadPrec :: ReadPrec CachePolicyConfig
readList :: ReadS [CachePolicyConfig]
$creadList :: ReadS [CachePolicyConfig]
readsPrec :: Int -> ReadS CachePolicyConfig
$creadsPrec :: Int -> ReadS CachePolicyConfig
Prelude.Read, Int -> CachePolicyConfig -> ShowS
[CachePolicyConfig] -> ShowS
CachePolicyConfig -> String
(Int -> CachePolicyConfig -> ShowS)
-> (CachePolicyConfig -> String)
-> ([CachePolicyConfig] -> ShowS)
-> Show CachePolicyConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CachePolicyConfig] -> ShowS
$cshowList :: [CachePolicyConfig] -> ShowS
show :: CachePolicyConfig -> String
$cshow :: CachePolicyConfig -> String
showsPrec :: Int -> CachePolicyConfig -> ShowS
$cshowsPrec :: Int -> CachePolicyConfig -> ShowS
Prelude.Show, (forall x. CachePolicyConfig -> Rep CachePolicyConfig x)
-> (forall x. Rep CachePolicyConfig x -> CachePolicyConfig)
-> Generic CachePolicyConfig
forall x. Rep CachePolicyConfig x -> CachePolicyConfig
forall x. CachePolicyConfig -> Rep CachePolicyConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CachePolicyConfig x -> CachePolicyConfig
$cfrom :: forall x. CachePolicyConfig -> Rep CachePolicyConfig x
Prelude.Generic)
newCachePolicyConfig ::
Prelude.Text ->
Prelude.Integer ->
CachePolicyConfig
newCachePolicyConfig :: Text -> Integer -> CachePolicyConfig
newCachePolicyConfig Text
pName_ Integer
pMinTTL_ =
CachePolicyConfig' :: Maybe Integer
-> Maybe ParametersInCacheKeyAndForwardedToOrigin
-> Maybe Integer
-> Maybe Text
-> Text
-> Integer
-> CachePolicyConfig
CachePolicyConfig'
{ $sel:maxTTL:CachePolicyConfig' :: Maybe Integer
maxTTL = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:parametersInCacheKeyAndForwardedToOrigin:CachePolicyConfig' :: Maybe ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin =
Maybe ParametersInCacheKeyAndForwardedToOrigin
forall a. Maybe a
Prelude.Nothing,
$sel:defaultTTL:CachePolicyConfig' :: Maybe Integer
defaultTTL = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:comment:CachePolicyConfig' :: Maybe Text
comment = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:CachePolicyConfig' :: Text
name = Text
pName_,
$sel:minTTL:CachePolicyConfig' :: Integer
minTTL = Integer
pMinTTL_
}
cachePolicyConfig_maxTTL :: Lens.Lens' CachePolicyConfig (Prelude.Maybe Prelude.Integer)
cachePolicyConfig_maxTTL :: (Maybe Integer -> f (Maybe Integer))
-> CachePolicyConfig -> f CachePolicyConfig
cachePolicyConfig_maxTTL = (CachePolicyConfig -> Maybe Integer)
-> (CachePolicyConfig -> Maybe Integer -> CachePolicyConfig)
-> Lens
CachePolicyConfig CachePolicyConfig (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachePolicyConfig' {Maybe Integer
maxTTL :: Maybe Integer
$sel:maxTTL:CachePolicyConfig' :: CachePolicyConfig -> Maybe Integer
maxTTL} -> Maybe Integer
maxTTL) (\s :: CachePolicyConfig
s@CachePolicyConfig' {} Maybe Integer
a -> CachePolicyConfig
s {$sel:maxTTL:CachePolicyConfig' :: Maybe Integer
maxTTL = Maybe Integer
a} :: CachePolicyConfig)
cachePolicyConfig_parametersInCacheKeyAndForwardedToOrigin :: Lens.Lens' CachePolicyConfig (Prelude.Maybe ParametersInCacheKeyAndForwardedToOrigin)
cachePolicyConfig_parametersInCacheKeyAndForwardedToOrigin :: (Maybe ParametersInCacheKeyAndForwardedToOrigin
-> f (Maybe ParametersInCacheKeyAndForwardedToOrigin))
-> CachePolicyConfig -> f CachePolicyConfig
cachePolicyConfig_parametersInCacheKeyAndForwardedToOrigin = (CachePolicyConfig
-> Maybe ParametersInCacheKeyAndForwardedToOrigin)
-> (CachePolicyConfig
-> Maybe ParametersInCacheKeyAndForwardedToOrigin
-> CachePolicyConfig)
-> Lens
CachePolicyConfig
CachePolicyConfig
(Maybe ParametersInCacheKeyAndForwardedToOrigin)
(Maybe ParametersInCacheKeyAndForwardedToOrigin)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachePolicyConfig' {Maybe ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin :: Maybe ParametersInCacheKeyAndForwardedToOrigin
$sel:parametersInCacheKeyAndForwardedToOrigin:CachePolicyConfig' :: CachePolicyConfig -> Maybe ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin} -> Maybe ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin) (\s :: CachePolicyConfig
s@CachePolicyConfig' {} Maybe ParametersInCacheKeyAndForwardedToOrigin
a -> CachePolicyConfig
s {$sel:parametersInCacheKeyAndForwardedToOrigin:CachePolicyConfig' :: Maybe ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin = Maybe ParametersInCacheKeyAndForwardedToOrigin
a} :: CachePolicyConfig)
cachePolicyConfig_defaultTTL :: Lens.Lens' CachePolicyConfig (Prelude.Maybe Prelude.Integer)
cachePolicyConfig_defaultTTL :: (Maybe Integer -> f (Maybe Integer))
-> CachePolicyConfig -> f CachePolicyConfig
cachePolicyConfig_defaultTTL = (CachePolicyConfig -> Maybe Integer)
-> (CachePolicyConfig -> Maybe Integer -> CachePolicyConfig)
-> Lens
CachePolicyConfig CachePolicyConfig (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachePolicyConfig' {Maybe Integer
defaultTTL :: Maybe Integer
$sel:defaultTTL:CachePolicyConfig' :: CachePolicyConfig -> Maybe Integer
defaultTTL} -> Maybe Integer
defaultTTL) (\s :: CachePolicyConfig
s@CachePolicyConfig' {} Maybe Integer
a -> CachePolicyConfig
s {$sel:defaultTTL:CachePolicyConfig' :: Maybe Integer
defaultTTL = Maybe Integer
a} :: CachePolicyConfig)
cachePolicyConfig_comment :: Lens.Lens' CachePolicyConfig (Prelude.Maybe Prelude.Text)
= (CachePolicyConfig -> Maybe Text)
-> (CachePolicyConfig -> Maybe Text -> CachePolicyConfig)
-> Lens
CachePolicyConfig CachePolicyConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachePolicyConfig' {Maybe Text
comment :: Maybe Text
$sel:comment:CachePolicyConfig' :: CachePolicyConfig -> Maybe Text
comment} -> Maybe Text
comment) (\s :: CachePolicyConfig
s@CachePolicyConfig' {} Maybe Text
a -> CachePolicyConfig
s {$sel:comment:CachePolicyConfig' :: Maybe Text
comment = Maybe Text
a} :: CachePolicyConfig)
cachePolicyConfig_name :: Lens.Lens' CachePolicyConfig Prelude.Text
cachePolicyConfig_name :: (Text -> f Text) -> CachePolicyConfig -> f CachePolicyConfig
cachePolicyConfig_name = (CachePolicyConfig -> Text)
-> (CachePolicyConfig -> Text -> CachePolicyConfig)
-> Lens CachePolicyConfig CachePolicyConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachePolicyConfig' {Text
name :: Text
$sel:name:CachePolicyConfig' :: CachePolicyConfig -> Text
name} -> Text
name) (\s :: CachePolicyConfig
s@CachePolicyConfig' {} Text
a -> CachePolicyConfig
s {$sel:name:CachePolicyConfig' :: Text
name = Text
a} :: CachePolicyConfig)
cachePolicyConfig_minTTL :: Lens.Lens' CachePolicyConfig Prelude.Integer
cachePolicyConfig_minTTL :: (Integer -> f Integer) -> CachePolicyConfig -> f CachePolicyConfig
cachePolicyConfig_minTTL = (CachePolicyConfig -> Integer)
-> (CachePolicyConfig -> Integer -> CachePolicyConfig)
-> Lens CachePolicyConfig CachePolicyConfig Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachePolicyConfig' {Integer
minTTL :: Integer
$sel:minTTL:CachePolicyConfig' :: CachePolicyConfig -> Integer
minTTL} -> Integer
minTTL) (\s :: CachePolicyConfig
s@CachePolicyConfig' {} Integer
a -> CachePolicyConfig
s {$sel:minTTL:CachePolicyConfig' :: Integer
minTTL = Integer
a} :: CachePolicyConfig)
instance Core.FromXML CachePolicyConfig where
parseXML :: [Node] -> Either String CachePolicyConfig
parseXML [Node]
x =
Maybe Integer
-> Maybe ParametersInCacheKeyAndForwardedToOrigin
-> Maybe Integer
-> Maybe Text
-> Text
-> Integer
-> CachePolicyConfig
CachePolicyConfig'
(Maybe Integer
-> Maybe ParametersInCacheKeyAndForwardedToOrigin
-> Maybe Integer
-> Maybe Text
-> Text
-> Integer
-> CachePolicyConfig)
-> Either String (Maybe Integer)
-> Either
String
(Maybe ParametersInCacheKeyAndForwardedToOrigin
-> Maybe Integer
-> Maybe Text
-> Text
-> Integer
-> CachePolicyConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MaxTTL")
Either
String
(Maybe ParametersInCacheKeyAndForwardedToOrigin
-> Maybe Integer
-> Maybe Text
-> Text
-> Integer
-> CachePolicyConfig)
-> Either String (Maybe ParametersInCacheKeyAndForwardedToOrigin)
-> Either
String
(Maybe Integer
-> Maybe Text -> Text -> Integer -> CachePolicyConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
[Node]
-> Text
-> Either String (Maybe ParametersInCacheKeyAndForwardedToOrigin)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ParametersInCacheKeyAndForwardedToOrigin"
)
Either
String
(Maybe Integer
-> Maybe Text -> Text -> Integer -> CachePolicyConfig)
-> Either String (Maybe Integer)
-> Either
String (Maybe Text -> Text -> Integer -> CachePolicyConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DefaultTTL")
Either String (Maybe Text -> Text -> Integer -> CachePolicyConfig)
-> Either String (Maybe Text)
-> Either String (Text -> Integer -> CachePolicyConfig)
forall (f :: * -> *) a b. Applicative f => 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 -> Integer -> CachePolicyConfig)
-> Either String Text
-> Either String (Integer -> CachePolicyConfig)
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 (Integer -> CachePolicyConfig)
-> Either String Integer -> Either String CachePolicyConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Integer
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"MinTTL")
instance Prelude.Hashable CachePolicyConfig
instance Prelude.NFData CachePolicyConfig
instance Core.ToXML CachePolicyConfig where
toXML :: CachePolicyConfig -> XML
toXML CachePolicyConfig' {Integer
Maybe Integer
Maybe Text
Maybe ParametersInCacheKeyAndForwardedToOrigin
Text
minTTL :: Integer
name :: Text
comment :: Maybe Text
defaultTTL :: Maybe Integer
parametersInCacheKeyAndForwardedToOrigin :: Maybe ParametersInCacheKeyAndForwardedToOrigin
maxTTL :: Maybe Integer
$sel:minTTL:CachePolicyConfig' :: CachePolicyConfig -> Integer
$sel:name:CachePolicyConfig' :: CachePolicyConfig -> Text
$sel:comment:CachePolicyConfig' :: CachePolicyConfig -> Maybe Text
$sel:defaultTTL:CachePolicyConfig' :: CachePolicyConfig -> Maybe Integer
$sel:parametersInCacheKeyAndForwardedToOrigin:CachePolicyConfig' :: CachePolicyConfig -> Maybe ParametersInCacheKeyAndForwardedToOrigin
$sel:maxTTL:CachePolicyConfig' :: CachePolicyConfig -> Maybe Integer
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"MaxTTL" Name -> Maybe Integer -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Integer
maxTTL,
Name
"ParametersInCacheKeyAndForwardedToOrigin"
Name -> Maybe ParametersInCacheKeyAndForwardedToOrigin -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin,
Name
"DefaultTTL" Name -> Maybe Integer -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Integer
defaultTTL,
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
"MinTTL" Name -> Integer -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Integer
minTTL
]