{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Lightsail.Types.CacheSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
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

-- | Describes the cache settings of an Amazon Lightsail content delivery
-- network (CDN) distribution.
--
-- These settings apply only to your distribution\'s @cacheBehaviors@
-- (including the @defaultCacheBehavior@) that have a @behavior@ of
-- @cache@.
--
-- /See:/ 'newCacheSettings' smart constructor.
data CacheSettings = CacheSettings'
  { -- | The HTTP methods that are processed and forwarded to the distribution\'s
    -- origin.
    --
    -- You can specify the following options:
    --
    -- -   @GET,HEAD@ - The distribution forwards the @GET@ and @HEAD@ methods.
    --
    -- -   @GET,HEAD,OPTIONS@ - The distribution forwards the @GET@, @HEAD@,
    --     and @OPTIONS@ methods.
    --
    -- -   @GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE@ - The distribution forwards
    --     the @GET@, @HEAD@, @OPTIONS@, @PUT@, @PATCH@, @POST@, and @DELETE@
    --     methods.
    --
    -- If you specify the third option, you might need to restrict access to
    -- your distribution\'s origin so users can\'t perform operations that you
    -- don\'t want them to. For example, you might not want users to have
    -- permission to delete objects from your origin.
    CacheSettings -> Maybe Text
allowedHTTPMethods :: Prelude.Maybe Prelude.Text,
    -- | The HTTP method responses that are cached by your distribution.
    --
    -- You can specify the following options:
    --
    -- -   @GET,HEAD@ - The distribution caches responses to the @GET@ and
    --     @HEAD@ methods.
    --
    -- -   @GET,HEAD,OPTIONS@ - The distribution caches responses to the @GET@,
    --     @HEAD@, and @OPTIONS@ methods.
    CacheSettings -> Maybe Text
cachedHTTPMethods :: Prelude.Maybe Prelude.Text,
    -- | The default amount of time that objects stay in the distribution\'s
    -- cache before the distribution forwards another request to the origin to
    -- determine whether the content has been updated.
    --
    -- The value specified applies only when the origin does not add HTTP
    -- headers such as @Cache-Control max-age@, @Cache-Control s-maxage@, and
    -- @Expires@ to objects.
    CacheSettings -> Maybe Integer
defaultTTL :: Prelude.Maybe Prelude.Integer,
    -- | An object that describes the cookies that are forwarded to the origin.
    -- Your content is cached based on the cookies that are forwarded.
    CacheSettings -> Maybe CookieObject
forwardedCookies :: Prelude.Maybe CookieObject,
    -- | An object that describes the headers that are forwarded to the origin.
    -- Your content is cached based on the headers that are forwarded.
    CacheSettings -> Maybe HeaderObject
forwardedHeaders :: Prelude.Maybe HeaderObject,
    -- | An object that describes the query strings that are forwarded to the
    -- origin. Your content is cached based on the query strings that are
    -- forwarded.
    CacheSettings -> Maybe QueryStringObject
forwardedQueryStrings :: Prelude.Maybe QueryStringObject,
    -- | The maximum amount of time that objects stay in the distribution\'s
    -- cache before the distribution forwards another request to the origin to
    -- determine whether the object has been updated.
    --
    -- The value specified applies only when the origin adds HTTP headers such
    -- as @Cache-Control max-age@, @Cache-Control s-maxage@, and @Expires@ to
    -- objects.
    CacheSettings -> Maybe Integer
maximumTTL :: Prelude.Maybe Prelude.Integer,
    -- | The minimum amount of time that objects stay in the distribution\'s
    -- cache before the distribution forwards another request to the origin to
    -- determine whether the object has been updated.
    --
    -- A value of @0@ must be specified for @minimumTTL@ if the distribution is
    -- configured to forward all headers to the origin.
    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)

-- |
-- Create a value of 'CacheSettings' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'allowedHTTPMethods', 'cacheSettings_allowedHTTPMethods' - The HTTP methods that are processed and forwarded to the distribution\'s
-- origin.
--
-- You can specify the following options:
--
-- -   @GET,HEAD@ - The distribution forwards the @GET@ and @HEAD@ methods.
--
-- -   @GET,HEAD,OPTIONS@ - The distribution forwards the @GET@, @HEAD@,
--     and @OPTIONS@ methods.
--
-- -   @GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE@ - The distribution forwards
--     the @GET@, @HEAD@, @OPTIONS@, @PUT@, @PATCH@, @POST@, and @DELETE@
--     methods.
--
-- If you specify the third option, you might need to restrict access to
-- your distribution\'s origin so users can\'t perform operations that you
-- don\'t want them to. For example, you might not want users to have
-- permission to delete objects from your origin.
--
-- 'cachedHTTPMethods', 'cacheSettings_cachedHTTPMethods' - The HTTP method responses that are cached by your distribution.
--
-- You can specify the following options:
--
-- -   @GET,HEAD@ - The distribution caches responses to the @GET@ and
--     @HEAD@ methods.
--
-- -   @GET,HEAD,OPTIONS@ - The distribution caches responses to the @GET@,
--     @HEAD@, and @OPTIONS@ methods.
--
-- 'defaultTTL', 'cacheSettings_defaultTTL' - The default amount of time that objects stay in the distribution\'s
-- cache before the distribution forwards another request to the origin to
-- determine whether the content has been updated.
--
-- The value specified applies only when the origin does not add HTTP
-- headers such as @Cache-Control max-age@, @Cache-Control s-maxage@, and
-- @Expires@ to objects.
--
-- 'forwardedCookies', 'cacheSettings_forwardedCookies' - An object that describes the cookies that are forwarded to the origin.
-- Your content is cached based on the cookies that are forwarded.
--
-- 'forwardedHeaders', 'cacheSettings_forwardedHeaders' - An object that describes the headers that are forwarded to the origin.
-- Your content is cached based on the headers that are forwarded.
--
-- 'forwardedQueryStrings', 'cacheSettings_forwardedQueryStrings' - An object that describes the query strings that are forwarded to the
-- origin. Your content is cached based on the query strings that are
-- forwarded.
--
-- 'maximumTTL', 'cacheSettings_maximumTTL' - The maximum amount of time that objects stay in the distribution\'s
-- cache before the distribution forwards another request to the origin to
-- determine whether the object has been updated.
--
-- The value specified applies only when the origin adds HTTP headers such
-- as @Cache-Control max-age@, @Cache-Control s-maxage@, and @Expires@ to
-- objects.
--
-- 'minimumTTL', 'cacheSettings_minimumTTL' - The minimum amount of time that objects stay in the distribution\'s
-- cache before the distribution forwards another request to the origin to
-- determine whether the object has been updated.
--
-- A value of @0@ must be specified for @minimumTTL@ if the distribution is
-- configured to forward all headers to the origin.
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
    }

-- | The HTTP methods that are processed and forwarded to the distribution\'s
-- origin.
--
-- You can specify the following options:
--
-- -   @GET,HEAD@ - The distribution forwards the @GET@ and @HEAD@ methods.
--
-- -   @GET,HEAD,OPTIONS@ - The distribution forwards the @GET@, @HEAD@,
--     and @OPTIONS@ methods.
--
-- -   @GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE@ - The distribution forwards
--     the @GET@, @HEAD@, @OPTIONS@, @PUT@, @PATCH@, @POST@, and @DELETE@
--     methods.
--
-- If you specify the third option, you might need to restrict access to
-- your distribution\'s origin so users can\'t perform operations that you
-- don\'t want them to. For example, you might not want users to have
-- permission to delete objects from your origin.
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)

-- | The HTTP method responses that are cached by your distribution.
--
-- You can specify the following options:
--
-- -   @GET,HEAD@ - The distribution caches responses to the @GET@ and
--     @HEAD@ methods.
--
-- -   @GET,HEAD,OPTIONS@ - The distribution caches responses to the @GET@,
--     @HEAD@, and @OPTIONS@ methods.
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)

-- | The default amount of time that objects stay in the distribution\'s
-- cache before the distribution forwards another request to the origin to
-- determine whether the content has been updated.
--
-- The value specified applies only when the origin does not add HTTP
-- headers such as @Cache-Control max-age@, @Cache-Control s-maxage@, and
-- @Expires@ to objects.
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)

-- | An object that describes the cookies that are forwarded to the origin.
-- Your content is cached based on the cookies that are forwarded.
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)

-- | An object that describes the headers that are forwarded to the origin.
-- Your content is cached based on the headers that are forwarded.
cacheSettings_forwardedHeaders :: Lens.Lens' CacheSettings (Prelude.Maybe HeaderObject)
cacheSettings_forwardedHeaders :: Lens' CacheSettings (Maybe HeaderObject)
cacheSettings_forwardedHeaders = 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)

-- | An object that describes the query strings that are forwarded to the
-- origin. Your content is cached based on the query strings that are
-- forwarded.
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)

-- | The maximum amount of time that objects stay in the distribution\'s
-- cache before the distribution forwards another request to the origin to
-- determine whether the object has been updated.
--
-- The value specified applies only when the origin adds HTTP headers such
-- as @Cache-Control max-age@, @Cache-Control s-maxage@, and @Expires@ to
-- objects.
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)

-- | The minimum amount of time that objects stay in the distribution\'s
-- cache before the distribution forwards another request to the origin to
-- determine whether the object has been updated.
--
-- A value of @0@ must be specified for @minimumTTL@ if the distribution is
-- configured to forward all headers to the origin.
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
          ]
      )