{-# 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.Lightsail.Types.CacheSettings where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types.CookieObject
import Amazonka.Lightsail.Types.HeaderObject
import Amazonka.Lightsail.Types.QueryStringObject
import qualified Amazonka.Prelude as Prelude
data CacheSettings = CacheSettings'
{
CacheSettings -> Maybe Text
allowedHTTPMethods :: Prelude.Maybe Prelude.Text,
CacheSettings -> Maybe Text
cachedHTTPMethods :: Prelude.Maybe Prelude.Text,
CacheSettings -> Maybe Integer
defaultTTL :: Prelude.Maybe Prelude.Integer,
CacheSettings -> Maybe CookieObject
forwardedCookies :: Prelude.Maybe CookieObject,
:: Prelude.Maybe HeaderObject,
CacheSettings -> Maybe QueryStringObject
forwardedQueryStrings :: Prelude.Maybe QueryStringObject,
CacheSettings -> Maybe Integer
maximumTTL :: Prelude.Maybe Prelude.Integer,
CacheSettings -> Maybe Integer
minimumTTL :: Prelude.Maybe Prelude.Integer
}
deriving (CacheSettings -> CacheSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CacheSettings -> CacheSettings -> Bool
$c/= :: CacheSettings -> CacheSettings -> Bool
== :: CacheSettings -> CacheSettings -> Bool
$c== :: CacheSettings -> CacheSettings -> Bool
Prelude.Eq, ReadPrec [CacheSettings]
ReadPrec CacheSettings
Int -> ReadS CacheSettings
ReadS [CacheSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CacheSettings]
$creadListPrec :: ReadPrec [CacheSettings]
readPrec :: ReadPrec CacheSettings
$creadPrec :: ReadPrec CacheSettings
readList :: ReadS [CacheSettings]
$creadList :: ReadS [CacheSettings]
readsPrec :: Int -> ReadS CacheSettings
$creadsPrec :: Int -> ReadS CacheSettings
Prelude.Read, Int -> CacheSettings -> ShowS
[CacheSettings] -> ShowS
CacheSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CacheSettings] -> ShowS
$cshowList :: [CacheSettings] -> ShowS
show :: CacheSettings -> String
$cshow :: CacheSettings -> String
showsPrec :: Int -> CacheSettings -> ShowS
$cshowsPrec :: Int -> CacheSettings -> ShowS
Prelude.Show, forall x. Rep CacheSettings x -> CacheSettings
forall x. CacheSettings -> Rep CacheSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CacheSettings x -> CacheSettings
$cfrom :: forall x. CacheSettings -> Rep CacheSettings x
Prelude.Generic)
newCacheSettings ::
CacheSettings
newCacheSettings :: CacheSettings
newCacheSettings =
CacheSettings'
{ $sel:allowedHTTPMethods:CacheSettings' :: Maybe Text
allowedHTTPMethods =
forall a. Maybe a
Prelude.Nothing,
$sel:cachedHTTPMethods:CacheSettings' :: Maybe Text
cachedHTTPMethods = forall a. Maybe a
Prelude.Nothing,
$sel:defaultTTL:CacheSettings' :: Maybe Integer
defaultTTL = forall a. Maybe a
Prelude.Nothing,
$sel:forwardedCookies:CacheSettings' :: Maybe CookieObject
forwardedCookies = forall a. Maybe a
Prelude.Nothing,
$sel:forwardedHeaders:CacheSettings' :: Maybe HeaderObject
forwardedHeaders = forall a. Maybe a
Prelude.Nothing,
$sel:forwardedQueryStrings:CacheSettings' :: Maybe QueryStringObject
forwardedQueryStrings = forall a. Maybe a
Prelude.Nothing,
$sel:maximumTTL:CacheSettings' :: Maybe Integer
maximumTTL = forall a. Maybe a
Prelude.Nothing,
$sel:minimumTTL:CacheSettings' :: Maybe Integer
minimumTTL = forall a. Maybe a
Prelude.Nothing
}
cacheSettings_allowedHTTPMethods :: Lens.Lens' CacheSettings (Prelude.Maybe Prelude.Text)
cacheSettings_allowedHTTPMethods :: Lens' CacheSettings (Maybe Text)
cacheSettings_allowedHTTPMethods = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheSettings' {Maybe Text
allowedHTTPMethods :: Maybe Text
$sel:allowedHTTPMethods:CacheSettings' :: CacheSettings -> Maybe Text
allowedHTTPMethods} -> Maybe Text
allowedHTTPMethods) (\s :: CacheSettings
s@CacheSettings' {} Maybe Text
a -> CacheSettings
s {$sel:allowedHTTPMethods:CacheSettings' :: Maybe Text
allowedHTTPMethods = Maybe Text
a} :: CacheSettings)
cacheSettings_cachedHTTPMethods :: Lens.Lens' CacheSettings (Prelude.Maybe Prelude.Text)
cacheSettings_cachedHTTPMethods :: Lens' CacheSettings (Maybe Text)
cacheSettings_cachedHTTPMethods = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheSettings' {Maybe Text
cachedHTTPMethods :: Maybe Text
$sel:cachedHTTPMethods:CacheSettings' :: CacheSettings -> Maybe Text
cachedHTTPMethods} -> Maybe Text
cachedHTTPMethods) (\s :: CacheSettings
s@CacheSettings' {} Maybe Text
a -> CacheSettings
s {$sel:cachedHTTPMethods:CacheSettings' :: Maybe Text
cachedHTTPMethods = Maybe Text
a} :: CacheSettings)
cacheSettings_defaultTTL :: Lens.Lens' CacheSettings (Prelude.Maybe Prelude.Integer)
cacheSettings_defaultTTL :: Lens' CacheSettings (Maybe Integer)
cacheSettings_defaultTTL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheSettings' {Maybe Integer
defaultTTL :: Maybe Integer
$sel:defaultTTL:CacheSettings' :: CacheSettings -> Maybe Integer
defaultTTL} -> Maybe Integer
defaultTTL) (\s :: CacheSettings
s@CacheSettings' {} Maybe Integer
a -> CacheSettings
s {$sel:defaultTTL:CacheSettings' :: Maybe Integer
defaultTTL = Maybe Integer
a} :: CacheSettings)
cacheSettings_forwardedCookies :: Lens.Lens' CacheSettings (Prelude.Maybe CookieObject)
cacheSettings_forwardedCookies :: Lens' CacheSettings (Maybe CookieObject)
cacheSettings_forwardedCookies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheSettings' {Maybe CookieObject
forwardedCookies :: Maybe CookieObject
$sel:forwardedCookies:CacheSettings' :: CacheSettings -> Maybe CookieObject
forwardedCookies} -> Maybe CookieObject
forwardedCookies) (\s :: CacheSettings
s@CacheSettings' {} Maybe CookieObject
a -> CacheSettings
s {$sel:forwardedCookies:CacheSettings' :: Maybe CookieObject
forwardedCookies = Maybe CookieObject
a} :: CacheSettings)
cacheSettings_forwardedHeaders :: Lens.Lens' CacheSettings (Prelude.Maybe HeaderObject)
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheSettings' {Maybe HeaderObject
forwardedHeaders :: Maybe HeaderObject
$sel:forwardedHeaders:CacheSettings' :: CacheSettings -> Maybe HeaderObject
forwardedHeaders} -> Maybe HeaderObject
forwardedHeaders) (\s :: CacheSettings
s@CacheSettings' {} Maybe HeaderObject
a -> CacheSettings
s {$sel:forwardedHeaders:CacheSettings' :: Maybe HeaderObject
forwardedHeaders = Maybe HeaderObject
a} :: CacheSettings)
cacheSettings_forwardedQueryStrings :: Lens.Lens' CacheSettings (Prelude.Maybe QueryStringObject)
cacheSettings_forwardedQueryStrings :: Lens' CacheSettings (Maybe QueryStringObject)
cacheSettings_forwardedQueryStrings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheSettings' {Maybe QueryStringObject
forwardedQueryStrings :: Maybe QueryStringObject
$sel:forwardedQueryStrings:CacheSettings' :: CacheSettings -> Maybe QueryStringObject
forwardedQueryStrings} -> Maybe QueryStringObject
forwardedQueryStrings) (\s :: CacheSettings
s@CacheSettings' {} Maybe QueryStringObject
a -> CacheSettings
s {$sel:forwardedQueryStrings:CacheSettings' :: Maybe QueryStringObject
forwardedQueryStrings = Maybe QueryStringObject
a} :: CacheSettings)
cacheSettings_maximumTTL :: Lens.Lens' CacheSettings (Prelude.Maybe Prelude.Integer)
cacheSettings_maximumTTL :: Lens' CacheSettings (Maybe Integer)
cacheSettings_maximumTTL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheSettings' {Maybe Integer
maximumTTL :: Maybe Integer
$sel:maximumTTL:CacheSettings' :: CacheSettings -> Maybe Integer
maximumTTL} -> Maybe Integer
maximumTTL) (\s :: CacheSettings
s@CacheSettings' {} Maybe Integer
a -> CacheSettings
s {$sel:maximumTTL:CacheSettings' :: Maybe Integer
maximumTTL = Maybe Integer
a} :: CacheSettings)
cacheSettings_minimumTTL :: Lens.Lens' CacheSettings (Prelude.Maybe Prelude.Integer)
cacheSettings_minimumTTL :: Lens' CacheSettings (Maybe Integer)
cacheSettings_minimumTTL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheSettings' {Maybe Integer
minimumTTL :: Maybe Integer
$sel:minimumTTL:CacheSettings' :: CacheSettings -> Maybe Integer
minimumTTL} -> Maybe Integer
minimumTTL) (\s :: CacheSettings
s@CacheSettings' {} Maybe Integer
a -> CacheSettings
s {$sel:minimumTTL:CacheSettings' :: Maybe Integer
minimumTTL = Maybe Integer
a} :: CacheSettings)
instance Data.FromJSON CacheSettings where
parseJSON :: Value -> Parser CacheSettings
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CacheSettings"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe CookieObject
-> Maybe HeaderObject
-> Maybe QueryStringObject
-> Maybe Integer
-> Maybe Integer
-> CacheSettings
CacheSettings'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"allowedHTTPMethods")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"cachedHTTPMethods")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"defaultTTL")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"forwardedCookies")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"forwardedHeaders")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"forwardedQueryStrings")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"maximumTTL")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"minimumTTL")
)
instance Prelude.Hashable CacheSettings where
hashWithSalt :: Int -> CacheSettings -> Int
hashWithSalt Int
_salt CacheSettings' {Maybe Integer
Maybe Text
Maybe CookieObject
Maybe HeaderObject
Maybe QueryStringObject
minimumTTL :: Maybe Integer
maximumTTL :: Maybe Integer
forwardedQueryStrings :: Maybe QueryStringObject
forwardedHeaders :: Maybe HeaderObject
forwardedCookies :: Maybe CookieObject
defaultTTL :: Maybe Integer
cachedHTTPMethods :: Maybe Text
allowedHTTPMethods :: Maybe Text
$sel:minimumTTL:CacheSettings' :: CacheSettings -> Maybe Integer
$sel:maximumTTL:CacheSettings' :: CacheSettings -> Maybe Integer
$sel:forwardedQueryStrings:CacheSettings' :: CacheSettings -> Maybe QueryStringObject
$sel:forwardedHeaders:CacheSettings' :: CacheSettings -> Maybe HeaderObject
$sel:forwardedCookies:CacheSettings' :: CacheSettings -> Maybe CookieObject
$sel:defaultTTL:CacheSettings' :: CacheSettings -> Maybe Integer
$sel:cachedHTTPMethods:CacheSettings' :: CacheSettings -> Maybe Text
$sel:allowedHTTPMethods:CacheSettings' :: CacheSettings -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
allowedHTTPMethods
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cachedHTTPMethods
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
defaultTTL
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CookieObject
forwardedCookies
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HeaderObject
forwardedHeaders
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe QueryStringObject
forwardedQueryStrings
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
maximumTTL
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
minimumTTL
instance Prelude.NFData CacheSettings where
rnf :: CacheSettings -> ()
rnf CacheSettings' {Maybe Integer
Maybe Text
Maybe CookieObject
Maybe HeaderObject
Maybe QueryStringObject
minimumTTL :: Maybe Integer
maximumTTL :: Maybe Integer
forwardedQueryStrings :: Maybe QueryStringObject
forwardedHeaders :: Maybe HeaderObject
forwardedCookies :: Maybe CookieObject
defaultTTL :: Maybe Integer
cachedHTTPMethods :: Maybe Text
allowedHTTPMethods :: Maybe Text
$sel:minimumTTL:CacheSettings' :: CacheSettings -> Maybe Integer
$sel:maximumTTL:CacheSettings' :: CacheSettings -> Maybe Integer
$sel:forwardedQueryStrings:CacheSettings' :: CacheSettings -> Maybe QueryStringObject
$sel:forwardedHeaders:CacheSettings' :: CacheSettings -> Maybe HeaderObject
$sel:forwardedCookies:CacheSettings' :: CacheSettings -> Maybe CookieObject
$sel:defaultTTL:CacheSettings' :: CacheSettings -> Maybe Integer
$sel:cachedHTTPMethods:CacheSettings' :: CacheSettings -> Maybe Text
$sel:allowedHTTPMethods:CacheSettings' :: CacheSettings -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
allowedHTTPMethods
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cachedHTTPMethods
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
defaultTTL
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CookieObject
forwardedCookies
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HeaderObject
forwardedHeaders
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe QueryStringObject
forwardedQueryStrings
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
maximumTTL
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
minimumTTL
instance Data.ToJSON CacheSettings where
toJSON :: CacheSettings -> Value
toJSON CacheSettings' {Maybe Integer
Maybe Text
Maybe CookieObject
Maybe HeaderObject
Maybe QueryStringObject
minimumTTL :: Maybe Integer
maximumTTL :: Maybe Integer
forwardedQueryStrings :: Maybe QueryStringObject
forwardedHeaders :: Maybe HeaderObject
forwardedCookies :: Maybe CookieObject
defaultTTL :: Maybe Integer
cachedHTTPMethods :: Maybe Text
allowedHTTPMethods :: Maybe Text
$sel:minimumTTL:CacheSettings' :: CacheSettings -> Maybe Integer
$sel:maximumTTL:CacheSettings' :: CacheSettings -> Maybe Integer
$sel:forwardedQueryStrings:CacheSettings' :: CacheSettings -> Maybe QueryStringObject
$sel:forwardedHeaders:CacheSettings' :: CacheSettings -> Maybe HeaderObject
$sel:forwardedCookies:CacheSettings' :: CacheSettings -> Maybe CookieObject
$sel:defaultTTL:CacheSettings' :: CacheSettings -> Maybe Integer
$sel:cachedHTTPMethods:CacheSettings' :: CacheSettings -> Maybe Text
$sel:allowedHTTPMethods:CacheSettings' :: CacheSettings -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"allowedHTTPMethods" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
allowedHTTPMethods,
(Key
"cachedHTTPMethods" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cachedHTTPMethods,
(Key
"defaultTTL" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
defaultTTL,
(Key
"forwardedCookies" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CookieObject
forwardedCookies,
(Key
"forwardedHeaders" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HeaderObject
forwardedHeaders,
(Key
"forwardedQueryStrings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe QueryStringObject
forwardedQueryStrings,
(Key
"maximumTTL" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
maximumTTL,
(Key
"minimumTTL" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
minimumTTL
]
)