{-# 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.CacheBehavior
-- 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.CacheBehavior where

import Amazonka.CloudFront.Types.AllowedMethods
import Amazonka.CloudFront.Types.ForwardedValues
import Amazonka.CloudFront.Types.FunctionAssociations
import Amazonka.CloudFront.Types.LambdaFunctionAssociations
import Amazonka.CloudFront.Types.TrustedKeyGroups
import Amazonka.CloudFront.Types.TrustedSigners
import Amazonka.CloudFront.Types.ViewerProtocolPolicy
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A complex type that describes how CloudFront processes requests.
--
-- You must create at least as many cache behaviors (including the default
-- cache behavior) as you have origins if you want CloudFront to serve
-- objects from all of the origins. Each cache behavior specifies the one
-- origin from which you want CloudFront to get objects. If you have two
-- origins and only the default cache behavior, the default cache behavior
-- will cause CloudFront to get objects from one of the origins, but the
-- other origin is never used.
--
-- For the current quota (formerly known as limit) on the number of cache
-- behaviors that you can add to a distribution, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html Quotas>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you don’t want to specify any cache behaviors, include only an empty
-- @CacheBehaviors@ element. Don’t include an empty @CacheBehavior@ element
-- because this is invalid.
--
-- To delete all cache behaviors in an existing distribution, update the
-- distribution configuration and include only an empty @CacheBehaviors@
-- element.
--
-- To add, change, or remove one or more cache behaviors, update the
-- distribution configuration and specify all of the cache behaviors that
-- you want to include in the updated distribution.
--
-- For more information about cache behaviors, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesCacheBehavior Cache Behavior Settings>
-- in the /Amazon CloudFront Developer Guide/.
--
-- /See:/ 'newCacheBehavior' smart constructor.
data CacheBehavior = CacheBehavior'
  { CacheBehavior -> Maybe AllowedMethods
allowedMethods :: Prelude.Maybe AllowedMethods,
    -- | A complex type that contains zero or more Lambda\@Edge function
    -- associations for a cache behavior.
    CacheBehavior -> Maybe LambdaFunctionAssociations
lambdaFunctionAssociations :: Prelude.Maybe LambdaFunctionAssociations,
    -- | This field is deprecated. We recommend that you use the @MaxTTL@ field
    -- in a cache policy instead of this field. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
    -- or
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- The maximum amount of time that you want objects to stay in CloudFront
    -- caches before CloudFront forwards another request to your origin to
    -- determine whether the object has been updated. The value that you
    -- specify applies only when your origin adds HTTP headers such as
    -- @Cache-Control max-age@, @Cache-Control s-maxage@, and @Expires@ to
    -- objects. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing How Long Content Stays in an Edge Cache (Expiration)>
    -- in the /Amazon CloudFront Developer Guide/.
    CacheBehavior -> Maybe Integer
maxTTL :: Prelude.Maybe Prelude.Integer,
    -- | This field is deprecated. We recommend that you use the @MinTTL@ field
    -- in a cache policy instead of this field. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
    -- or
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- The minimum amount of time that you want objects to stay in CloudFront
    -- caches before CloudFront forwards another request to your origin to
    -- determine whether the object has been updated. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing How Long Content Stays in an Edge Cache (Expiration)>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- You must specify @0@ for @MinTTL@ if you configure CloudFront to forward
    -- all headers to your origin (under @Headers@, if you specify @1@ for
    -- @Quantity@ and @*@ for @Name@).
    CacheBehavior -> Maybe Integer
minTTL :: Prelude.Maybe Prelude.Integer,
    -- | Whether you want CloudFront to automatically compress certain files for
    -- this cache behavior. If so, specify true; if not, specify false. For
    -- more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html Serving Compressed Files>
    -- in the /Amazon CloudFront Developer Guide/.
    CacheBehavior -> Maybe Bool
compress :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether you want to distribute media files in the Microsoft
    -- Smooth Streaming format using the origin that is associated with this
    -- cache behavior. If so, specify @true@; if not, specify @false@. If you
    -- specify @true@ for @SmoothStreaming@, you can still distribute other
    -- content using this cache behavior if the content matches the value of
    -- @PathPattern@.
    CacheBehavior -> Maybe Bool
smoothStreaming :: Prelude.Maybe Prelude.Bool,
    -- | A list of key groups that CloudFront can use to validate signed URLs or
    -- signed cookies.
    --
    -- When a cache behavior contains trusted key groups, CloudFront requires
    -- signed URLs or signed cookies for all requests that match the cache
    -- behavior. The URLs or cookies must be signed with a private key whose
    -- corresponding public key is in the key group. The signed URL or cookie
    -- contains information about which public key CloudFront should use to
    -- verify the signature. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html Serving private content>
    -- in the /Amazon CloudFront Developer Guide/.
    CacheBehavior -> Maybe TrustedKeyGroups
trustedKeyGroups :: Prelude.Maybe TrustedKeyGroups,
    -- | The Amazon Resource Name (ARN) of the real-time log configuration that
    -- is attached to this cache behavior. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html Real-time logs>
    -- in the /Amazon CloudFront Developer Guide/.
    CacheBehavior -> Maybe Text
realtimeLogConfigArn :: Prelude.Maybe Prelude.Text,
    -- | This field is deprecated. We recommend that you use the @DefaultTTL@
    -- field in a cache policy instead of this field. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
    -- or
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- The default amount of time that you want objects to stay in CloudFront
    -- caches before CloudFront forwards another request to your origin to
    -- determine whether the object has been updated. The value that you
    -- specify applies only when your origin does not add HTTP headers such as
    -- @Cache-Control max-age@, @Cache-Control s-maxage@, and @Expires@ to
    -- objects. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing How Long Content Stays in an Edge Cache (Expiration)>
    -- in the /Amazon CloudFront Developer Guide/.
    CacheBehavior -> Maybe Integer
defaultTTL :: Prelude.Maybe Prelude.Integer,
    -- | This field is deprecated. We recommend that you use a cache policy or an
    -- origin request policy instead of this field. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/working-with-policies.html Working with policies>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- If you want to include values in the cache key, use a cache policy. For
    -- more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
    -- or
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- If you want to send values to the origin but not include them in the
    -- cache key, use an origin request policy. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html#origin-request-create-origin-request-policy Creating origin request policies>
    -- or
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html Using the managed origin request policies>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- A @CacheBehavior@ must include either a @CachePolicyId@ or
    -- @ForwardedValues@. We recommend that you use a @CachePolicyId@.
    --
    -- A complex type that specifies how CloudFront handles query strings,
    -- cookies, and HTTP headers.
    CacheBehavior -> Maybe ForwardedValues
forwardedValues :: Prelude.Maybe ForwardedValues,
    -- | We recommend using @TrustedKeyGroups@ instead of @TrustedSigners@.
    --
    -- A list of account IDs whose public keys CloudFront can use to validate
    -- signed URLs or signed cookies.
    --
    -- When a cache behavior contains trusted signers, CloudFront requires
    -- signed URLs or signed cookies for all requests that match the cache
    -- behavior. The URLs or cookies must be signed with the private key of a
    -- CloudFront key pair in the trusted signer’s account. The signed URL or
    -- cookie contains information about which public key CloudFront should use
    -- to verify the signature. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html Serving private content>
    -- in the /Amazon CloudFront Developer Guide/.
    CacheBehavior -> Maybe TrustedSigners
trustedSigners :: Prelude.Maybe TrustedSigners,
    -- | A list of CloudFront functions that are associated with this cache
    -- behavior. CloudFront functions must be published to the @LIVE@ stage to
    -- associate them with a cache behavior.
    CacheBehavior -> Maybe FunctionAssociations
functionAssociations :: Prelude.Maybe FunctionAssociations,
    -- | The unique identifier of the origin request policy that is attached to
    -- this cache behavior. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html#origin-request-create-origin-request-policy Creating origin request policies>
    -- or
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html Using the managed origin request policies>
    -- in the /Amazon CloudFront Developer Guide/.
    CacheBehavior -> Maybe Text
originRequestPolicyId :: Prelude.Maybe Prelude.Text,
    -- | The value of @ID@ for the field-level encryption configuration that you
    -- want CloudFront to use for encrypting specific fields of data for this
    -- cache behavior.
    CacheBehavior -> Maybe Text
fieldLevelEncryptionId :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the cache policy that is attached to this cache
    -- behavior. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
    -- or
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- A @CacheBehavior@ must include either a @CachePolicyId@ or
    -- @ForwardedValues@. We recommend that you use a @CachePolicyId@.
    CacheBehavior -> Maybe Text
cachePolicyId :: Prelude.Maybe Prelude.Text,
    -- | The pattern (for example, @images\/*.jpg@) that specifies which requests
    -- to apply the behavior to. When CloudFront receives a viewer request, the
    -- requested path is compared with path patterns in the order in which
    -- cache behaviors are listed in the distribution.
    --
    -- You can optionally include a slash (@\/@) at the beginning of the path
    -- pattern. For example, @\/images\/*.jpg@. CloudFront behavior is the same
    -- with or without the leading @\/@.
    --
    -- The path pattern for the default cache behavior is @*@ and cannot be
    -- changed. If the request for an object does not match the path pattern
    -- for any cache behaviors, CloudFront applies the behavior in the default
    -- cache behavior.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesPathPattern Path Pattern>
    -- in the /Amazon CloudFront Developer Guide/.
    CacheBehavior -> Text
pathPattern :: Prelude.Text,
    -- | The value of @ID@ for the origin that you want CloudFront to route
    -- requests to when they match this cache behavior.
    CacheBehavior -> Text
targetOriginId :: Prelude.Text,
    -- | The protocol that viewers can use to access the files in the origin
    -- specified by @TargetOriginId@ when a request matches the path pattern in
    -- @PathPattern@. You can specify the following options:
    --
    -- -   @allow-all@: Viewers can use HTTP or HTTPS.
    --
    -- -   @redirect-to-https@: If a viewer submits an HTTP request, CloudFront
    --     returns an HTTP status code of 301 (Moved Permanently) to the viewer
    --     along with the HTTPS URL. The viewer then resubmits the request
    --     using the new URL.
    --
    -- -   @https-only@: If a viewer sends an HTTP request, CloudFront returns
    --     an HTTP status code of 403 (Forbidden).
    --
    -- For more information about requiring the HTTPS protocol, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-https-viewers-to-cloudfront.html Requiring HTTPS Between Viewers and CloudFront>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- The only way to guarantee that viewers retrieve an object that was
    -- fetched from the origin using HTTPS is never to use any other protocol
    -- to fetch the object. If you have recently changed from HTTP to HTTPS, we
    -- recommend that you clear your objects’ cache because cached objects are
    -- protocol agnostic. That means that an edge location will return an
    -- object from the cache regardless of whether the current request protocol
    -- matches the protocol used previously. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing Cache Expiration>
    -- in the /Amazon CloudFront Developer Guide/.
    CacheBehavior -> ViewerProtocolPolicy
viewerProtocolPolicy :: ViewerProtocolPolicy
  }
  deriving (CacheBehavior -> CacheBehavior -> Bool
(CacheBehavior -> CacheBehavior -> Bool)
-> (CacheBehavior -> CacheBehavior -> Bool) -> Eq CacheBehavior
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CacheBehavior -> CacheBehavior -> Bool
$c/= :: CacheBehavior -> CacheBehavior -> Bool
== :: CacheBehavior -> CacheBehavior -> Bool
$c== :: CacheBehavior -> CacheBehavior -> Bool
Prelude.Eq, ReadPrec [CacheBehavior]
ReadPrec CacheBehavior
Int -> ReadS CacheBehavior
ReadS [CacheBehavior]
(Int -> ReadS CacheBehavior)
-> ReadS [CacheBehavior]
-> ReadPrec CacheBehavior
-> ReadPrec [CacheBehavior]
-> Read CacheBehavior
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CacheBehavior]
$creadListPrec :: ReadPrec [CacheBehavior]
readPrec :: ReadPrec CacheBehavior
$creadPrec :: ReadPrec CacheBehavior
readList :: ReadS [CacheBehavior]
$creadList :: ReadS [CacheBehavior]
readsPrec :: Int -> ReadS CacheBehavior
$creadsPrec :: Int -> ReadS CacheBehavior
Prelude.Read, Int -> CacheBehavior -> ShowS
[CacheBehavior] -> ShowS
CacheBehavior -> String
(Int -> CacheBehavior -> ShowS)
-> (CacheBehavior -> String)
-> ([CacheBehavior] -> ShowS)
-> Show CacheBehavior
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CacheBehavior] -> ShowS
$cshowList :: [CacheBehavior] -> ShowS
show :: CacheBehavior -> String
$cshow :: CacheBehavior -> String
showsPrec :: Int -> CacheBehavior -> ShowS
$cshowsPrec :: Int -> CacheBehavior -> ShowS
Prelude.Show, (forall x. CacheBehavior -> Rep CacheBehavior x)
-> (forall x. Rep CacheBehavior x -> CacheBehavior)
-> Generic CacheBehavior
forall x. Rep CacheBehavior x -> CacheBehavior
forall x. CacheBehavior -> Rep CacheBehavior x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CacheBehavior x -> CacheBehavior
$cfrom :: forall x. CacheBehavior -> Rep CacheBehavior x
Prelude.Generic)

-- |
-- Create a value of 'CacheBehavior' 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:
--
-- 'allowedMethods', 'cacheBehavior_allowedMethods' - Undocumented member.
--
-- 'lambdaFunctionAssociations', 'cacheBehavior_lambdaFunctionAssociations' - A complex type that contains zero or more Lambda\@Edge function
-- associations for a cache behavior.
--
-- 'maxTTL', 'cacheBehavior_maxTTL' - This field is deprecated. We recommend that you use the @MaxTTL@ field
-- in a cache policy instead of this field. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- The maximum amount of time that you want objects to stay in CloudFront
-- caches before CloudFront forwards another request to your origin to
-- determine whether the object has been updated. The value that you
-- specify applies only when your origin adds HTTP headers such as
-- @Cache-Control max-age@, @Cache-Control s-maxage@, and @Expires@ to
-- objects. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing How Long Content Stays in an Edge Cache (Expiration)>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'minTTL', 'cacheBehavior_minTTL' - This field is deprecated. We recommend that you use the @MinTTL@ field
-- in a cache policy instead of this field. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- The minimum amount of time that you want objects to stay in CloudFront
-- caches before CloudFront forwards another request to your origin to
-- determine whether the object has been updated. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing How Long Content Stays in an Edge Cache (Expiration)>
-- in the /Amazon CloudFront Developer Guide/.
--
-- You must specify @0@ for @MinTTL@ if you configure CloudFront to forward
-- all headers to your origin (under @Headers@, if you specify @1@ for
-- @Quantity@ and @*@ for @Name@).
--
-- 'compress', 'cacheBehavior_compress' - Whether you want CloudFront to automatically compress certain files for
-- this cache behavior. If so, specify true; if not, specify false. For
-- more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html Serving Compressed Files>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'smoothStreaming', 'cacheBehavior_smoothStreaming' - Indicates whether you want to distribute media files in the Microsoft
-- Smooth Streaming format using the origin that is associated with this
-- cache behavior. If so, specify @true@; if not, specify @false@. If you
-- specify @true@ for @SmoothStreaming@, you can still distribute other
-- content using this cache behavior if the content matches the value of
-- @PathPattern@.
--
-- 'trustedKeyGroups', 'cacheBehavior_trustedKeyGroups' - A list of key groups that CloudFront can use to validate signed URLs or
-- signed cookies.
--
-- When a cache behavior contains trusted key groups, CloudFront requires
-- signed URLs or signed cookies for all requests that match the cache
-- behavior. The URLs or cookies must be signed with a private key whose
-- corresponding public key is in the key group. The signed URL or cookie
-- contains information about which public key CloudFront should use to
-- verify the signature. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html Serving private content>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'realtimeLogConfigArn', 'cacheBehavior_realtimeLogConfigArn' - The Amazon Resource Name (ARN) of the real-time log configuration that
-- is attached to this cache behavior. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html Real-time logs>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'defaultTTL', 'cacheBehavior_defaultTTL' - This field is deprecated. We recommend that you use the @DefaultTTL@
-- field in a cache policy instead of this field. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- The default amount of time that you want objects to stay in CloudFront
-- caches before CloudFront forwards another request to your origin to
-- determine whether the object has been updated. The value that you
-- specify applies only when your origin does not add HTTP headers such as
-- @Cache-Control max-age@, @Cache-Control s-maxage@, and @Expires@ to
-- objects. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing How Long Content Stays in an Edge Cache (Expiration)>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'forwardedValues', 'cacheBehavior_forwardedValues' - This field is deprecated. We recommend that you use a cache policy or an
-- origin request policy instead of this field. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/working-with-policies.html Working with policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you want to include values in the cache key, use a cache policy. For
-- more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you want to send values to the origin but not include them in the
-- cache key, use an origin request policy. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html#origin-request-create-origin-request-policy Creating origin request policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html Using the managed origin request policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- A @CacheBehavior@ must include either a @CachePolicyId@ or
-- @ForwardedValues@. We recommend that you use a @CachePolicyId@.
--
-- A complex type that specifies how CloudFront handles query strings,
-- cookies, and HTTP headers.
--
-- 'trustedSigners', 'cacheBehavior_trustedSigners' - We recommend using @TrustedKeyGroups@ instead of @TrustedSigners@.
--
-- A list of account IDs whose public keys CloudFront can use to validate
-- signed URLs or signed cookies.
--
-- When a cache behavior contains trusted signers, CloudFront requires
-- signed URLs or signed cookies for all requests that match the cache
-- behavior. The URLs or cookies must be signed with the private key of a
-- CloudFront key pair in the trusted signer’s account. The signed URL or
-- cookie contains information about which public key CloudFront should use
-- to verify the signature. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html Serving private content>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'functionAssociations', 'cacheBehavior_functionAssociations' - A list of CloudFront functions that are associated with this cache
-- behavior. CloudFront functions must be published to the @LIVE@ stage to
-- associate them with a cache behavior.
--
-- 'originRequestPolicyId', 'cacheBehavior_originRequestPolicyId' - The unique identifier of the origin request policy that is attached to
-- this cache behavior. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html#origin-request-create-origin-request-policy Creating origin request policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html Using the managed origin request policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'fieldLevelEncryptionId', 'cacheBehavior_fieldLevelEncryptionId' - The value of @ID@ for the field-level encryption configuration that you
-- want CloudFront to use for encrypting specific fields of data for this
-- cache behavior.
--
-- 'cachePolicyId', 'cacheBehavior_cachePolicyId' - The unique identifier of the cache policy that is attached to this cache
-- behavior. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- A @CacheBehavior@ must include either a @CachePolicyId@ or
-- @ForwardedValues@. We recommend that you use a @CachePolicyId@.
--
-- 'pathPattern', 'cacheBehavior_pathPattern' - The pattern (for example, @images\/*.jpg@) that specifies which requests
-- to apply the behavior to. When CloudFront receives a viewer request, the
-- requested path is compared with path patterns in the order in which
-- cache behaviors are listed in the distribution.
--
-- You can optionally include a slash (@\/@) at the beginning of the path
-- pattern. For example, @\/images\/*.jpg@. CloudFront behavior is the same
-- with or without the leading @\/@.
--
-- The path pattern for the default cache behavior is @*@ and cannot be
-- changed. If the request for an object does not match the path pattern
-- for any cache behaviors, CloudFront applies the behavior in the default
-- cache behavior.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesPathPattern Path Pattern>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'targetOriginId', 'cacheBehavior_targetOriginId' - The value of @ID@ for the origin that you want CloudFront to route
-- requests to when they match this cache behavior.
--
-- 'viewerProtocolPolicy', 'cacheBehavior_viewerProtocolPolicy' - The protocol that viewers can use to access the files in the origin
-- specified by @TargetOriginId@ when a request matches the path pattern in
-- @PathPattern@. You can specify the following options:
--
-- -   @allow-all@: Viewers can use HTTP or HTTPS.
--
-- -   @redirect-to-https@: If a viewer submits an HTTP request, CloudFront
--     returns an HTTP status code of 301 (Moved Permanently) to the viewer
--     along with the HTTPS URL. The viewer then resubmits the request
--     using the new URL.
--
-- -   @https-only@: If a viewer sends an HTTP request, CloudFront returns
--     an HTTP status code of 403 (Forbidden).
--
-- For more information about requiring the HTTPS protocol, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-https-viewers-to-cloudfront.html Requiring HTTPS Between Viewers and CloudFront>
-- in the /Amazon CloudFront Developer Guide/.
--
-- The only way to guarantee that viewers retrieve an object that was
-- fetched from the origin using HTTPS is never to use any other protocol
-- to fetch the object. If you have recently changed from HTTP to HTTPS, we
-- recommend that you clear your objects’ cache because cached objects are
-- protocol agnostic. That means that an edge location will return an
-- object from the cache regardless of whether the current request protocol
-- matches the protocol used previously. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing Cache Expiration>
-- in the /Amazon CloudFront Developer Guide/.
newCacheBehavior ::
  -- | 'pathPattern'
  Prelude.Text ->
  -- | 'targetOriginId'
  Prelude.Text ->
  -- | 'viewerProtocolPolicy'
  ViewerProtocolPolicy ->
  CacheBehavior
newCacheBehavior :: Text -> Text -> ViewerProtocolPolicy -> CacheBehavior
newCacheBehavior
  Text
pPathPattern_
  Text
pTargetOriginId_
  ViewerProtocolPolicy
pViewerProtocolPolicy_ =
    CacheBehavior' :: Maybe AllowedMethods
-> Maybe LambdaFunctionAssociations
-> Maybe Integer
-> Maybe Integer
-> Maybe Bool
-> Maybe Bool
-> Maybe TrustedKeyGroups
-> Maybe Text
-> Maybe Integer
-> Maybe ForwardedValues
-> Maybe TrustedSigners
-> Maybe FunctionAssociations
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> ViewerProtocolPolicy
-> CacheBehavior
CacheBehavior'
      { $sel:allowedMethods:CacheBehavior' :: Maybe AllowedMethods
allowedMethods = Maybe AllowedMethods
forall a. Maybe a
Prelude.Nothing,
        $sel:lambdaFunctionAssociations:CacheBehavior' :: Maybe LambdaFunctionAssociations
lambdaFunctionAssociations = Maybe LambdaFunctionAssociations
forall a. Maybe a
Prelude.Nothing,
        $sel:maxTTL:CacheBehavior' :: Maybe Integer
maxTTL = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:minTTL:CacheBehavior' :: Maybe Integer
minTTL = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:compress:CacheBehavior' :: Maybe Bool
compress = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:smoothStreaming:CacheBehavior' :: Maybe Bool
smoothStreaming = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:trustedKeyGroups:CacheBehavior' :: Maybe TrustedKeyGroups
trustedKeyGroups = Maybe TrustedKeyGroups
forall a. Maybe a
Prelude.Nothing,
        $sel:realtimeLogConfigArn:CacheBehavior' :: Maybe Text
realtimeLogConfigArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:defaultTTL:CacheBehavior' :: Maybe Integer
defaultTTL = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:forwardedValues:CacheBehavior' :: Maybe ForwardedValues
forwardedValues = Maybe ForwardedValues
forall a. Maybe a
Prelude.Nothing,
        $sel:trustedSigners:CacheBehavior' :: Maybe TrustedSigners
trustedSigners = Maybe TrustedSigners
forall a. Maybe a
Prelude.Nothing,
        $sel:functionAssociations:CacheBehavior' :: Maybe FunctionAssociations
functionAssociations = Maybe FunctionAssociations
forall a. Maybe a
Prelude.Nothing,
        $sel:originRequestPolicyId:CacheBehavior' :: Maybe Text
originRequestPolicyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:fieldLevelEncryptionId:CacheBehavior' :: Maybe Text
fieldLevelEncryptionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:cachePolicyId:CacheBehavior' :: Maybe Text
cachePolicyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:pathPattern:CacheBehavior' :: Text
pathPattern = Text
pPathPattern_,
        $sel:targetOriginId:CacheBehavior' :: Text
targetOriginId = Text
pTargetOriginId_,
        $sel:viewerProtocolPolicy:CacheBehavior' :: ViewerProtocolPolicy
viewerProtocolPolicy = ViewerProtocolPolicy
pViewerProtocolPolicy_
      }

-- | Undocumented member.
cacheBehavior_allowedMethods :: Lens.Lens' CacheBehavior (Prelude.Maybe AllowedMethods)
cacheBehavior_allowedMethods :: (Maybe AllowedMethods -> f (Maybe AllowedMethods))
-> CacheBehavior -> f CacheBehavior
cacheBehavior_allowedMethods = (CacheBehavior -> Maybe AllowedMethods)
-> (CacheBehavior -> Maybe AllowedMethods -> CacheBehavior)
-> Lens
     CacheBehavior
     CacheBehavior
     (Maybe AllowedMethods)
     (Maybe AllowedMethods)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe AllowedMethods
allowedMethods :: Maybe AllowedMethods
$sel:allowedMethods:CacheBehavior' :: CacheBehavior -> Maybe AllowedMethods
allowedMethods} -> Maybe AllowedMethods
allowedMethods) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe AllowedMethods
a -> CacheBehavior
s {$sel:allowedMethods:CacheBehavior' :: Maybe AllowedMethods
allowedMethods = Maybe AllowedMethods
a} :: CacheBehavior)

-- | A complex type that contains zero or more Lambda\@Edge function
-- associations for a cache behavior.
cacheBehavior_lambdaFunctionAssociations :: Lens.Lens' CacheBehavior (Prelude.Maybe LambdaFunctionAssociations)
cacheBehavior_lambdaFunctionAssociations :: (Maybe LambdaFunctionAssociations
 -> f (Maybe LambdaFunctionAssociations))
-> CacheBehavior -> f CacheBehavior
cacheBehavior_lambdaFunctionAssociations = (CacheBehavior -> Maybe LambdaFunctionAssociations)
-> (CacheBehavior
    -> Maybe LambdaFunctionAssociations -> CacheBehavior)
-> Lens
     CacheBehavior
     CacheBehavior
     (Maybe LambdaFunctionAssociations)
     (Maybe LambdaFunctionAssociations)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe LambdaFunctionAssociations
lambdaFunctionAssociations :: Maybe LambdaFunctionAssociations
$sel:lambdaFunctionAssociations:CacheBehavior' :: CacheBehavior -> Maybe LambdaFunctionAssociations
lambdaFunctionAssociations} -> Maybe LambdaFunctionAssociations
lambdaFunctionAssociations) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe LambdaFunctionAssociations
a -> CacheBehavior
s {$sel:lambdaFunctionAssociations:CacheBehavior' :: Maybe LambdaFunctionAssociations
lambdaFunctionAssociations = Maybe LambdaFunctionAssociations
a} :: CacheBehavior)

-- | This field is deprecated. We recommend that you use the @MaxTTL@ field
-- in a cache policy instead of this field. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- The maximum amount of time that you want objects to stay in CloudFront
-- caches before CloudFront forwards another request to your origin to
-- determine whether the object has been updated. The value that you
-- specify applies only when your origin adds HTTP headers such as
-- @Cache-Control max-age@, @Cache-Control s-maxage@, and @Expires@ to
-- objects. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing How Long Content Stays in an Edge Cache (Expiration)>
-- in the /Amazon CloudFront Developer Guide/.
cacheBehavior_maxTTL :: Lens.Lens' CacheBehavior (Prelude.Maybe Prelude.Integer)
cacheBehavior_maxTTL :: (Maybe Integer -> f (Maybe Integer))
-> CacheBehavior -> f CacheBehavior
cacheBehavior_maxTTL = (CacheBehavior -> Maybe Integer)
-> (CacheBehavior -> Maybe Integer -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe Integer
maxTTL :: Maybe Integer
$sel:maxTTL:CacheBehavior' :: CacheBehavior -> Maybe Integer
maxTTL} -> Maybe Integer
maxTTL) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe Integer
a -> CacheBehavior
s {$sel:maxTTL:CacheBehavior' :: Maybe Integer
maxTTL = Maybe Integer
a} :: CacheBehavior)

-- | This field is deprecated. We recommend that you use the @MinTTL@ field
-- in a cache policy instead of this field. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- The minimum amount of time that you want objects to stay in CloudFront
-- caches before CloudFront forwards another request to your origin to
-- determine whether the object has been updated. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing How Long Content Stays in an Edge Cache (Expiration)>
-- in the /Amazon CloudFront Developer Guide/.
--
-- You must specify @0@ for @MinTTL@ if you configure CloudFront to forward
-- all headers to your origin (under @Headers@, if you specify @1@ for
-- @Quantity@ and @*@ for @Name@).
cacheBehavior_minTTL :: Lens.Lens' CacheBehavior (Prelude.Maybe Prelude.Integer)
cacheBehavior_minTTL :: (Maybe Integer -> f (Maybe Integer))
-> CacheBehavior -> f CacheBehavior
cacheBehavior_minTTL = (CacheBehavior -> Maybe Integer)
-> (CacheBehavior -> Maybe Integer -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe Integer
minTTL :: Maybe Integer
$sel:minTTL:CacheBehavior' :: CacheBehavior -> Maybe Integer
minTTL} -> Maybe Integer
minTTL) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe Integer
a -> CacheBehavior
s {$sel:minTTL:CacheBehavior' :: Maybe Integer
minTTL = Maybe Integer
a} :: CacheBehavior)

-- | Whether you want CloudFront to automatically compress certain files for
-- this cache behavior. If so, specify true; if not, specify false. For
-- more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html Serving Compressed Files>
-- in the /Amazon CloudFront Developer Guide/.
cacheBehavior_compress :: Lens.Lens' CacheBehavior (Prelude.Maybe Prelude.Bool)
cacheBehavior_compress :: (Maybe Bool -> f (Maybe Bool)) -> CacheBehavior -> f CacheBehavior
cacheBehavior_compress = (CacheBehavior -> Maybe Bool)
-> (CacheBehavior -> Maybe Bool -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe Bool
compress :: Maybe Bool
$sel:compress:CacheBehavior' :: CacheBehavior -> Maybe Bool
compress} -> Maybe Bool
compress) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe Bool
a -> CacheBehavior
s {$sel:compress:CacheBehavior' :: Maybe Bool
compress = Maybe Bool
a} :: CacheBehavior)

-- | Indicates whether you want to distribute media files in the Microsoft
-- Smooth Streaming format using the origin that is associated with this
-- cache behavior. If so, specify @true@; if not, specify @false@. If you
-- specify @true@ for @SmoothStreaming@, you can still distribute other
-- content using this cache behavior if the content matches the value of
-- @PathPattern@.
cacheBehavior_smoothStreaming :: Lens.Lens' CacheBehavior (Prelude.Maybe Prelude.Bool)
cacheBehavior_smoothStreaming :: (Maybe Bool -> f (Maybe Bool)) -> CacheBehavior -> f CacheBehavior
cacheBehavior_smoothStreaming = (CacheBehavior -> Maybe Bool)
-> (CacheBehavior -> Maybe Bool -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe Bool
smoothStreaming :: Maybe Bool
$sel:smoothStreaming:CacheBehavior' :: CacheBehavior -> Maybe Bool
smoothStreaming} -> Maybe Bool
smoothStreaming) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe Bool
a -> CacheBehavior
s {$sel:smoothStreaming:CacheBehavior' :: Maybe Bool
smoothStreaming = Maybe Bool
a} :: CacheBehavior)

-- | A list of key groups that CloudFront can use to validate signed URLs or
-- signed cookies.
--
-- When a cache behavior contains trusted key groups, CloudFront requires
-- signed URLs or signed cookies for all requests that match the cache
-- behavior. The URLs or cookies must be signed with a private key whose
-- corresponding public key is in the key group. The signed URL or cookie
-- contains information about which public key CloudFront should use to
-- verify the signature. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html Serving private content>
-- in the /Amazon CloudFront Developer Guide/.
cacheBehavior_trustedKeyGroups :: Lens.Lens' CacheBehavior (Prelude.Maybe TrustedKeyGroups)
cacheBehavior_trustedKeyGroups :: (Maybe TrustedKeyGroups -> f (Maybe TrustedKeyGroups))
-> CacheBehavior -> f CacheBehavior
cacheBehavior_trustedKeyGroups = (CacheBehavior -> Maybe TrustedKeyGroups)
-> (CacheBehavior -> Maybe TrustedKeyGroups -> CacheBehavior)
-> Lens
     CacheBehavior
     CacheBehavior
     (Maybe TrustedKeyGroups)
     (Maybe TrustedKeyGroups)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe TrustedKeyGroups
trustedKeyGroups :: Maybe TrustedKeyGroups
$sel:trustedKeyGroups:CacheBehavior' :: CacheBehavior -> Maybe TrustedKeyGroups
trustedKeyGroups} -> Maybe TrustedKeyGroups
trustedKeyGroups) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe TrustedKeyGroups
a -> CacheBehavior
s {$sel:trustedKeyGroups:CacheBehavior' :: Maybe TrustedKeyGroups
trustedKeyGroups = Maybe TrustedKeyGroups
a} :: CacheBehavior)

-- | The Amazon Resource Name (ARN) of the real-time log configuration that
-- is attached to this cache behavior. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html Real-time logs>
-- in the /Amazon CloudFront Developer Guide/.
cacheBehavior_realtimeLogConfigArn :: Lens.Lens' CacheBehavior (Prelude.Maybe Prelude.Text)
cacheBehavior_realtimeLogConfigArn :: (Maybe Text -> f (Maybe Text)) -> CacheBehavior -> f CacheBehavior
cacheBehavior_realtimeLogConfigArn = (CacheBehavior -> Maybe Text)
-> (CacheBehavior -> Maybe Text -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe Text
realtimeLogConfigArn :: Maybe Text
$sel:realtimeLogConfigArn:CacheBehavior' :: CacheBehavior -> Maybe Text
realtimeLogConfigArn} -> Maybe Text
realtimeLogConfigArn) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe Text
a -> CacheBehavior
s {$sel:realtimeLogConfigArn:CacheBehavior' :: Maybe Text
realtimeLogConfigArn = Maybe Text
a} :: CacheBehavior)

-- | This field is deprecated. We recommend that you use the @DefaultTTL@
-- field in a cache policy instead of this field. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- The default amount of time that you want objects to stay in CloudFront
-- caches before CloudFront forwards another request to your origin to
-- determine whether the object has been updated. The value that you
-- specify applies only when your origin does not add HTTP headers such as
-- @Cache-Control max-age@, @Cache-Control s-maxage@, and @Expires@ to
-- objects. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing How Long Content Stays in an Edge Cache (Expiration)>
-- in the /Amazon CloudFront Developer Guide/.
cacheBehavior_defaultTTL :: Lens.Lens' CacheBehavior (Prelude.Maybe Prelude.Integer)
cacheBehavior_defaultTTL :: (Maybe Integer -> f (Maybe Integer))
-> CacheBehavior -> f CacheBehavior
cacheBehavior_defaultTTL = (CacheBehavior -> Maybe Integer)
-> (CacheBehavior -> Maybe Integer -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe Integer
defaultTTL :: Maybe Integer
$sel:defaultTTL:CacheBehavior' :: CacheBehavior -> Maybe Integer
defaultTTL} -> Maybe Integer
defaultTTL) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe Integer
a -> CacheBehavior
s {$sel:defaultTTL:CacheBehavior' :: Maybe Integer
defaultTTL = Maybe Integer
a} :: CacheBehavior)

-- | This field is deprecated. We recommend that you use a cache policy or an
-- origin request policy instead of this field. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/working-with-policies.html Working with policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you want to include values in the cache key, use a cache policy. For
-- more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you want to send values to the origin but not include them in the
-- cache key, use an origin request policy. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html#origin-request-create-origin-request-policy Creating origin request policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html Using the managed origin request policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- A @CacheBehavior@ must include either a @CachePolicyId@ or
-- @ForwardedValues@. We recommend that you use a @CachePolicyId@.
--
-- A complex type that specifies how CloudFront handles query strings,
-- cookies, and HTTP headers.
cacheBehavior_forwardedValues :: Lens.Lens' CacheBehavior (Prelude.Maybe ForwardedValues)
cacheBehavior_forwardedValues :: (Maybe ForwardedValues -> f (Maybe ForwardedValues))
-> CacheBehavior -> f CacheBehavior
cacheBehavior_forwardedValues = (CacheBehavior -> Maybe ForwardedValues)
-> (CacheBehavior -> Maybe ForwardedValues -> CacheBehavior)
-> Lens
     CacheBehavior
     CacheBehavior
     (Maybe ForwardedValues)
     (Maybe ForwardedValues)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe ForwardedValues
forwardedValues :: Maybe ForwardedValues
$sel:forwardedValues:CacheBehavior' :: CacheBehavior -> Maybe ForwardedValues
forwardedValues} -> Maybe ForwardedValues
forwardedValues) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe ForwardedValues
a -> CacheBehavior
s {$sel:forwardedValues:CacheBehavior' :: Maybe ForwardedValues
forwardedValues = Maybe ForwardedValues
a} :: CacheBehavior)

-- | We recommend using @TrustedKeyGroups@ instead of @TrustedSigners@.
--
-- A list of account IDs whose public keys CloudFront can use to validate
-- signed URLs or signed cookies.
--
-- When a cache behavior contains trusted signers, CloudFront requires
-- signed URLs or signed cookies for all requests that match the cache
-- behavior. The URLs or cookies must be signed with the private key of a
-- CloudFront key pair in the trusted signer’s account. The signed URL or
-- cookie contains information about which public key CloudFront should use
-- to verify the signature. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html Serving private content>
-- in the /Amazon CloudFront Developer Guide/.
cacheBehavior_trustedSigners :: Lens.Lens' CacheBehavior (Prelude.Maybe TrustedSigners)
cacheBehavior_trustedSigners :: (Maybe TrustedSigners -> f (Maybe TrustedSigners))
-> CacheBehavior -> f CacheBehavior
cacheBehavior_trustedSigners = (CacheBehavior -> Maybe TrustedSigners)
-> (CacheBehavior -> Maybe TrustedSigners -> CacheBehavior)
-> Lens
     CacheBehavior
     CacheBehavior
     (Maybe TrustedSigners)
     (Maybe TrustedSigners)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe TrustedSigners
trustedSigners :: Maybe TrustedSigners
$sel:trustedSigners:CacheBehavior' :: CacheBehavior -> Maybe TrustedSigners
trustedSigners} -> Maybe TrustedSigners
trustedSigners) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe TrustedSigners
a -> CacheBehavior
s {$sel:trustedSigners:CacheBehavior' :: Maybe TrustedSigners
trustedSigners = Maybe TrustedSigners
a} :: CacheBehavior)

-- | A list of CloudFront functions that are associated with this cache
-- behavior. CloudFront functions must be published to the @LIVE@ stage to
-- associate them with a cache behavior.
cacheBehavior_functionAssociations :: Lens.Lens' CacheBehavior (Prelude.Maybe FunctionAssociations)
cacheBehavior_functionAssociations :: (Maybe FunctionAssociations -> f (Maybe FunctionAssociations))
-> CacheBehavior -> f CacheBehavior
cacheBehavior_functionAssociations = (CacheBehavior -> Maybe FunctionAssociations)
-> (CacheBehavior -> Maybe FunctionAssociations -> CacheBehavior)
-> Lens
     CacheBehavior
     CacheBehavior
     (Maybe FunctionAssociations)
     (Maybe FunctionAssociations)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe FunctionAssociations
functionAssociations :: Maybe FunctionAssociations
$sel:functionAssociations:CacheBehavior' :: CacheBehavior -> Maybe FunctionAssociations
functionAssociations} -> Maybe FunctionAssociations
functionAssociations) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe FunctionAssociations
a -> CacheBehavior
s {$sel:functionAssociations:CacheBehavior' :: Maybe FunctionAssociations
functionAssociations = Maybe FunctionAssociations
a} :: CacheBehavior)

-- | The unique identifier of the origin request policy that is attached to
-- this cache behavior. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html#origin-request-create-origin-request-policy Creating origin request policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html Using the managed origin request policies>
-- in the /Amazon CloudFront Developer Guide/.
cacheBehavior_originRequestPolicyId :: Lens.Lens' CacheBehavior (Prelude.Maybe Prelude.Text)
cacheBehavior_originRequestPolicyId :: (Maybe Text -> f (Maybe Text)) -> CacheBehavior -> f CacheBehavior
cacheBehavior_originRequestPolicyId = (CacheBehavior -> Maybe Text)
-> (CacheBehavior -> Maybe Text -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe Text
originRequestPolicyId :: Maybe Text
$sel:originRequestPolicyId:CacheBehavior' :: CacheBehavior -> Maybe Text
originRequestPolicyId} -> Maybe Text
originRequestPolicyId) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe Text
a -> CacheBehavior
s {$sel:originRequestPolicyId:CacheBehavior' :: Maybe Text
originRequestPolicyId = Maybe Text
a} :: CacheBehavior)

-- | The value of @ID@ for the field-level encryption configuration that you
-- want CloudFront to use for encrypting specific fields of data for this
-- cache behavior.
cacheBehavior_fieldLevelEncryptionId :: Lens.Lens' CacheBehavior (Prelude.Maybe Prelude.Text)
cacheBehavior_fieldLevelEncryptionId :: (Maybe Text -> f (Maybe Text)) -> CacheBehavior -> f CacheBehavior
cacheBehavior_fieldLevelEncryptionId = (CacheBehavior -> Maybe Text)
-> (CacheBehavior -> Maybe Text -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe Text
fieldLevelEncryptionId :: Maybe Text
$sel:fieldLevelEncryptionId:CacheBehavior' :: CacheBehavior -> Maybe Text
fieldLevelEncryptionId} -> Maybe Text
fieldLevelEncryptionId) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe Text
a -> CacheBehavior
s {$sel:fieldLevelEncryptionId:CacheBehavior' :: Maybe Text
fieldLevelEncryptionId = Maybe Text
a} :: CacheBehavior)

-- | The unique identifier of the cache policy that is attached to this cache
-- behavior. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy Creating cache policies>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html Using the managed cache policies>
-- in the /Amazon CloudFront Developer Guide/.
--
-- A @CacheBehavior@ must include either a @CachePolicyId@ or
-- @ForwardedValues@. We recommend that you use a @CachePolicyId@.
cacheBehavior_cachePolicyId :: Lens.Lens' CacheBehavior (Prelude.Maybe Prelude.Text)
cacheBehavior_cachePolicyId :: (Maybe Text -> f (Maybe Text)) -> CacheBehavior -> f CacheBehavior
cacheBehavior_cachePolicyId = (CacheBehavior -> Maybe Text)
-> (CacheBehavior -> Maybe Text -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Maybe Text
cachePolicyId :: Maybe Text
$sel:cachePolicyId:CacheBehavior' :: CacheBehavior -> Maybe Text
cachePolicyId} -> Maybe Text
cachePolicyId) (\s :: CacheBehavior
s@CacheBehavior' {} Maybe Text
a -> CacheBehavior
s {$sel:cachePolicyId:CacheBehavior' :: Maybe Text
cachePolicyId = Maybe Text
a} :: CacheBehavior)

-- | The pattern (for example, @images\/*.jpg@) that specifies which requests
-- to apply the behavior to. When CloudFront receives a viewer request, the
-- requested path is compared with path patterns in the order in which
-- cache behaviors are listed in the distribution.
--
-- You can optionally include a slash (@\/@) at the beginning of the path
-- pattern. For example, @\/images\/*.jpg@. CloudFront behavior is the same
-- with or without the leading @\/@.
--
-- The path pattern for the default cache behavior is @*@ and cannot be
-- changed. If the request for an object does not match the path pattern
-- for any cache behaviors, CloudFront applies the behavior in the default
-- cache behavior.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesPathPattern Path Pattern>
-- in the /Amazon CloudFront Developer Guide/.
cacheBehavior_pathPattern :: Lens.Lens' CacheBehavior Prelude.Text
cacheBehavior_pathPattern :: (Text -> f Text) -> CacheBehavior -> f CacheBehavior
cacheBehavior_pathPattern = (CacheBehavior -> Text)
-> (CacheBehavior -> Text -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Text
pathPattern :: Text
$sel:pathPattern:CacheBehavior' :: CacheBehavior -> Text
pathPattern} -> Text
pathPattern) (\s :: CacheBehavior
s@CacheBehavior' {} Text
a -> CacheBehavior
s {$sel:pathPattern:CacheBehavior' :: Text
pathPattern = Text
a} :: CacheBehavior)

-- | The value of @ID@ for the origin that you want CloudFront to route
-- requests to when they match this cache behavior.
cacheBehavior_targetOriginId :: Lens.Lens' CacheBehavior Prelude.Text
cacheBehavior_targetOriginId :: (Text -> f Text) -> CacheBehavior -> f CacheBehavior
cacheBehavior_targetOriginId = (CacheBehavior -> Text)
-> (CacheBehavior -> Text -> CacheBehavior)
-> Lens CacheBehavior CacheBehavior Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {Text
targetOriginId :: Text
$sel:targetOriginId:CacheBehavior' :: CacheBehavior -> Text
targetOriginId} -> Text
targetOriginId) (\s :: CacheBehavior
s@CacheBehavior' {} Text
a -> CacheBehavior
s {$sel:targetOriginId:CacheBehavior' :: Text
targetOriginId = Text
a} :: CacheBehavior)

-- | The protocol that viewers can use to access the files in the origin
-- specified by @TargetOriginId@ when a request matches the path pattern in
-- @PathPattern@. You can specify the following options:
--
-- -   @allow-all@: Viewers can use HTTP or HTTPS.
--
-- -   @redirect-to-https@: If a viewer submits an HTTP request, CloudFront
--     returns an HTTP status code of 301 (Moved Permanently) to the viewer
--     along with the HTTPS URL. The viewer then resubmits the request
--     using the new URL.
--
-- -   @https-only@: If a viewer sends an HTTP request, CloudFront returns
--     an HTTP status code of 403 (Forbidden).
--
-- For more information about requiring the HTTPS protocol, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-https-viewers-to-cloudfront.html Requiring HTTPS Between Viewers and CloudFront>
-- in the /Amazon CloudFront Developer Guide/.
--
-- The only way to guarantee that viewers retrieve an object that was
-- fetched from the origin using HTTPS is never to use any other protocol
-- to fetch the object. If you have recently changed from HTTP to HTTPS, we
-- recommend that you clear your objects’ cache because cached objects are
-- protocol agnostic. That means that an edge location will return an
-- object from the cache regardless of whether the current request protocol
-- matches the protocol used previously. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html Managing Cache Expiration>
-- in the /Amazon CloudFront Developer Guide/.
cacheBehavior_viewerProtocolPolicy :: Lens.Lens' CacheBehavior ViewerProtocolPolicy
cacheBehavior_viewerProtocolPolicy :: (ViewerProtocolPolicy -> f ViewerProtocolPolicy)
-> CacheBehavior -> f CacheBehavior
cacheBehavior_viewerProtocolPolicy = (CacheBehavior -> ViewerProtocolPolicy)
-> (CacheBehavior -> ViewerProtocolPolicy -> CacheBehavior)
-> Lens
     CacheBehavior
     CacheBehavior
     ViewerProtocolPolicy
     ViewerProtocolPolicy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheBehavior' {ViewerProtocolPolicy
viewerProtocolPolicy :: ViewerProtocolPolicy
$sel:viewerProtocolPolicy:CacheBehavior' :: CacheBehavior -> ViewerProtocolPolicy
viewerProtocolPolicy} -> ViewerProtocolPolicy
viewerProtocolPolicy) (\s :: CacheBehavior
s@CacheBehavior' {} ViewerProtocolPolicy
a -> CacheBehavior
s {$sel:viewerProtocolPolicy:CacheBehavior' :: ViewerProtocolPolicy
viewerProtocolPolicy = ViewerProtocolPolicy
a} :: CacheBehavior)

instance Core.FromXML CacheBehavior where
  parseXML :: [Node] -> Either String CacheBehavior
parseXML [Node]
x =
    Maybe AllowedMethods
-> Maybe LambdaFunctionAssociations
-> Maybe Integer
-> Maybe Integer
-> Maybe Bool
-> Maybe Bool
-> Maybe TrustedKeyGroups
-> Maybe Text
-> Maybe Integer
-> Maybe ForwardedValues
-> Maybe TrustedSigners
-> Maybe FunctionAssociations
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> ViewerProtocolPolicy
-> CacheBehavior
CacheBehavior'
      (Maybe AllowedMethods
 -> Maybe LambdaFunctionAssociations
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe TrustedKeyGroups
 -> Maybe Text
 -> Maybe Integer
 -> Maybe ForwardedValues
 -> Maybe TrustedSigners
 -> Maybe FunctionAssociations
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> Text
 -> ViewerProtocolPolicy
 -> CacheBehavior)
-> Either String (Maybe AllowedMethods)
-> Either
     String
     (Maybe LambdaFunctionAssociations
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe TrustedKeyGroups
      -> Maybe Text
      -> Maybe Integer
      -> Maybe ForwardedValues
      -> Maybe TrustedSigners
      -> Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe AllowedMethods)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AllowedMethods")
      Either
  String
  (Maybe LambdaFunctionAssociations
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe TrustedKeyGroups
   -> Maybe Text
   -> Maybe Integer
   -> Maybe ForwardedValues
   -> Maybe TrustedSigners
   -> Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe LambdaFunctionAssociations)
-> Either
     String
     (Maybe Integer
      -> Maybe Integer
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe TrustedKeyGroups
      -> Maybe Text
      -> Maybe Integer
      -> Maybe ForwardedValues
      -> Maybe TrustedSigners
      -> Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe LambdaFunctionAssociations)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LambdaFunctionAssociations")
      Either
  String
  (Maybe Integer
   -> Maybe Integer
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe TrustedKeyGroups
   -> Maybe Text
   -> Maybe Integer
   -> Maybe ForwardedValues
   -> Maybe TrustedSigners
   -> Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe Integer
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe TrustedKeyGroups
      -> Maybe Text
      -> Maybe Integer
      -> Maybe ForwardedValues
      -> Maybe TrustedSigners
      -> Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
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
"MaxTTL")
      Either
  String
  (Maybe Integer
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe TrustedKeyGroups
   -> Maybe Text
   -> Maybe Integer
   -> Maybe ForwardedValues
   -> Maybe TrustedSigners
   -> Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe Bool
      -> Maybe Bool
      -> Maybe TrustedKeyGroups
      -> Maybe Text
      -> Maybe Integer
      -> Maybe ForwardedValues
      -> Maybe TrustedSigners
      -> Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
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
"MinTTL")
      Either
  String
  (Maybe Bool
   -> Maybe Bool
   -> Maybe TrustedKeyGroups
   -> Maybe Text
   -> Maybe Integer
   -> Maybe ForwardedValues
   -> Maybe TrustedSigners
   -> Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Bool
      -> Maybe TrustedKeyGroups
      -> Maybe Text
      -> Maybe Integer
      -> Maybe ForwardedValues
      -> Maybe TrustedSigners
      -> Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
forall (f :: * -> *) a b. Applicative f => 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
"Compress")
      Either
  String
  (Maybe Bool
   -> Maybe TrustedKeyGroups
   -> Maybe Text
   -> Maybe Integer
   -> Maybe ForwardedValues
   -> Maybe TrustedSigners
   -> Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe TrustedKeyGroups
      -> Maybe Text
      -> Maybe Integer
      -> Maybe ForwardedValues
      -> Maybe TrustedSigners
      -> Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
forall (f :: * -> *) a b. Applicative f => 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
"SmoothStreaming")
      Either
  String
  (Maybe TrustedKeyGroups
   -> Maybe Text
   -> Maybe Integer
   -> Maybe ForwardedValues
   -> Maybe TrustedSigners
   -> Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe TrustedKeyGroups)
-> Either
     String
     (Maybe Text
      -> Maybe Integer
      -> Maybe ForwardedValues
      -> Maybe TrustedSigners
      -> Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe TrustedKeyGroups)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TrustedKeyGroups")
      Either
  String
  (Maybe Text
   -> Maybe Integer
   -> Maybe ForwardedValues
   -> Maybe TrustedSigners
   -> Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Integer
      -> Maybe ForwardedValues
      -> Maybe TrustedSigners
      -> Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
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
"RealtimeLogConfigArn")
      Either
  String
  (Maybe Integer
   -> Maybe ForwardedValues
   -> Maybe TrustedSigners
   -> Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe ForwardedValues
      -> Maybe TrustedSigners
      -> Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
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 ForwardedValues
   -> Maybe TrustedSigners
   -> Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe ForwardedValues)
-> Either
     String
     (Maybe TrustedSigners
      -> Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ForwardedValues)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ForwardedValues")
      Either
  String
  (Maybe TrustedSigners
   -> Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe TrustedSigners)
-> Either
     String
     (Maybe FunctionAssociations
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe TrustedSigners)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TrustedSigners")
      Either
  String
  (Maybe FunctionAssociations
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe FunctionAssociations)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe FunctionAssociations)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"FunctionAssociations")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> ViewerProtocolPolicy
      -> CacheBehavior)
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
"OriginRequestPolicyId")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> ViewerProtocolPolicy
   -> CacheBehavior)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Text -> Text -> ViewerProtocolPolicy -> CacheBehavior)
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
"FieldLevelEncryptionId")
      Either
  String
  (Maybe Text
   -> Text -> Text -> ViewerProtocolPolicy -> CacheBehavior)
-> Either String (Maybe Text)
-> Either
     String (Text -> Text -> ViewerProtocolPolicy -> CacheBehavior)
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
"CachePolicyId")
      Either
  String (Text -> Text -> ViewerProtocolPolicy -> CacheBehavior)
-> Either String Text
-> Either String (Text -> ViewerProtocolPolicy -> CacheBehavior)
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
"PathPattern")
      Either String (Text -> ViewerProtocolPolicy -> CacheBehavior)
-> Either String Text
-> Either String (ViewerProtocolPolicy -> CacheBehavior)
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
"TargetOriginId")
      Either String (ViewerProtocolPolicy -> CacheBehavior)
-> Either String ViewerProtocolPolicy
-> Either String CacheBehavior
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ViewerProtocolPolicy
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ViewerProtocolPolicy")

instance Prelude.Hashable CacheBehavior

instance Prelude.NFData CacheBehavior

instance Core.ToXML CacheBehavior where
  toXML :: CacheBehavior -> XML
toXML CacheBehavior' {Maybe Bool
Maybe Integer
Maybe Text
Maybe FunctionAssociations
Maybe LambdaFunctionAssociations
Maybe AllowedMethods
Maybe ForwardedValues
Maybe TrustedKeyGroups
Maybe TrustedSigners
Text
ViewerProtocolPolicy
viewerProtocolPolicy :: ViewerProtocolPolicy
targetOriginId :: Text
pathPattern :: Text
cachePolicyId :: Maybe Text
fieldLevelEncryptionId :: Maybe Text
originRequestPolicyId :: Maybe Text
functionAssociations :: Maybe FunctionAssociations
trustedSigners :: Maybe TrustedSigners
forwardedValues :: Maybe ForwardedValues
defaultTTL :: Maybe Integer
realtimeLogConfigArn :: Maybe Text
trustedKeyGroups :: Maybe TrustedKeyGroups
smoothStreaming :: Maybe Bool
compress :: Maybe Bool
minTTL :: Maybe Integer
maxTTL :: Maybe Integer
lambdaFunctionAssociations :: Maybe LambdaFunctionAssociations
allowedMethods :: Maybe AllowedMethods
$sel:viewerProtocolPolicy:CacheBehavior' :: CacheBehavior -> ViewerProtocolPolicy
$sel:targetOriginId:CacheBehavior' :: CacheBehavior -> Text
$sel:pathPattern:CacheBehavior' :: CacheBehavior -> Text
$sel:cachePolicyId:CacheBehavior' :: CacheBehavior -> Maybe Text
$sel:fieldLevelEncryptionId:CacheBehavior' :: CacheBehavior -> Maybe Text
$sel:originRequestPolicyId:CacheBehavior' :: CacheBehavior -> Maybe Text
$sel:functionAssociations:CacheBehavior' :: CacheBehavior -> Maybe FunctionAssociations
$sel:trustedSigners:CacheBehavior' :: CacheBehavior -> Maybe TrustedSigners
$sel:forwardedValues:CacheBehavior' :: CacheBehavior -> Maybe ForwardedValues
$sel:defaultTTL:CacheBehavior' :: CacheBehavior -> Maybe Integer
$sel:realtimeLogConfigArn:CacheBehavior' :: CacheBehavior -> Maybe Text
$sel:trustedKeyGroups:CacheBehavior' :: CacheBehavior -> Maybe TrustedKeyGroups
$sel:smoothStreaming:CacheBehavior' :: CacheBehavior -> Maybe Bool
$sel:compress:CacheBehavior' :: CacheBehavior -> Maybe Bool
$sel:minTTL:CacheBehavior' :: CacheBehavior -> Maybe Integer
$sel:maxTTL:CacheBehavior' :: CacheBehavior -> Maybe Integer
$sel:lambdaFunctionAssociations:CacheBehavior' :: CacheBehavior -> Maybe LambdaFunctionAssociations
$sel:allowedMethods:CacheBehavior' :: CacheBehavior -> Maybe AllowedMethods
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"AllowedMethods" Name -> Maybe AllowedMethods -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe AllowedMethods
allowedMethods,
        Name
"LambdaFunctionAssociations"
          Name -> Maybe LambdaFunctionAssociations -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe LambdaFunctionAssociations
lambdaFunctionAssociations,
        Name
"MaxTTL" Name -> Maybe Integer -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Integer
maxTTL,
        Name
"MinTTL" Name -> Maybe Integer -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Integer
minTTL,
        Name
"Compress" Name -> Maybe Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Bool
compress,
        Name
"SmoothStreaming" Name -> Maybe Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Bool
smoothStreaming,
        Name
"TrustedKeyGroups" Name -> Maybe TrustedKeyGroups -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe TrustedKeyGroups
trustedKeyGroups,
        Name
"RealtimeLogConfigArn" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
realtimeLogConfigArn,
        Name
"DefaultTTL" Name -> Maybe Integer -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Integer
defaultTTL,
        Name
"ForwardedValues" Name -> Maybe ForwardedValues -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ForwardedValues
forwardedValues,
        Name
"TrustedSigners" Name -> Maybe TrustedSigners -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe TrustedSigners
trustedSigners,
        Name
"FunctionAssociations" Name -> Maybe FunctionAssociations -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe FunctionAssociations
functionAssociations,
        Name
"OriginRequestPolicyId"
          Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
originRequestPolicyId,
        Name
"FieldLevelEncryptionId"
          Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
fieldLevelEncryptionId,
        Name
"CachePolicyId" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
cachePolicyId,
        Name
"PathPattern" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
pathPattern,
        Name
"TargetOriginId" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
targetOriginId,
        Name
"ViewerProtocolPolicy" Name -> ViewerProtocolPolicy -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= ViewerProtocolPolicy
viewerProtocolPolicy
      ]