@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:37.094Z") @Stability(value=Stable) public class CfnFunction extends CfnResource implements IInspectable
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, and the function’s stage.
By default, when you create a function, it’s in the DEVELOPMENT stage. In this stage, you can test the function in the CloudFront console (or with TestFunction in the CloudFront API).
When you’re ready to use your function with a CloudFront distribution, publish the function to the LIVE stage. You can do this in the CloudFront console, with PublishFunction in the CloudFront API, or by updating the AWS::CloudFront::Function resource with the AutoPublish property set to true . When the function is published to the LIVE stage, you can attach it to a distribution’s cache behavior, using the function’s ARN.
To automatically publish the function to the LIVE stage when it’s created, set the AutoPublish property to true .
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudfront.*;
CfnFunction cfnFunction = CfnFunction.Builder.create(this, "MyCfnFunction")
.name("name")
// the properties below are optional
.autoPublish(false)
.functionCode("functionCode")
.functionConfig(FunctionConfigProperty.builder()
.comment("comment")
.runtime("runtime")
.build())
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
CfnFunction.Builder
A fluent builder for
CfnFunction. |
static interface |
CfnFunction.FunctionConfigProperty
Contains configuration information about a CloudFront function.
|
static interface |
CfnFunction.FunctionMetadataProperty
Contains metadata about a CloudFront function.
|
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnFunction(software.constructs.Construct scope,
String id,
CfnFunctionProps props)
Create a new `AWS::CloudFront::Function`.
|
protected |
CfnFunction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnFunction(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
String |
getAttrFunctionArn()
The ARN of the function.
|
String |
getAttrFunctionMetadataFunctionArn() |
String |
getAttrStage() |
Object |
getAutoPublish()
A flag that determines whether to automatically publish the function to the `LIVE` stage when it’s created.
|
protected Map<String,Object> |
getCfnProperties() |
String |
getFunctionCode()
The function code.
|
Object |
getFunctionConfig()
Contains configuration information about a CloudFront function.
|
String |
getName()
A name to identify the function.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected Map<String,Object> |
renderProperties(Map<String,Object> props) |
void |
setAutoPublish(Boolean value)
A flag that determines whether to automatically publish the function to the `LIVE` stage when it’s created.
|
void |
setAutoPublish(IResolvable value)
A flag that determines whether to automatically publish the function to the `LIVE` stage when it’s created.
|
void |
setFunctionCode(String value)
The function code.
|
void |
setFunctionConfig(CfnFunction.FunctionConfigProperty value)
Contains configuration information about a CloudFront function.
|
void |
setFunctionConfig(IResolvable value)
Contains configuration information about a CloudFront function.
|
void |
setName(String value)
A name to identify the function.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnFunction(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnFunction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnFunction(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
CfnFunctionProps props)
scope - - scope in which this resource is defined. This parameter is required.id - - scoped id of the resource. This parameter is required.props - - resource properties. This parameter is required.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull public String getAttrFunctionArn()
arn:aws:cloudfront::123456789012:function/ExampleFunction .
To get the function ARN, use the following syntax:
!GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
@Stability(value=Stable) @NotNull public String getAttrFunctionMetadataFunctionArn()
@Stability(value=Stable) @NotNull public String getAttrStage()
@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @NotNull public String getName()
@Stability(value=Stable)
public void setName(@NotNull
String value)
@Stability(value=Stable) @Nullable public Object getAutoPublish()
To automatically publish to the LIVE stage, set this property to true .
@Stability(value=Stable)
public void setAutoPublish(@Nullable
Boolean value)
To automatically publish to the LIVE stage, set this property to true .
@Stability(value=Stable)
public void setAutoPublish(@Nullable
IResolvable value)
To automatically publish to the LIVE stage, set this property to true .
@Stability(value=Stable) @Nullable public String getFunctionCode()
For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide .
@Stability(value=Stable)
public void setFunctionCode(@Nullable
String value)
For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide .
@Stability(value=Stable) @Nullable public Object getFunctionConfig()
@Stability(value=Stable)
public void setFunctionConfig(@Nullable
CfnFunction.FunctionConfigProperty value)
@Stability(value=Stable)
public void setFunctionConfig(@Nullable
IResolvable value)
Copyright © 2022. All rights reserved.