FunctionArgs

data class FunctionArgs(val code: Output<String>? = null, val comment: Output<String>? = null, val name: Output<String>? = null, val publish: Output<Boolean>? = null, val runtime: Output<String>? = null) : ConvertibleToJava<FunctionArgs>

Provides a CloudFront Function resource. With CloudFront Functions in Amazon CloudFront, you can write lightweight functions in JavaScript for high-scale, latency-sensitive CDN customizations. See CloudFront Functions

NOTE: You cannot delete a function if it’s associated with a cache behavior. First, update your distributions to remove the function association from all cache behaviors, then delete the function.

Example Usage

Basic Example

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudfront.Function;
import com.pulumi.aws.cloudfront.FunctionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new Function("test", FunctionArgs.builder()
.runtime("cloudfront-js-1.0")
.comment("my function")
.publish(true)
.code(Files.readString(Paths.get(String.format("%s/function.js", path.module()))))
.build());
}
}

Import

CloudFront Functions can be imported using the name, e.g.,

$ pulumi import aws:cloudfront/function:Function test my_test_function

Constructors

Link copied to clipboard
constructor(code: Output<String>? = null, comment: Output<String>? = null, name: Output<String>? = null, publish: Output<Boolean>? = null, runtime: Output<String>? = null)

Properties

Link copied to clipboard
val code: Output<String>? = null

Source code of the function

Link copied to clipboard
val comment: Output<String>? = null

Comment.

Link copied to clipboard
val name: Output<String>? = null

Unique name for your CloudFront Function.

Link copied to clipboard
val publish: Output<Boolean>? = null

Whether to publish creation/change as Live CloudFront Function Version. Defaults to true.

Link copied to clipboard
val runtime: Output<String>? = null

Identifier of the function's runtime. Currently only cloudfront-js-1.0 is valid. The following arguments are optional:

Functions

Link copied to clipboard
open override fun toJava(): FunctionArgs