Interface CfnDistributionTenantProps
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
CfnDistributionTenantProps.Jsii$Proxy
CfnDistributionTenant.
Example:
// Create the simple Origin
Bucket myBucket = new Bucket(this, "myBucket");
IOrigin s3Origin = S3BucketOrigin.withOriginAccessControl(myBucket, S3BucketOriginWithOACProps.builder()
.originAccessLevels(List.of(AccessLevel.READ, AccessLevel.LIST))
.build());
// Create the Distribution construct
Distribution myMultiTenantDistribution = Distribution.Builder.create(this, "cf-hosted-distribution")
.defaultBehavior(BehaviorOptions.builder()
.origin(s3Origin)
.build())
.defaultRootObject("index.html")
.build();
// Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
CfnDistribution cfnDistribution = (CfnDistribution)myMultiTenantDistribution.getNode().getDefaultChild();
DefaultCacheBehaviorProperty defaultCacheBehavior = DefaultCacheBehaviorProperty.builder()
.targetOriginId(myBucket.getBucketArn())
.viewerProtocolPolicy("allow-all")
.compress(false)
.allowedMethods(List.of("GET", "HEAD"))
.cachePolicyId(CachePolicy.CACHING_OPTIMIZED.getCachePolicyId())
.build();
// Create the updated distributionConfig
DistributionConfigProperty distributionConfig = DistributionConfigProperty.builder()
.defaultCacheBehavior(defaultCacheBehavior)
.enabled(true)
// the properties below are optional
.connectionMode("tenant-only")
.origins(List.of(OriginProperty.builder()
.id(myBucket.getBucketArn())
.domainName(myBucket.getBucketDomainName())
.s3OriginConfig(S3OriginConfigProperty.builder().build())
.originPath("/{{tenantName}}")
.build()))
.tenantConfig(TenantConfigProperty.builder()
.parameterDefinitions(List.of(ParameterDefinitionProperty.builder()
.definition(DefinitionProperty.builder()
.stringSchema(StringSchemaProperty.builder()
.required(false)
// the properties below are optional
.comment("tenantName")
.defaultValue("root")
.build())
.build())
.name("tenantName")
.build()))
.build())
.build();
// Override the distribution configuration to enable multi-tenancy.
cfnDistribution.getDistributionConfig() = distributionConfig;
// Create a connection group so we have access to the RoutingEndpoint associated with the tenant we are about to create
CfnConnectionGroup connectionGroup = CfnConnectionGroup.Builder.create(this, "self-hosted-connection-group")
.enabled(true)
.ipv6Enabled(true)
.name("self-hosted-connection-group")
.build();
// Export the RoutingEndpoint, skip this step if you'd prefer to fetch it from the CloudFront console or via Cloudfront.ListConnectionGroups API
// Export the RoutingEndpoint, skip this step if you'd prefer to fetch it from the CloudFront console or via Cloudfront.ListConnectionGroups API
CfnOutput.Builder.create(this, "RoutingEndpoint")
.value(connectionGroup.getAttrRoutingEndpoint())
.description("CloudFront Routing Endpoint to be added to my hosted zone CNAME records")
.build();
// Create a distribution tenant with a self-hosted domain.
CfnDistributionTenant selfHostedTenant = CfnDistributionTenant.Builder.create(this, "self-hosted-tenant")
.distributionId(myMultiTenantDistribution.getDistributionId())
.connectionGroupId(connectionGroup.getAttrId())
.name("self-hosted-tenant")
.domains(List.of("self-hosted-tenant.my.domain.com"))
.enabled(true)
.managedCertificateRequest(ManagedCertificateRequestProperty.builder()
.primaryDomainName("self-hosted-tenant.my.domain.com")
.validationTokenHost("self-hosted")
.build())
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forCfnDistributionTenantPropsstatic final classAn implementation forCfnDistributionTenantProps -
Method Summary
Modifier and TypeMethodDescriptionbuilder()default StringThe ID of the connection group for the distribution tenant.default ObjectCustomizations for the distribution tenant.The ID of the multi-tenant distribution.The domains associated with the distribution tenant.default ObjectIndicates whether the distribution tenant is in an enabled state.default ObjectAn object that represents the request for the Amazon CloudFront managed ACM certificate.getName()The name of the distribution tenant.default ObjectA list of parameter values to add to the resource.getTags()A complex type that contains zero or moreTagelements.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getDistributionId
The ID of the multi-tenant distribution.- See Also:
-
getDomains
The domains associated with the distribution tenant.- See Also:
-
getName
The name of the distribution tenant.- See Also:
-
getConnectionGroupId
The ID of the connection group for the distribution tenant.If you don't specify a connection group, CloudFront uses the default connection group.
- See Also:
-
getCustomizations
Customizations for the distribution tenant.For each distribution tenant, you can specify the geographic restrictions, and the Amazon Resource Names (ARNs) for the ACM certificate and AWS WAF web ACL. These are specific values that you can override or disable from the multi-tenant distribution that was used to create the distribution tenant.
Returns union: either
IResolvableorCfnDistributionTenant.CustomizationsProperty- See Also:
-
getEnabled
Indicates whether the distribution tenant is in an enabled state.If disabled, the distribution tenant won't serve traffic.
Returns union: either
BooleanorIResolvable- See Also:
-
getManagedCertificateRequest
An object that represents the request for the Amazon CloudFront managed ACM certificate.Returns union: either
IResolvableorCfnDistributionTenant.ManagedCertificateRequestProperty- See Also:
-
getParameters
A list of parameter values to add to the resource.A parameter is specified as a key-value pair. A valid parameter value must exist for any parameter that is marked as required in the multi-tenant distribution.
Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnDistributionTenant.ParameterProperty>- See Also:
-
getTags
A complex type that contains zero or moreTagelements.- See Also:
-
builder
- Returns:
- a
CfnDistributionTenantProps.BuilderofCfnDistributionTenantProps
-