Class AddBehaviorOptions
Options for adding a new behavior to a Distribution.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AddBehaviorOptions : Object, IAddBehaviorOptions
Syntax (vb)
Public Class AddBehaviorOptions
Inherits Object
Implements IAddBehaviorOptions
Remarks
ExampleMetadata: infused
Examples
// Add a behavior to a Distribution after initial creation.
Bucket myBucket;
Distribution myWebDistribution;
myWebDistribution.AddBehavior("/images/*.jpg", new S3Origin(myBucket), new AddBehaviorOptions {
ViewerProtocolPolicy = ViewerProtocolPolicy.REDIRECT_TO_HTTPS
});
Synopsis
Constructors
AddBehaviorOptions() |
Properties
AllowedMethods | HTTP methods to allow for this behavior. |
CachedMethods | HTTP methods to cache for this behavior. |
CachePolicy | The cache policy for this behavior. |
Compress | Whether you want CloudFront to automatically compress certain files for this cache behavior. |
EdgeLambdas | The Lambda@Edge functions to invoke before serving the contents. |
FunctionAssociations | The CloudFront functions to invoke before serving the contents. |
OriginRequestPolicy | The origin request policy for this behavior. |
RealtimeLogConfig | The real-time log configuration to be attached to this cache behavior. |
ResponseHeadersPolicy | The response headers policy for this behavior. |
SmoothStreaming | Set this to true to indicate you want to distribute media files in the Microsoft Smooth Streaming format using this behavior. |
TrustedKeyGroups | A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies. |
ViewerProtocolPolicy | The protocol that viewers can use to access the files controlled by this behavior. |
Constructors
AddBehaviorOptions()
public AddBehaviorOptions()
Properties
AllowedMethods
HTTP methods to allow for this behavior.
public AllowedMethods AllowedMethods { get; set; }
Property Value
Remarks
Default: AllowedMethods.ALLOW_GET_HEAD
CachedMethods
HTTP methods to cache for this behavior.
public CachedMethods CachedMethods { get; set; }
Property Value
Remarks
Default: CachedMethods.CACHE_GET_HEAD
CachePolicy
The cache policy for this behavior.
public ICachePolicy CachePolicy { get; set; }
Property Value
Remarks
The cache policy determines what values are included in the cache key, and the time-to-live (TTL) values for the cache.
Default: CachePolicy.CACHING_OPTIMIZED
See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html.
Compress
Whether you want CloudFront to automatically compress certain files for this cache behavior.
public Nullable<bool> Compress { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront-file-types for file types CloudFront will compress.
Default: true
EdgeLambdas
The Lambda@Edge functions to invoke before serving the contents.
public IEdgeLambda[] EdgeLambdas { get; set; }
Property Value
Remarks
Default: - no Lambda functions will be invoked
FunctionAssociations
The CloudFront functions to invoke before serving the contents.
public IFunctionAssociation[] FunctionAssociations { get; set; }
Property Value
Remarks
Default: - no functions will be invoked
OriginRequestPolicy
The origin request policy for this behavior.
public IOriginRequestPolicy OriginRequestPolicy { get; set; }
Property Value
Remarks
The origin request policy determines which values (e.g., headers, cookies) are included in requests that CloudFront sends to the origin.
Default: - none
RealtimeLogConfig
The real-time log configuration to be attached to this cache behavior.
public IRealtimeLogConfig RealtimeLogConfig { get; set; }
Property Value
Remarks
Default: - none
ResponseHeadersPolicy
The response headers policy for this behavior.
public IResponseHeadersPolicy ResponseHeadersPolicy { get; set; }
Property Value
Remarks
The response headers policy determines which headers are included in responses
Default: - none
SmoothStreaming
Set this to true to indicate you want to distribute media files in the Microsoft Smooth Streaming format using this behavior.
public Nullable<bool> SmoothStreaming { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
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
See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html
ViewerProtocolPolicy
The protocol that viewers can use to access the files controlled by this behavior.
public Nullable<ViewerProtocolPolicy> ViewerProtocolPolicy { get; set; }
Property Value
System.Nullable<ViewerProtocolPolicy>
Remarks
Default: ViewerProtocolPolicy.ALLOW_ALL