Class Behavior
A CloudFront behavior wrapper.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.AWS.CloudFront.dll
Syntax (csharp)
public class Behavior : Object, IBehavior
Syntax (vb)
Public Class Behavior
Inherits Object
Implements IBehavior
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudFront;
using Amazon.CDK.AWS.Lambda;
using Amazon.CDK;
Function function_;
KeyGroup keyGroup;
Version version;
var behavior = new Behavior {
AllowedMethods = CloudFrontAllowedMethods.GET_HEAD,
CachedMethods = CloudFrontAllowedCachedMethods.GET_HEAD,
Compress = false,
DefaultTtl = Duration.Minutes(30),
ForwardedValues = new ForwardedValuesProperty {
QueryString = false,
// the properties below are optional
Cookies = new CookiesProperty {
Forward = "forward",
// the properties below are optional
WhitelistedNames = new [] { "whitelistedNames" }
},
Headers = new [] { "headers" },
QueryStringCacheKeys = new [] { "queryStringCacheKeys" }
},
FunctionAssociations = new [] { new FunctionAssociation {
EventType = FunctionEventType.VIEWER_REQUEST,
Function = function_
} },
IsDefaultBehavior = false,
LambdaFunctionAssociations = new [] { new LambdaFunctionAssociation {
EventType = LambdaEdgeEventType.ORIGIN_REQUEST,
LambdaFunction = version,
// the properties below are optional
IncludeBody = false
} },
MaxTtl = Duration.Minutes(30),
MinTtl = Duration.Minutes(30),
PathPattern = "pathPattern",
TrustedKeyGroups = new [] { keyGroup },
TrustedSigners = new [] { "trustedSigners" },
ViewerProtocolPolicy = ViewerProtocolPolicy.HTTPS_ONLY
};
Synopsis
Constructors
Behavior() |
Properties
AllowedMethods | The method this CloudFront distribution responds do. |
CachedMethods | Which methods are cached by CloudFront by default. |
Compress | If CloudFront should automatically compress some content types. |
DefaultTtl | The default amount of time CloudFront will cache an object. |
ForwardedValues | The values CloudFront will forward to the origin when making a request. |
FunctionAssociations | The CloudFront functions to invoke before serving the contents. |
IsDefaultBehavior | If this behavior is the default behavior for the distribution. |
LambdaFunctionAssociations | Declares associated lambda@edge functions for this distribution behaviour. |
MaxTtl | The max amount of time you want objects to stay in the cache before CloudFront queries your origin. |
MinTtl | The minimum amount of time that you want objects to stay in the cache before CloudFront queries your origin. |
PathPattern | The path this behavior responds to. |
TrustedKeyGroups | A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies. |
TrustedSigners | (deprecated) Trusted signers is how CloudFront allows you to serve private content. |
ViewerProtocolPolicy | The viewer policy for this behavior. |
Constructors
Behavior()
public Behavior()
Properties
AllowedMethods
The method this CloudFront distribution responds do.
public Nullable<CloudFrontAllowedMethods> AllowedMethods { get; set; }
Property Value
System.Nullable<CloudFrontAllowedMethods>
Remarks
Default: GET_HEAD
CachedMethods
Which methods are cached by CloudFront by default.
public Nullable<CloudFrontAllowedCachedMethods> CachedMethods { get; set; }
Property Value
System.Nullable<CloudFrontAllowedCachedMethods>
Remarks
Default: GET_HEAD
Compress
If CloudFront should automatically compress some content types.
public Nullable<bool> Compress { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: true
DefaultTtl
The default amount of time CloudFront will cache an object.
public Duration DefaultTtl { get; set; }
Property Value
Remarks
This value applies only when your custom origin does not add HTTP headers, such as Cache-Control max-age, Cache-Control s-maxage, and Expires to objects.
Default: 86400 (1 day)
ForwardedValues
The values CloudFront will forward to the origin when making a request.
public CfnDistribution.IForwardedValuesProperty ForwardedValues { get; set; }
Property Value
CfnDistribution.IForwardedValuesProperty
Remarks
Default: none (no cookies - no headers)
FunctionAssociations
The CloudFront functions to invoke before serving the contents.
public IFunctionAssociation[] FunctionAssociations { get; set; }
Property Value
Remarks
Default: - no functions will be invoked
IsDefaultBehavior
If this behavior is the default behavior for the distribution.
public Nullable<bool> IsDefaultBehavior { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
You must specify exactly one default distribution per CloudFront distribution. The default behavior is allowed to omit the "path" property.
LambdaFunctionAssociations
Declares associated lambda@edge functions for this distribution behaviour.
public ILambdaFunctionAssociation[] LambdaFunctionAssociations { get; set; }
Property Value
Remarks
Default: No lambda function associated
MaxTtl
The max amount of time you want objects to stay in the cache before CloudFront queries your origin.
public Duration MaxTtl { get; set; }
Property Value
Remarks
Default: Duration.seconds(31536000) (one year)
MinTtl
The minimum amount of time that you want objects to stay in the cache before CloudFront queries your origin.
public Duration MinTtl { get; set; }
Property Value
PathPattern
The path this behavior responds to.
public string PathPattern { get; set; }
Property Value
System.String
Remarks
Required for all non-default behaviors. (The default behavior implicitly has "*" as the path pattern. )
TrustedKeyGroups
A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies.
public IKeyGroup[] TrustedKeyGroups { get; set; }
Property Value
Remarks
Default: - no KeyGroups are associated with cache behavior
TrustedSigners
(deprecated) Trusted signers is how CloudFront allows you to serve private content.
public string[] TrustedSigners { get; set; }
Property Value
System.String[]
Remarks
The signers are the account IDs that are allowed to sign cookies/presigned URLs for this distribution.
If you pass a non empty value, all requests for this behavior must be signed (no public access will be allowed)
Stability: Deprecated
ViewerProtocolPolicy
The viewer policy for this behavior.
public Nullable<ViewerProtocolPolicy> ViewerProtocolPolicy { get; set; }
Property Value
System.Nullable<ViewerProtocolPolicy>
Remarks
Default: - the distribution wide viewer protocol policy will be used