Skip to content

Update Function

cloudfront_update_function R Documentation

Updates a CloudFront function

Description

Updates a CloudFront function.

You can update a function's code or the comment that describes the function. You cannot update a function's name.

To update a function, you provide the function's name and version (ETag value) along with the updated function code. To get the name and version, you can use list_functions and describe_function.

Usage

cloudfront_update_function(Name, IfMatch, FunctionConfig, FunctionCode)

Arguments

Name

[required] The name of the function that you are updating.

IfMatch

[required] The current version (ETag value) of the function that you are updating, which you can get using describe_function.

FunctionConfig

[required] Configuration information about the function.

FunctionCode

[required] The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.

Value

A list with the following syntax:

list(
  FunctionSummary = list(
    Name = "string",
    Status = "string",
    FunctionConfig = list(
      Comment = "string",
      Runtime = "cloudfront-js-1.0"|"cloudfront-js-2.0",
      KeyValueStoreAssociations = list(
        Quantity = 123,
        Items = list(
          list(
            KeyValueStoreARN = "string"
          )
        )
      )
    ),
    FunctionMetadata = list(
      FunctionARN = "string",
      Stage = "DEVELOPMENT"|"LIVE",
      CreatedTime = as.POSIXct(
        "2015-01-01"
      ),
      LastModifiedTime = as.POSIXct(
        "2015-01-01"
      )
    )
  ),
  ETag = "string"
)

Request syntax

svc$update_function(
  Name = "string",
  IfMatch = "string",
  FunctionConfig = list(
    Comment = "string",
    Runtime = "cloudfront-js-1.0"|"cloudfront-js-2.0",
    KeyValueStoreAssociations = list(
      Quantity = 123,
      Items = list(
        list(
          KeyValueStoreARN = "string"
        )
      )
    )
  ),
  FunctionCode = raw
)

Examples

## Not run: 
# Use the following command to update a function.
svc$update_function(
  FunctionCode = "function-code-changed.js",
  FunctionConfig = list(
    Comment = "my-changed-comment",
    KeyValueStoreAssociations = list(
      Items = list(
        list(
          KeyValueStoreARN = "arn:aws:cloudfront::123456789012:key-value-st..."
        )
      ),
      Quantity = 1L
    ),
    Runtime = "cloudfront-js-2.0"
  ),
  IfMatch = "ETVPDKIKX0DER",
  Name = "my-function-name"
)

## End(Not run)