Skip to content

Latest commit

 

History

History
198 lines (120 loc) · 7.59 KB

File metadata and controls

198 lines (120 loc) · 7.59 KB

API Reference

Constructs

SharedStaticWebsiteHosting

Host static websites on a shared CloudFront distribution.

Initializers

import { SharedStaticWebsiteHosting } from '@scaleleap/cdk-shared-static-website-hosting'

new SharedStaticWebsiteHosting(scope: Construct, id: string, props: SharedStaticWebsiteHostingProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props SharedStaticWebsiteHostingProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { SharedStaticWebsiteHosting } from '@scaleleap/cdk-shared-static-website-hosting'

SharedStaticWebsiteHosting.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
bucket aws-cdk-lib.aws_s3.IBucket Bucket where the static files are stored.
distribution aws-cdk-lib.aws_cloudfront.IDistribution CloudFront distribution.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


bucketRequired
public readonly bucket: IBucket;
  • Type: aws-cdk-lib.aws_s3.IBucket

Bucket where the static files are stored.


distributionRequired
public readonly distribution: IDistribution;
  • Type: aws-cdk-lib.aws_cloudfront.IDistribution

CloudFront distribution.


Structs

SharedStaticWebsiteHostingProps

Initializer

import { SharedStaticWebsiteHostingProps } from '@scaleleap/cdk-shared-static-website-hosting'

const sharedStaticWebsiteHostingProps: SharedStaticWebsiteHostingProps = { ... }

Properties

Name Type Description
hostedZone aws-cdk-lib.aws_route53.IHostedZone A hosted zone that is open for modification by the construct.
bucket aws-cdk-lib.aws_s3.IBucket An S3 bucket where the static files will be stored.

hostedZoneRequired
public readonly hostedZone: IHostedZone;
  • Type: aws-cdk-lib.aws_route53.IHostedZone

A hosted zone that is open for modification by the construct.

This construct will add a wildcard A record that points to the CloudFront distribution.


bucketOptional
public readonly bucket: IBucket;
  • Type: aws-cdk-lib.aws_s3.IBucket
  • Default: A new bucket will be created, if not provided.

An S3 bucket where the static files will be stored.

This construct assumes full control of the bucket.