@Generated(value="jsii-pacmak/1.70.0 (build 03c2f6f)", date="2022-11-01T13:16:44.014Z") @Stability(value=Experimental) public interface SourceConfiguration extends software.amazon.jsii.JsiiSerializable
An origin is what CloudFront will "be in front of" - that is, CloudFront will pull it's assets from an origin.
If you're using s3 as a source - pass the s3Origin property, otherwise, pass the customOriginSource property.
One or the other must be passed, and it is invalid to pass both in the same SourceConfiguration.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.core.*;
import software.amazon.awscdk.services.cloudfront.*;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.services.s3.*;
Bucket bucket;
Duration duration;
Function function_;
KeyGroup keyGroup;
OriginAccessIdentity originAccessIdentity;
Version version;
SourceConfiguration sourceConfiguration = SourceConfiguration.builder()
.behaviors(List.of(Behavior.builder()
.allowedMethods(CloudFrontAllowedMethods.GET_HEAD)
.cachedMethods(CloudFrontAllowedCachedMethods.GET_HEAD)
.compress(false)
.defaultTtl(duration)
.forwardedValues(ForwardedValuesProperty.builder()
.queryString(false)
// the properties below are optional
.cookies(CookiesProperty.builder()
.forward("forward")
// the properties below are optional
.whitelistedNames(List.of("whitelistedNames"))
.build())
.headers(List.of("headers"))
.queryStringCacheKeys(List.of("queryStringCacheKeys"))
.build())
.functionAssociations(List.of(FunctionAssociation.builder()
.eventType(FunctionEventType.VIEWER_REQUEST)
.function(function_)
.build()))
.isDefaultBehavior(false)
.lambdaFunctionAssociations(List.of(LambdaFunctionAssociation.builder()
.eventType(LambdaEdgeEventType.ORIGIN_REQUEST)
.lambdaFunction(version)
// the properties below are optional
.includeBody(false)
.build()))
.maxTtl(duration)
.minTtl(duration)
.pathPattern("pathPattern")
.trustedKeyGroups(List.of(keyGroup))
.trustedSigners(List.of("trustedSigners"))
.viewerProtocolPolicy(ViewerProtocolPolicy.HTTPS_ONLY)
.build()))
// the properties below are optional
.connectionAttempts(123)
.connectionTimeout(duration)
.customOriginSource(CustomOriginConfig.builder()
.domainName("domainName")
// the properties below are optional
.allowedOriginSSLVersions(List.of(OriginSslPolicy.SSL_V3))
.httpPort(123)
.httpsPort(123)
.originHeaders(Map.of(
"originHeadersKey", "originHeaders"))
.originKeepaliveTimeout(duration)
.originPath("originPath")
.originProtocolPolicy(OriginProtocolPolicy.HTTP_ONLY)
.originReadTimeout(duration)
.originShieldRegion("originShieldRegion")
.build())
.failoverCriteriaStatusCodes(List.of(FailoverStatusCode.FORBIDDEN))
.failoverCustomOriginSource(CustomOriginConfig.builder()
.domainName("domainName")
// the properties below are optional
.allowedOriginSSLVersions(List.of(OriginSslPolicy.SSL_V3))
.httpPort(123)
.httpsPort(123)
.originHeaders(Map.of(
"originHeadersKey", "originHeaders"))
.originKeepaliveTimeout(duration)
.originPath("originPath")
.originProtocolPolicy(OriginProtocolPolicy.HTTP_ONLY)
.originReadTimeout(duration)
.originShieldRegion("originShieldRegion")
.build())
.failoverS3OriginSource(S3OriginConfig.builder()
.s3BucketSource(bucket)
// the properties below are optional
.originAccessIdentity(originAccessIdentity)
.originHeaders(Map.of(
"originHeadersKey", "originHeaders"))
.originPath("originPath")
.originShieldRegion("originShieldRegion")
.build())
.originHeaders(Map.of(
"originHeadersKey", "originHeaders"))
.originPath("originPath")
.originShieldRegion("originShieldRegion")
.s3OriginSource(S3OriginConfig.builder()
.s3BucketSource(bucket)
// the properties below are optional
.originAccessIdentity(originAccessIdentity)
.originHeaders(Map.of(
"originHeadersKey", "originHeaders"))
.originPath("originPath")
.originShieldRegion("originShieldRegion")
.build())
.build();
| Modifier and Type | Interface and Description |
|---|---|
static class |
SourceConfiguration.Builder
A builder for
SourceConfiguration |
static class |
SourceConfiguration.Jsii$Proxy
An implementation for
SourceConfiguration |
| Modifier and Type | Method and Description |
|---|---|
static SourceConfiguration.Builder |
builder() |
List<Behavior> |
getBehaviors()
(experimental) The behaviors associated with this source.
|
default Number |
getConnectionAttempts()
(experimental) The number of times that CloudFront attempts to connect to the origin.
|
default Duration |
getConnectionTimeout()
(experimental) The number of seconds that CloudFront waits when trying to establish a connection to the origin.
|
default CustomOriginConfig |
getCustomOriginSource()
(experimental) A custom origin source - for all non-s3 sources.
|
default List<FailoverStatusCode> |
getFailoverCriteriaStatusCodes()
(experimental) HTTP status code to failover to second origin.
|
default CustomOriginConfig |
getFailoverCustomOriginSource()
(experimental) A custom origin source for failover in case the s3OriginSource returns invalid status code.
|
default S3OriginConfig |
getFailoverS3OriginSource()
(experimental) An s3 origin source for failover in case the s3OriginSource returns invalid status code.
|
default Map<String,String> |
getOriginHeaders()
Deprecated.
Use originHeaders on s3OriginSource or customOriginSource
|
default String |
getOriginPath()
Deprecated.
Use originPath on s3OriginSource or customOriginSource
|
default String |
getOriginShieldRegion()
(experimental) When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
|
default S3OriginConfig |
getS3OriginSource()
(experimental) An s3 origin source - if you're using s3 for your assets.
|
@Stability(value=Experimental) @NotNull List<Behavior> getBehaviors()
At least one (default) behavior must be included.
@Stability(value=Experimental) @Nullable default Number getConnectionAttempts()
You can specify 1, 2, or 3 as the number of attempts.
Default: 3
@Stability(value=Experimental) @Nullable default Duration getConnectionTimeout()
You can specify a number of seconds between 1 and 10 (inclusive).
Default: cdk.Duration.seconds(10)
@Stability(value=Experimental) @Nullable default CustomOriginConfig getCustomOriginSource()
@Stability(value=Experimental) @Nullable default List<FailoverStatusCode> getFailoverCriteriaStatusCodes()
Default: [500, 502, 503, 504]
@Stability(value=Experimental) @Nullable default CustomOriginConfig getFailoverCustomOriginSource()
Default: - no failover configuration
@Stability(value=Experimental) @Nullable default S3OriginConfig getFailoverS3OriginSource()
Default: - no failover configuration
@Stability(value=Deprecated) @Deprecated @Nullable default Map<String,String> getOriginHeaders()
Default: - No additional headers are passed.
@Stability(value=Deprecated) @Deprecated @Nullable default String getOriginPath()
Default: /
@Stability(value=Experimental) @Nullable default String getOriginShieldRegion()
Default: - origin shield not enabled
@Stability(value=Experimental) @Nullable default S3OriginConfig getS3OriginSource()
@Stability(value=Experimental) static SourceConfiguration.Builder builder()
SourceConfiguration.Builder of SourceConfigurationCopyright © 2022. All rights reserved.