Create Function
cloudfront_create_function | R Documentation |
Creates a CloudFront function¶
Description¶
Creates a CloudFront function.
To create a function, you provide the function code and some configuration information about the function. The response contains an Amazon Resource Name (ARN) that uniquely identifies the function.
When you create a function, it's in the DEVELOPMENT
stage. In this
stage, you can test the function with test_function
, and update it
with update_function
.
When you're ready to use your function with a CloudFront distribution,
use publish_function
to copy the function from the DEVELOPMENT
stage
to LIVE
. When it's live, you can attach the function to a
distribution's cache behavior, using the function's ARN.
Usage¶
Arguments¶
Name
[required] A name to identify the function.
FunctionConfig
[required] Configuration information about the function, including an optional comment and the function's runtime.
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"
)
)
),
Location = "string",
ETag = "string"
)
Request syntax¶
svc$create_function(
Name = "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 create a function.
svc$create_function(
FunctionCode = "function-code.js",
FunctionConfig = list(
Comment = "my-function-comment",
KeyValueStoreAssociations = list(
Items = list(
list(
KeyValueStoreARN = "arn:aws:cloudfront::123456789012:key-value-st..."
)
),
Quantity = 1L
),
Runtime = "cloudfront-js-2.0"
),
Name = "my-function-name"
)
## End(Not run)