{-# 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.CloudFront.Types.ParametersInCacheKeyAndForwardedToOrigin
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudFront.Types.ParametersInCacheKeyAndForwardedToOrigin where

import Amazonka.CloudFront.Types.CachePolicyCookiesConfig
import Amazonka.CloudFront.Types.CachePolicyHeadersConfig
import Amazonka.CloudFront.Types.CachePolicyQueryStringsConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | This object determines the values that CloudFront includes in the cache
-- key. These values can include HTTP headers, cookies, and URL query
-- strings. CloudFront uses the cache key to find an object in its cache
-- that it can return to the viewer.
--
-- The headers, cookies, and query strings that are included in the cache
-- key are automatically included in requests that CloudFront sends to the
-- origin. CloudFront sends a request when it can’t find an object in its
-- cache that matches the request’s cache key. If you want to send values
-- to the origin but /not/ include them in the cache key, use
-- @OriginRequestPolicy@.
--
-- /See:/ 'newParametersInCacheKeyAndForwardedToOrigin' smart constructor.
data ParametersInCacheKeyAndForwardedToOrigin = ParametersInCacheKeyAndForwardedToOrigin'
  { -- | A flag that can affect whether the @Accept-Encoding@ HTTP header is
    -- included in the cache key and included in requests that CloudFront sends
    -- to the origin.
    --
    -- This field is related to the @EnableAcceptEncodingGzip@ field. If one or
    -- both of these fields is @true@ /and/ the viewer request includes the
    -- @Accept-Encoding@ header, then CloudFront does the following:
    --
    -- -   Normalizes the value of the viewer’s @Accept-Encoding@ header
    --
    -- -   Includes the normalized header in the cache key
    --
    -- -   Includes the normalized header in the request to the origin, if a
    --     request is necessary
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-policy-compressed-objects Compression support>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- If you set this value to @true@, and this cache behavior also has an
    -- origin request policy attached, do not include the @Accept-Encoding@
    -- header in the origin request policy. CloudFront always includes the
    -- @Accept-Encoding@ header in origin requests when the value of this field
    -- is @true@, so including this header in an origin request policy has no
    -- effect.
    --
    -- If both of these fields are @false@, then CloudFront treats the
    -- @Accept-Encoding@ header the same as any other HTTP header in the viewer
    -- request. By default, it’s not included in the cache key and it’s not
    -- included in origin requests. In this case, you can manually add
    -- @Accept-Encoding@ to the headers whitelist like any other HTTP header.
    ParametersInCacheKeyAndForwardedToOrigin -> Maybe Bool
enableAcceptEncodingBrotli :: Prelude.Maybe Prelude.Bool,
    -- | A flag that can affect whether the @Accept-Encoding@ HTTP header is
    -- included in the cache key and included in requests that CloudFront sends
    -- to the origin.
    --
    -- This field is related to the @EnableAcceptEncodingBrotli@ field. If one
    -- or both of these fields is @true@ /and/ the viewer request includes the
    -- @Accept-Encoding@ header, then CloudFront does the following:
    --
    -- -   Normalizes the value of the viewer’s @Accept-Encoding@ header
    --
    -- -   Includes the normalized header in the cache key
    --
    -- -   Includes the normalized header in the request to the origin, if a
    --     request is necessary
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-policy-compressed-objects Compression support>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- If you set this value to @true@, and this cache behavior also has an
    -- origin request policy attached, do not include the @Accept-Encoding@
    -- header in the origin request policy. CloudFront always includes the
    -- @Accept-Encoding@ header in origin requests when the value of this field
    -- is @true@, so including this header in an origin request policy has no
    -- effect.
    --
    -- If both of these fields are @false@, then CloudFront treats the
    -- @Accept-Encoding@ header the same as any other HTTP header in the viewer
    -- request. By default, it’s not included in the cache key and it’s not
    -- included in origin requests. In this case, you can manually add
    -- @Accept-Encoding@ to the headers whitelist like any other HTTP header.
    ParametersInCacheKeyAndForwardedToOrigin -> Bool
enableAcceptEncodingGzip :: Prelude.Bool,
    -- | An object that determines whether any HTTP headers (and if so, which
    -- headers) are included in the cache key and automatically included in
    -- requests that CloudFront sends to the origin.
    ParametersInCacheKeyAndForwardedToOrigin
-> CachePolicyHeadersConfig
headersConfig :: CachePolicyHeadersConfig,
    -- | An object that determines whether any cookies in viewer requests (and if
    -- so, which cookies) are included in the cache key and automatically
    -- included in requests that CloudFront sends to the origin.
    ParametersInCacheKeyAndForwardedToOrigin
-> CachePolicyCookiesConfig
cookiesConfig :: CachePolicyCookiesConfig,
    -- | An object that determines whether any URL query strings in viewer
    -- requests (and if so, which query strings) are included in the cache key
    -- and automatically included in requests that CloudFront sends to the
    -- origin.
    ParametersInCacheKeyAndForwardedToOrigin
-> CachePolicyQueryStringsConfig
queryStringsConfig :: CachePolicyQueryStringsConfig
  }
  deriving (ParametersInCacheKeyAndForwardedToOrigin
-> ParametersInCacheKeyAndForwardedToOrigin -> Bool
(ParametersInCacheKeyAndForwardedToOrigin
 -> ParametersInCacheKeyAndForwardedToOrigin -> Bool)
-> (ParametersInCacheKeyAndForwardedToOrigin
    -> ParametersInCacheKeyAndForwardedToOrigin -> Bool)
-> Eq ParametersInCacheKeyAndForwardedToOrigin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParametersInCacheKeyAndForwardedToOrigin
-> ParametersInCacheKeyAndForwardedToOrigin -> Bool
$c/= :: ParametersInCacheKeyAndForwardedToOrigin
-> ParametersInCacheKeyAndForwardedToOrigin -> Bool
== :: ParametersInCacheKeyAndForwardedToOrigin
-> ParametersInCacheKeyAndForwardedToOrigin -> Bool
$c== :: ParametersInCacheKeyAndForwardedToOrigin
-> ParametersInCacheKeyAndForwardedToOrigin -> Bool
Prelude.Eq, ReadPrec [ParametersInCacheKeyAndForwardedToOrigin]
ReadPrec ParametersInCacheKeyAndForwardedToOrigin
Int -> ReadS ParametersInCacheKeyAndForwardedToOrigin
ReadS [ParametersInCacheKeyAndForwardedToOrigin]
(Int -> ReadS ParametersInCacheKeyAndForwardedToOrigin)
-> ReadS [ParametersInCacheKeyAndForwardedToOrigin]
-> ReadPrec ParametersInCacheKeyAndForwardedToOrigin
-> ReadPrec [ParametersInCacheKeyAndForwardedToOrigin]
-> Read ParametersInCacheKeyAndForwardedToOrigin
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParametersInCacheKeyAndForwardedToOrigin]
$creadListPrec :: ReadPrec [ParametersInCacheKeyAndForwardedToOrigin]
readPrec :: ReadPrec ParametersInCacheKeyAndForwardedToOrigin
$creadPrec :: ReadPrec ParametersInCacheKeyAndForwardedToOrigin
readList :: ReadS [ParametersInCacheKeyAndForwardedToOrigin]
$creadList :: ReadS [ParametersInCacheKeyAndForwardedToOrigin]
readsPrec :: Int -> ReadS ParametersInCacheKeyAndForwardedToOrigin
$creadsPrec :: Int -> ReadS ParametersInCacheKeyAndForwardedToOrigin
Prelude.Read, Int -> ParametersInCacheKeyAndForwardedToOrigin -> ShowS
[ParametersInCacheKeyAndForwardedToOrigin] -> ShowS
ParametersInCacheKeyAndForwardedToOrigin -> String
(Int -> ParametersInCacheKeyAndForwardedToOrigin -> ShowS)
-> (ParametersInCacheKeyAndForwardedToOrigin -> String)
-> ([ParametersInCacheKeyAndForwardedToOrigin] -> ShowS)
-> Show ParametersInCacheKeyAndForwardedToOrigin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParametersInCacheKeyAndForwardedToOrigin] -> ShowS
$cshowList :: [ParametersInCacheKeyAndForwardedToOrigin] -> ShowS
show :: ParametersInCacheKeyAndForwardedToOrigin -> String
$cshow :: ParametersInCacheKeyAndForwardedToOrigin -> String
showsPrec :: Int -> ParametersInCacheKeyAndForwardedToOrigin -> ShowS
$cshowsPrec :: Int -> ParametersInCacheKeyAndForwardedToOrigin -> ShowS
Prelude.Show, (forall x.
 ParametersInCacheKeyAndForwardedToOrigin
 -> Rep ParametersInCacheKeyAndForwardedToOrigin x)
-> (forall x.
    Rep ParametersInCacheKeyAndForwardedToOrigin x
    -> ParametersInCacheKeyAndForwardedToOrigin)
-> Generic ParametersInCacheKeyAndForwardedToOrigin
forall x.
Rep ParametersInCacheKeyAndForwardedToOrigin x
-> ParametersInCacheKeyAndForwardedToOrigin
forall x.
ParametersInCacheKeyAndForwardedToOrigin
-> Rep ParametersInCacheKeyAndForwardedToOrigin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ParametersInCacheKeyAndForwardedToOrigin x
-> ParametersInCacheKeyAndForwardedToOrigin
$cfrom :: forall x.
ParametersInCacheKeyAndForwardedToOrigin
-> Rep ParametersInCacheKeyAndForwardedToOrigin x
Prelude.Generic)

-- |
-- Create a value of 'ParametersInCacheKeyAndForwardedToOrigin' 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:
--
-- 'enableAcceptEncodingBrotli', 'parametersInCacheKeyAndForwardedToOrigin_enableAcceptEncodingBrotli' - A flag that can affect whether the @Accept-Encoding@ HTTP header is
-- included in the cache key and included in requests that CloudFront sends
-- to the origin.
--
-- This field is related to the @EnableAcceptEncodingGzip@ field. If one or
-- both of these fields is @true@ /and/ the viewer request includes the
-- @Accept-Encoding@ header, then CloudFront does the following:
--
-- -   Normalizes the value of the viewer’s @Accept-Encoding@ header
--
-- -   Includes the normalized header in the cache key
--
-- -   Includes the normalized header in the request to the origin, if a
--     request is necessary
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-policy-compressed-objects Compression support>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you set this value to @true@, and this cache behavior also has an
-- origin request policy attached, do not include the @Accept-Encoding@
-- header in the origin request policy. CloudFront always includes the
-- @Accept-Encoding@ header in origin requests when the value of this field
-- is @true@, so including this header in an origin request policy has no
-- effect.
--
-- If both of these fields are @false@, then CloudFront treats the
-- @Accept-Encoding@ header the same as any other HTTP header in the viewer
-- request. By default, it’s not included in the cache key and it’s not
-- included in origin requests. In this case, you can manually add
-- @Accept-Encoding@ to the headers whitelist like any other HTTP header.
--
-- 'enableAcceptEncodingGzip', 'parametersInCacheKeyAndForwardedToOrigin_enableAcceptEncodingGzip' - A flag that can affect whether the @Accept-Encoding@ HTTP header is
-- included in the cache key and included in requests that CloudFront sends
-- to the origin.
--
-- This field is related to the @EnableAcceptEncodingBrotli@ field. If one
-- or both of these fields is @true@ /and/ the viewer request includes the
-- @Accept-Encoding@ header, then CloudFront does the following:
--
-- -   Normalizes the value of the viewer’s @Accept-Encoding@ header
--
-- -   Includes the normalized header in the cache key
--
-- -   Includes the normalized header in the request to the origin, if a
--     request is necessary
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-policy-compressed-objects Compression support>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you set this value to @true@, and this cache behavior also has an
-- origin request policy attached, do not include the @Accept-Encoding@
-- header in the origin request policy. CloudFront always includes the
-- @Accept-Encoding@ header in origin requests when the value of this field
-- is @true@, so including this header in an origin request policy has no
-- effect.
--
-- If both of these fields are @false@, then CloudFront treats the
-- @Accept-Encoding@ header the same as any other HTTP header in the viewer
-- request. By default, it’s not included in the cache key and it’s not
-- included in origin requests. In this case, you can manually add
-- @Accept-Encoding@ to the headers whitelist like any other HTTP header.
--
-- 'headersConfig', 'parametersInCacheKeyAndForwardedToOrigin_headersConfig' - An object that determines whether any HTTP headers (and if so, which
-- headers) are included in the cache key and automatically included in
-- requests that CloudFront sends to the origin.
--
-- 'cookiesConfig', 'parametersInCacheKeyAndForwardedToOrigin_cookiesConfig' - An object that determines whether any cookies in viewer requests (and if
-- so, which cookies) are included in the cache key and automatically
-- included in requests that CloudFront sends to the origin.
--
-- 'queryStringsConfig', 'parametersInCacheKeyAndForwardedToOrigin_queryStringsConfig' - An object that determines whether any URL query strings in viewer
-- requests (and if so, which query strings) are included in the cache key
-- and automatically included in requests that CloudFront sends to the
-- origin.
newParametersInCacheKeyAndForwardedToOrigin ::
  -- | 'enableAcceptEncodingGzip'
  Prelude.Bool ->
  -- | 'headersConfig'
  CachePolicyHeadersConfig ->
  -- | 'cookiesConfig'
  CachePolicyCookiesConfig ->
  -- | 'queryStringsConfig'
  CachePolicyQueryStringsConfig ->
  ParametersInCacheKeyAndForwardedToOrigin
newParametersInCacheKeyAndForwardedToOrigin :: Bool
-> CachePolicyHeadersConfig
-> CachePolicyCookiesConfig
-> CachePolicyQueryStringsConfig
-> ParametersInCacheKeyAndForwardedToOrigin
newParametersInCacheKeyAndForwardedToOrigin
  Bool
pEnableAcceptEncodingGzip_
  CachePolicyHeadersConfig
pHeadersConfig_
  CachePolicyCookiesConfig
pCookiesConfig_
  CachePolicyQueryStringsConfig
pQueryStringsConfig_ =
    ParametersInCacheKeyAndForwardedToOrigin' :: Maybe Bool
-> Bool
-> CachePolicyHeadersConfig
-> CachePolicyCookiesConfig
-> CachePolicyQueryStringsConfig
-> ParametersInCacheKeyAndForwardedToOrigin
ParametersInCacheKeyAndForwardedToOrigin'
      { $sel:enableAcceptEncodingBrotli:ParametersInCacheKeyAndForwardedToOrigin' :: Maybe Bool
enableAcceptEncodingBrotli =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:enableAcceptEncodingGzip:ParametersInCacheKeyAndForwardedToOrigin' :: Bool
enableAcceptEncodingGzip =
          Bool
pEnableAcceptEncodingGzip_,
        $sel:headersConfig:ParametersInCacheKeyAndForwardedToOrigin' :: CachePolicyHeadersConfig
headersConfig = CachePolicyHeadersConfig
pHeadersConfig_,
        $sel:cookiesConfig:ParametersInCacheKeyAndForwardedToOrigin' :: CachePolicyCookiesConfig
cookiesConfig = CachePolicyCookiesConfig
pCookiesConfig_,
        $sel:queryStringsConfig:ParametersInCacheKeyAndForwardedToOrigin' :: CachePolicyQueryStringsConfig
queryStringsConfig =
          CachePolicyQueryStringsConfig
pQueryStringsConfig_
      }

-- | A flag that can affect whether the @Accept-Encoding@ HTTP header is
-- included in the cache key and included in requests that CloudFront sends
-- to the origin.
--
-- This field is related to the @EnableAcceptEncodingGzip@ field. If one or
-- both of these fields is @true@ /and/ the viewer request includes the
-- @Accept-Encoding@ header, then CloudFront does the following:
--
-- -   Normalizes the value of the viewer’s @Accept-Encoding@ header
--
-- -   Includes the normalized header in the cache key
--
-- -   Includes the normalized header in the request to the origin, if a
--     request is necessary
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-policy-compressed-objects Compression support>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you set this value to @true@, and this cache behavior also has an
-- origin request policy attached, do not include the @Accept-Encoding@
-- header in the origin request policy. CloudFront always includes the
-- @Accept-Encoding@ header in origin requests when the value of this field
-- is @true@, so including this header in an origin request policy has no
-- effect.
--
-- If both of these fields are @false@, then CloudFront treats the
-- @Accept-Encoding@ header the same as any other HTTP header in the viewer
-- request. By default, it’s not included in the cache key and it’s not
-- included in origin requests. In this case, you can manually add
-- @Accept-Encoding@ to the headers whitelist like any other HTTP header.
parametersInCacheKeyAndForwardedToOrigin_enableAcceptEncodingBrotli :: Lens.Lens' ParametersInCacheKeyAndForwardedToOrigin (Prelude.Maybe Prelude.Bool)
parametersInCacheKeyAndForwardedToOrigin_enableAcceptEncodingBrotli :: (Maybe Bool -> f (Maybe Bool))
-> ParametersInCacheKeyAndForwardedToOrigin
-> f ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin_enableAcceptEncodingBrotli = (ParametersInCacheKeyAndForwardedToOrigin -> Maybe Bool)
-> (ParametersInCacheKeyAndForwardedToOrigin
    -> Maybe Bool -> ParametersInCacheKeyAndForwardedToOrigin)
-> Lens
     ParametersInCacheKeyAndForwardedToOrigin
     ParametersInCacheKeyAndForwardedToOrigin
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParametersInCacheKeyAndForwardedToOrigin' {Maybe Bool
enableAcceptEncodingBrotli :: Maybe Bool
$sel:enableAcceptEncodingBrotli:ParametersInCacheKeyAndForwardedToOrigin' :: ParametersInCacheKeyAndForwardedToOrigin -> Maybe Bool
enableAcceptEncodingBrotli} -> Maybe Bool
enableAcceptEncodingBrotli) (\s :: ParametersInCacheKeyAndForwardedToOrigin
s@ParametersInCacheKeyAndForwardedToOrigin' {} Maybe Bool
a -> ParametersInCacheKeyAndForwardedToOrigin
s {$sel:enableAcceptEncodingBrotli:ParametersInCacheKeyAndForwardedToOrigin' :: Maybe Bool
enableAcceptEncodingBrotli = Maybe Bool
a} :: ParametersInCacheKeyAndForwardedToOrigin)

-- | A flag that can affect whether the @Accept-Encoding@ HTTP header is
-- included in the cache key and included in requests that CloudFront sends
-- to the origin.
--
-- This field is related to the @EnableAcceptEncodingBrotli@ field. If one
-- or both of these fields is @true@ /and/ the viewer request includes the
-- @Accept-Encoding@ header, then CloudFront does the following:
--
-- -   Normalizes the value of the viewer’s @Accept-Encoding@ header
--
-- -   Includes the normalized header in the cache key
--
-- -   Includes the normalized header in the request to the origin, if a
--     request is necessary
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-policy-compressed-objects Compression support>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you set this value to @true@, and this cache behavior also has an
-- origin request policy attached, do not include the @Accept-Encoding@
-- header in the origin request policy. CloudFront always includes the
-- @Accept-Encoding@ header in origin requests when the value of this field
-- is @true@, so including this header in an origin request policy has no
-- effect.
--
-- If both of these fields are @false@, then CloudFront treats the
-- @Accept-Encoding@ header the same as any other HTTP header in the viewer
-- request. By default, it’s not included in the cache key and it’s not
-- included in origin requests. In this case, you can manually add
-- @Accept-Encoding@ to the headers whitelist like any other HTTP header.
parametersInCacheKeyAndForwardedToOrigin_enableAcceptEncodingGzip :: Lens.Lens' ParametersInCacheKeyAndForwardedToOrigin Prelude.Bool
parametersInCacheKeyAndForwardedToOrigin_enableAcceptEncodingGzip :: (Bool -> f Bool)
-> ParametersInCacheKeyAndForwardedToOrigin
-> f ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin_enableAcceptEncodingGzip = (ParametersInCacheKeyAndForwardedToOrigin -> Bool)
-> (ParametersInCacheKeyAndForwardedToOrigin
    -> Bool -> ParametersInCacheKeyAndForwardedToOrigin)
-> Lens
     ParametersInCacheKeyAndForwardedToOrigin
     ParametersInCacheKeyAndForwardedToOrigin
     Bool
     Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParametersInCacheKeyAndForwardedToOrigin' {Bool
enableAcceptEncodingGzip :: Bool
$sel:enableAcceptEncodingGzip:ParametersInCacheKeyAndForwardedToOrigin' :: ParametersInCacheKeyAndForwardedToOrigin -> Bool
enableAcceptEncodingGzip} -> Bool
enableAcceptEncodingGzip) (\s :: ParametersInCacheKeyAndForwardedToOrigin
s@ParametersInCacheKeyAndForwardedToOrigin' {} Bool
a -> ParametersInCacheKeyAndForwardedToOrigin
s {$sel:enableAcceptEncodingGzip:ParametersInCacheKeyAndForwardedToOrigin' :: Bool
enableAcceptEncodingGzip = Bool
a} :: ParametersInCacheKeyAndForwardedToOrigin)

-- | An object that determines whether any HTTP headers (and if so, which
-- headers) are included in the cache key and automatically included in
-- requests that CloudFront sends to the origin.
parametersInCacheKeyAndForwardedToOrigin_headersConfig :: Lens.Lens' ParametersInCacheKeyAndForwardedToOrigin CachePolicyHeadersConfig
parametersInCacheKeyAndForwardedToOrigin_headersConfig :: (CachePolicyHeadersConfig -> f CachePolicyHeadersConfig)
-> ParametersInCacheKeyAndForwardedToOrigin
-> f ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin_headersConfig = (ParametersInCacheKeyAndForwardedToOrigin
 -> CachePolicyHeadersConfig)
-> (ParametersInCacheKeyAndForwardedToOrigin
    -> CachePolicyHeadersConfig
    -> ParametersInCacheKeyAndForwardedToOrigin)
-> Lens
     ParametersInCacheKeyAndForwardedToOrigin
     ParametersInCacheKeyAndForwardedToOrigin
     CachePolicyHeadersConfig
     CachePolicyHeadersConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParametersInCacheKeyAndForwardedToOrigin' {CachePolicyHeadersConfig
headersConfig :: CachePolicyHeadersConfig
$sel:headersConfig:ParametersInCacheKeyAndForwardedToOrigin' :: ParametersInCacheKeyAndForwardedToOrigin
-> CachePolicyHeadersConfig
headersConfig} -> CachePolicyHeadersConfig
headersConfig) (\s :: ParametersInCacheKeyAndForwardedToOrigin
s@ParametersInCacheKeyAndForwardedToOrigin' {} CachePolicyHeadersConfig
a -> ParametersInCacheKeyAndForwardedToOrigin
s {$sel:headersConfig:ParametersInCacheKeyAndForwardedToOrigin' :: CachePolicyHeadersConfig
headersConfig = CachePolicyHeadersConfig
a} :: ParametersInCacheKeyAndForwardedToOrigin)

-- | An object that determines whether any cookies in viewer requests (and if
-- so, which cookies) are included in the cache key and automatically
-- included in requests that CloudFront sends to the origin.
parametersInCacheKeyAndForwardedToOrigin_cookiesConfig :: Lens.Lens' ParametersInCacheKeyAndForwardedToOrigin CachePolicyCookiesConfig
parametersInCacheKeyAndForwardedToOrigin_cookiesConfig :: (CachePolicyCookiesConfig -> f CachePolicyCookiesConfig)
-> ParametersInCacheKeyAndForwardedToOrigin
-> f ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin_cookiesConfig = (ParametersInCacheKeyAndForwardedToOrigin
 -> CachePolicyCookiesConfig)
-> (ParametersInCacheKeyAndForwardedToOrigin
    -> CachePolicyCookiesConfig
    -> ParametersInCacheKeyAndForwardedToOrigin)
-> Lens
     ParametersInCacheKeyAndForwardedToOrigin
     ParametersInCacheKeyAndForwardedToOrigin
     CachePolicyCookiesConfig
     CachePolicyCookiesConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParametersInCacheKeyAndForwardedToOrigin' {CachePolicyCookiesConfig
cookiesConfig :: CachePolicyCookiesConfig
$sel:cookiesConfig:ParametersInCacheKeyAndForwardedToOrigin' :: ParametersInCacheKeyAndForwardedToOrigin
-> CachePolicyCookiesConfig
cookiesConfig} -> CachePolicyCookiesConfig
cookiesConfig) (\s :: ParametersInCacheKeyAndForwardedToOrigin
s@ParametersInCacheKeyAndForwardedToOrigin' {} CachePolicyCookiesConfig
a -> ParametersInCacheKeyAndForwardedToOrigin
s {$sel:cookiesConfig:ParametersInCacheKeyAndForwardedToOrigin' :: CachePolicyCookiesConfig
cookiesConfig = CachePolicyCookiesConfig
a} :: ParametersInCacheKeyAndForwardedToOrigin)

-- | An object that determines whether any URL query strings in viewer
-- requests (and if so, which query strings) are included in the cache key
-- and automatically included in requests that CloudFront sends to the
-- origin.
parametersInCacheKeyAndForwardedToOrigin_queryStringsConfig :: Lens.Lens' ParametersInCacheKeyAndForwardedToOrigin CachePolicyQueryStringsConfig
parametersInCacheKeyAndForwardedToOrigin_queryStringsConfig :: (CachePolicyQueryStringsConfig -> f CachePolicyQueryStringsConfig)
-> ParametersInCacheKeyAndForwardedToOrigin
-> f ParametersInCacheKeyAndForwardedToOrigin
parametersInCacheKeyAndForwardedToOrigin_queryStringsConfig = (ParametersInCacheKeyAndForwardedToOrigin
 -> CachePolicyQueryStringsConfig)
-> (ParametersInCacheKeyAndForwardedToOrigin
    -> CachePolicyQueryStringsConfig
    -> ParametersInCacheKeyAndForwardedToOrigin)
-> Lens
     ParametersInCacheKeyAndForwardedToOrigin
     ParametersInCacheKeyAndForwardedToOrigin
     CachePolicyQueryStringsConfig
     CachePolicyQueryStringsConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParametersInCacheKeyAndForwardedToOrigin' {CachePolicyQueryStringsConfig
queryStringsConfig :: CachePolicyQueryStringsConfig
$sel:queryStringsConfig:ParametersInCacheKeyAndForwardedToOrigin' :: ParametersInCacheKeyAndForwardedToOrigin
-> CachePolicyQueryStringsConfig
queryStringsConfig} -> CachePolicyQueryStringsConfig
queryStringsConfig) (\s :: ParametersInCacheKeyAndForwardedToOrigin
s@ParametersInCacheKeyAndForwardedToOrigin' {} CachePolicyQueryStringsConfig
a -> ParametersInCacheKeyAndForwardedToOrigin
s {$sel:queryStringsConfig:ParametersInCacheKeyAndForwardedToOrigin' :: CachePolicyQueryStringsConfig
queryStringsConfig = CachePolicyQueryStringsConfig
a} :: ParametersInCacheKeyAndForwardedToOrigin)

instance
  Core.FromXML
    ParametersInCacheKeyAndForwardedToOrigin
  where
  parseXML :: [Node] -> Either String ParametersInCacheKeyAndForwardedToOrigin
parseXML [Node]
x =
    Maybe Bool
-> Bool
-> CachePolicyHeadersConfig
-> CachePolicyCookiesConfig
-> CachePolicyQueryStringsConfig
-> ParametersInCacheKeyAndForwardedToOrigin
ParametersInCacheKeyAndForwardedToOrigin'
      (Maybe Bool
 -> Bool
 -> CachePolicyHeadersConfig
 -> CachePolicyCookiesConfig
 -> CachePolicyQueryStringsConfig
 -> ParametersInCacheKeyAndForwardedToOrigin)
-> Either String (Maybe Bool)
-> Either
     String
     (Bool
      -> CachePolicyHeadersConfig
      -> CachePolicyCookiesConfig
      -> CachePolicyQueryStringsConfig
      -> ParametersInCacheKeyAndForwardedToOrigin)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EnableAcceptEncodingBrotli")
        Either
  String
  (Bool
   -> CachePolicyHeadersConfig
   -> CachePolicyCookiesConfig
   -> CachePolicyQueryStringsConfig
   -> ParametersInCacheKeyAndForwardedToOrigin)
-> Either String Bool
-> Either
     String
     (CachePolicyHeadersConfig
      -> CachePolicyCookiesConfig
      -> CachePolicyQueryStringsConfig
      -> ParametersInCacheKeyAndForwardedToOrigin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Bool
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"EnableAcceptEncodingGzip")
        Either
  String
  (CachePolicyHeadersConfig
   -> CachePolicyCookiesConfig
   -> CachePolicyQueryStringsConfig
   -> ParametersInCacheKeyAndForwardedToOrigin)
-> Either String CachePolicyHeadersConfig
-> Either
     String
     (CachePolicyCookiesConfig
      -> CachePolicyQueryStringsConfig
      -> ParametersInCacheKeyAndForwardedToOrigin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String CachePolicyHeadersConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HeadersConfig")
        Either
  String
  (CachePolicyCookiesConfig
   -> CachePolicyQueryStringsConfig
   -> ParametersInCacheKeyAndForwardedToOrigin)
-> Either String CachePolicyCookiesConfig
-> Either
     String
     (CachePolicyQueryStringsConfig
      -> ParametersInCacheKeyAndForwardedToOrigin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String CachePolicyCookiesConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CookiesConfig")
        Either
  String
  (CachePolicyQueryStringsConfig
   -> ParametersInCacheKeyAndForwardedToOrigin)
-> Either String CachePolicyQueryStringsConfig
-> Either String ParametersInCacheKeyAndForwardedToOrigin
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String CachePolicyQueryStringsConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"QueryStringsConfig")

instance
  Prelude.Hashable
    ParametersInCacheKeyAndForwardedToOrigin

instance
  Prelude.NFData
    ParametersInCacheKeyAndForwardedToOrigin

instance
  Core.ToXML
    ParametersInCacheKeyAndForwardedToOrigin
  where
  toXML :: ParametersInCacheKeyAndForwardedToOrigin -> XML
toXML ParametersInCacheKeyAndForwardedToOrigin' {Bool
Maybe Bool
CachePolicyCookiesConfig
CachePolicyHeadersConfig
CachePolicyQueryStringsConfig
queryStringsConfig :: CachePolicyQueryStringsConfig
cookiesConfig :: CachePolicyCookiesConfig
headersConfig :: CachePolicyHeadersConfig
enableAcceptEncodingGzip :: Bool
enableAcceptEncodingBrotli :: Maybe Bool
$sel:queryStringsConfig:ParametersInCacheKeyAndForwardedToOrigin' :: ParametersInCacheKeyAndForwardedToOrigin
-> CachePolicyQueryStringsConfig
$sel:cookiesConfig:ParametersInCacheKeyAndForwardedToOrigin' :: ParametersInCacheKeyAndForwardedToOrigin
-> CachePolicyCookiesConfig
$sel:headersConfig:ParametersInCacheKeyAndForwardedToOrigin' :: ParametersInCacheKeyAndForwardedToOrigin
-> CachePolicyHeadersConfig
$sel:enableAcceptEncodingGzip:ParametersInCacheKeyAndForwardedToOrigin' :: ParametersInCacheKeyAndForwardedToOrigin -> Bool
$sel:enableAcceptEncodingBrotli:ParametersInCacheKeyAndForwardedToOrigin' :: ParametersInCacheKeyAndForwardedToOrigin -> Maybe Bool
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"EnableAcceptEncodingBrotli"
          Name -> Maybe Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Bool
enableAcceptEncodingBrotli,
        Name
"EnableAcceptEncodingGzip"
          Name -> Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Bool
enableAcceptEncodingGzip,
        Name
"HeadersConfig" Name -> CachePolicyHeadersConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= CachePolicyHeadersConfig
headersConfig,
        Name
"CookiesConfig" Name -> CachePolicyCookiesConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= CachePolicyCookiesConfig
cookiesConfig,
        Name
"QueryStringsConfig" Name -> CachePolicyQueryStringsConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= CachePolicyQueryStringsConfig
queryStringsConfig
      ]