Skip to content

Update Cache Policy

cloudfront_update_cache_policy R Documentation

Updates a cache policy configuration

Description

Updates a cache policy configuration.

When you update a cache policy configuration, all the fields are updated with the values provided in the request. You cannot update some fields independent of others. To update a cache policy configuration:

  1. Use get_cache_policy_config to get the current configuration.

  2. Locally modify the fields in the cache policy configuration that you want to update.

  3. Call update_cache_policy by providing the entire cache policy configuration, including the fields that you modified and those that you didn't.

If your minimum TTL is greater than 0, CloudFront will cache content for at least the duration specified in the cache policy's minimum TTL, even if the Cache-Control: no-cache, no-store, or private directives are present in the origin headers.

Usage

cloudfront_update_cache_policy(CachePolicyConfig, Id, IfMatch)

Arguments

CachePolicyConfig

[required] A cache policy configuration.

Id

[required] The unique identifier for the cache policy that you are updating. The identifier is returned in a cache behavior's CachePolicyId field in the response to get_distribution_config.

IfMatch

The version of the cache policy that you are updating. The version is returned in the cache policy's ETag field in the response to get_cache_policy_config.

Value

A list with the following syntax:

list(
  CachePolicy = list(
    Id = "string",
    LastModifiedTime = as.POSIXct(
      "2015-01-01"
    ),
    CachePolicyConfig = list(
      Comment = "string",
      Name = "string",
      DefaultTTL = 123,
      MaxTTL = 123,
      MinTTL = 123,
      ParametersInCacheKeyAndForwardedToOrigin = list(
        EnableAcceptEncodingGzip = TRUE|FALSE,
        EnableAcceptEncodingBrotli = TRUE|FALSE,
        HeadersConfig = list(
          HeaderBehavior = "none"|"whitelist",
          Headers = list(
            Quantity = 123,
            Items = list(
              "string"
            )
          )
        ),
        CookiesConfig = list(
          CookieBehavior = "none"|"whitelist"|"allExcept"|"all",
          Cookies = list(
            Quantity = 123,
            Items = list(
              "string"
            )
          )
        ),
        QueryStringsConfig = list(
          QueryStringBehavior = "none"|"whitelist"|"allExcept"|"all",
          QueryStrings = list(
            Quantity = 123,
            Items = list(
              "string"
            )
          )
        )
      )
    )
  ),
  ETag = "string"
)

Request syntax

svc$update_cache_policy(
  CachePolicyConfig = list(
    Comment = "string",
    Name = "string",
    DefaultTTL = 123,
    MaxTTL = 123,
    MinTTL = 123,
    ParametersInCacheKeyAndForwardedToOrigin = list(
      EnableAcceptEncodingGzip = TRUE|FALSE,
      EnableAcceptEncodingBrotli = TRUE|FALSE,
      HeadersConfig = list(
        HeaderBehavior = "none"|"whitelist",
        Headers = list(
          Quantity = 123,
          Items = list(
            "string"
          )
        )
      ),
      CookiesConfig = list(
        CookieBehavior = "none"|"whitelist"|"allExcept"|"all",
        Cookies = list(
          Quantity = 123,
          Items = list(
            "string"
          )
        )
      ),
      QueryStringsConfig = list(
        QueryStringBehavior = "none"|"whitelist"|"allExcept"|"all",
        QueryStrings = list(
          Quantity = 123,
          Items = list(
            "string"
          )
        )
      )
    )
  ),
  Id = "string",
  IfMatch = "string"
)