Class CfnFunction
- All Implemented Interfaces:
IConstruct,IDependable,IInspectable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
AWS::CloudFront::Function.
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")
.functionCode("functionCode")
.functionConfig(FunctionConfigProperty.builder()
.comment("comment")
.runtime("runtime")
.build())
.name("name")
// the properties below are optional
.autoPublish(false)
.functionMetadata(FunctionMetadataProperty.builder()
.functionArn("functionArn")
.build())
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnFunction.static interfaceContains configuration information about a CloudFront function.static interfaceContains metadata about a CloudFront function.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCfnFunction(Construct scope, String id, CfnFunctionProps props) Create a newAWS::CloudFront::Function.protectedCfnFunction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnFunction(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionThe ARN of the function.The Amazon Resource Name (ARN) of the function.A flag that determines whether to automatically publish the function to theLIVEstage when it’s created.The function code.Contains configuration information about a CloudFront function.Contains metadata about a CloudFront function.getName()A name to identify the function.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetAutoPublish(Boolean value) A flag that determines whether to automatically publish the function to theLIVEstage when it’s created.voidsetAutoPublish(IResolvable value) A flag that determines whether to automatically publish the function to theLIVEstage when it’s created.voidsetFunctionCode(String value) The function code.voidsetFunctionConfig(IResolvable value) Contains configuration information about a CloudFront function.voidContains configuration information about a CloudFront function.voidsetFunctionMetadata(IResolvable value) Contains metadata about a CloudFront function.voidContains metadata about a CloudFront function.voidA name to identify the function.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.core.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnFunction
protected CfnFunction(software.amazon.jsii.JsiiObjectRef objRef) -
CfnFunction
protected CfnFunction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnFunction
@Stability(Stable) public CfnFunction(@NotNull Construct scope, @NotNull String id, @NotNull CfnFunctionProps props) Create a newAWS::CloudFront::Function.- Parameters:
scope-- scope in which this resource is defined.
id-- scoped id of the resource.
props-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrFunctionArn
The ARN of the function. For example:.arn:aws:cloudfront::123456789012:function/ExampleFunction.To get the function ARN, use the following syntax:
!GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN -
getAttrFunctionMetadataFunctionArn
The Amazon Resource Name (ARN) of the function.The ARN uniquely identifies the function.
-
getAttrStage
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getFunctionCode
The function code.For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide .
-
setFunctionCode
The function code.For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide .
-
getFunctionConfig
Contains configuration information about a CloudFront function. -
setFunctionConfig
Contains configuration information about a CloudFront function. -
setFunctionConfig
Contains configuration information about a CloudFront function. -
getName
A name to identify the function. -
setName
A name to identify the function. -
getAutoPublish
A flag that determines whether to automatically publish the function to theLIVEstage when it’s created.To automatically publish to the
LIVEstage, set this property totrue. -
setAutoPublish
A flag that determines whether to automatically publish the function to theLIVEstage when it’s created.To automatically publish to the
LIVEstage, set this property totrue. -
setAutoPublish
A flag that determines whether to automatically publish the function to theLIVEstage when it’s created.To automatically publish to the
LIVEstage, set this property totrue. -
getFunctionMetadata
Contains metadata about a CloudFront function. -
setFunctionMetadata
Contains metadata about a CloudFront function. -
setFunctionMetadata
@Stability(Stable) public void setFunctionMetadata(@Nullable CfnFunction.FunctionMetadataProperty value) Contains metadata about a CloudFront function.
-