
com.pwrdrvr.microapps.cdk.MicroAppsCF Maven / Gradle / Ivy
package com.pwrdrvr.microapps.cdk;
/**
* (experimental) Create a new MicroApps CloudFront Distribution.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.75.0 (build 63bb957)", date = "2023-06-14T17:32:47.052Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = com.pwrdrvr.microapps.cdk.$Module.class, fqn = "@pwrdrvr/microapps-cdk.MicroAppsCF")
public class MicroAppsCF extends software.constructs.Construct implements com.pwrdrvr.microapps.cdk.IMicroAppsCF {
protected MicroAppsCF(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected MicroAppsCF(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public MicroAppsCF(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull com.pwrdrvr.microapps.cdk.MicroAppsCFProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) Add API Gateway and S3 routes to an existing CloudFront Distribution.
*
* @param _scope This parameter is required.
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static void addRoutes(final @org.jetbrains.annotations.NotNull software.constructs.Construct _scope, final @org.jetbrains.annotations.NotNull com.pwrdrvr.microapps.cdk.AddRoutesOptions props) {
software.amazon.jsii.JsiiObject.jsiiStaticCall(com.pwrdrvr.microapps.cdk.MicroAppsCF.class, "addRoutes", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(_scope, "_scope is required"), java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) Create or get the origin request policy.
*
* If a custom domain name is NOT used for the origin then a policy
* will be created.
*
* If a custom domain name IS used for the origin then the ALL_VIEWER
* policy will be returned. This policy passes the Host header to the
* origin, which is fine when using a custom domain name on the origin.
*
* @param _scope This parameter is required.
* @param _props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.cloudfront.IOriginRequestPolicy createAPIOriginPolicy(final @org.jetbrains.annotations.NotNull software.constructs.Construct _scope, final @org.jetbrains.annotations.NotNull com.pwrdrvr.microapps.cdk.CreateAPIOriginPolicyOptions _props) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(com.pwrdrvr.microapps.cdk.MicroAppsCF.class, "createAPIOriginPolicy", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.cloudfront.IOriginRequestPolicy.class), new Object[] { java.util.Objects.requireNonNull(_scope, "_scope is required"), java.util.Objects.requireNonNull(_props, "_props is required") });
}
/**
* (experimental) The CloudFront distribution.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.cloudfront.Distribution getCloudFrontDistro() {
return software.amazon.jsii.Kernel.get(this, "cloudFrontDistro", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.cloudfront.Distribution.class));
}
/**
* (experimental) A fluent builder for {@link com.pwrdrvr.microapps.cdk.MicroAppsCF}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private final com.pwrdrvr.microapps.cdk.MicroAppsCFProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new com.pwrdrvr.microapps.cdk.MicroAppsCFProps.Builder();
}
/**
* (experimental) S3 bucket origin for deployed applications Marked with `x-microapps-origin: app`.
*
* @return {@code this}
* @param bucketAppsOriginApp S3 bucket origin for deployed applications Marked with `x-microapps-origin: app`. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder bucketAppsOriginApp(final software.amazon.awscdk.services.cloudfront.origins.S3Origin bucketAppsOriginApp) {
this.props.bucketAppsOriginApp(bucketAppsOriginApp);
return this;
}
/**
* (experimental) S3 bucket origin for deployed applications Marked with `x-microapps-origin: s3`.
*
* @return {@code this}
* @param bucketAppsOriginS3 S3 bucket origin for deployed applications Marked with `x-microapps-origin: s3`. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder bucketAppsOriginS3(final software.amazon.awscdk.services.cloudfront.origins.S3Origin bucketAppsOriginS3) {
this.props.bucketAppsOriginS3(bucketAppsOriginS3);
return this;
}
/**
* (experimental) Optional asset name root.
*
* Default: - resource names auto assigned
*
* Example:
*
*
* microapps
*
*
* @return {@code this}
* @param assetNameRoot Optional asset name root. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder assetNameRoot(final java.lang.String assetNameRoot) {
this.props.assetNameRoot(assetNameRoot);
return this;
}
/**
* (experimental) Optional asset name suffix.
*
* Default: none
*
* Example:
*
*
* -dev-pr-12
*
*
* @return {@code this}
* @param assetNameSuffix Optional asset name suffix. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder assetNameSuffix(final java.lang.String assetNameSuffix) {
this.props.assetNameSuffix(assetNameSuffix);
return this;
}
/**
* (experimental) S3 bucket for CloudFront logs.
*
* @return {@code this}
* @param bucketLogs S3 bucket for CloudFront logs. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder bucketLogs(final software.amazon.awscdk.services.s3.IBucket bucketLogs) {
this.props.bucketLogs(bucketLogs);
return this;
}
/**
* (experimental) ACM Certificate that covers `domainNameEdge` name.
*
* @return {@code this}
* @param certEdge ACM Certificate that covers `domainNameEdge` name. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder certEdge(final software.amazon.awscdk.services.certificatemanager.ICertificate certEdge) {
this.props.certEdge(certEdge);
return this;
}
/**
* (experimental) Create an extra Behavior (Route) for /api/ that allows API routes to have a period in them.
*
* When false API routes with a period in the path will get routed to S3.
*
* When true API routes that contain /api/ in the path will get routed to API Gateway
* even if they have a period in the path.
*
* Default: true if httpApi is provided
*
* @return {@code this}
* @param createApiPathRoute Create an extra Behavior (Route) for /api/ that allows API routes to have a period in them. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder createApiPathRoute(final java.lang.Boolean createApiPathRoute) {
this.props.createApiPathRoute(createApiPathRoute);
return this;
}
/**
* (experimental) Create an extra Behavior (Route) for /_next/data/ This route is used by Next.js to load data from the API Gateway on `getServerSideProps` calls. The requests can end in `.json`, which would cause them to be routed to S3 if this route is not created.
*
* When false API routes with a period in the path will get routed to S3.
*
* When true API routes that contain /_next/data/ in the path will get routed to API Gateway
* even if they have a period in the path.
*
* Default: true if httpApi is provided
*
* @return {@code this}
* @param createNextDataPathRoute Create an extra Behavior (Route) for /_next/data/ This route is used by Next.js to load data from the API Gateway on `getServerSideProps` calls. The requests can end in `.json`, which would cause them to be routed to S3 if this route is not created. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder createNextDataPathRoute(final java.lang.Boolean createNextDataPathRoute) {
this.props.createNextDataPathRoute(createNextDataPathRoute);
return this;
}
/**
* (experimental) CloudFront Distribution domain name.
*
* Default: auto-assigned
*
* Example:
*
*
* apps.pwrdrvr.com
*
*
* @return {@code this}
* @param domainNameEdge CloudFront Distribution domain name. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder domainNameEdge(final java.lang.String domainNameEdge) {
this.props.domainNameEdge(domainNameEdge);
return this;
}
/**
* (experimental) API Gateway custom origin domain name.
*
* Default: - retrieved from httpApi, if possible
*
* Example:
*
*
* apps.pwrdrvr.com
*
*
* @return {@code this}
* @param domainNameOrigin API Gateway custom origin domain name. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder domainNameOrigin(final java.lang.String domainNameOrigin) {
this.props.domainNameOrigin(domainNameOrigin);
return this;
}
/**
* (experimental) Configuration of the edge to origin lambda functions.
*
* Default: - no edge to API Gateway origin functions added
*
* @return {@code this}
* @param edgeLambdas Configuration of the edge to origin lambda functions. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder edgeLambdas(final java.util.List extends software.amazon.awscdk.services.cloudfront.EdgeLambda> edgeLambdas) {
this.props.edgeLambdas(edgeLambdas);
return this;
}
/**
* (experimental) API Gateway v2 HTTP API for apps.
*
* @return {@code this}
* @param httpApi API Gateway v2 HTTP API for apps. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder httpApi(final software.amazon.awscdk.services.apigatewayv2.alpha.HttpApi httpApi) {
this.props.httpApi(httpApi);
return this;
}
/**
* (experimental) Optional Origin Shield Region.
*
* This should be the region where the DynamoDB is located so the
* EdgeToOrigin calls have the lowest latency (~1 ms).
*
* Default: - none
*
* @return {@code this}
* @param originShieldRegion Optional Origin Shield Region. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder originShieldRegion(final java.lang.String originShieldRegion) {
this.props.originShieldRegion(originShieldRegion);
return this;
}
/**
* (experimental) Route53 zone in which to create optional `domainNameEdge` record.
*
* @return {@code this}
* @param r53Zone Route53 zone in which to create optional `domainNameEdge` record. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder r53Zone(final software.amazon.awscdk.services.route53.IHostedZone r53Zone) {
this.props.r53Zone(r53Zone);
return this;
}
/**
* (experimental) RemovalPolicy override for child resources.
*
* Note: if set to DESTROY the S3 buckes will have autoDeleteObjects
set to true
*
* Default: - per resource default
*
* @return {@code this}
* @param removalPolicy RemovalPolicy override for child resources. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder removalPolicy(final software.amazon.awscdk.RemovalPolicy removalPolicy) {
this.props.removalPolicy(removalPolicy);
return this;
}
/**
* (experimental) Path prefix on the root of the CloudFront distribution.
*
* Example:
*
*
* dev/
*
*
* @return {@code this}
* @param rootPathPrefix Path prefix on the root of the CloudFront distribution. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder rootPathPrefix(final java.lang.String rootPathPrefix) {
this.props.rootPathPrefix(rootPathPrefix);
return this;
}
/**
* @returns a newly built instance of {@link com.pwrdrvr.microapps.cdk.MicroAppsCF}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public com.pwrdrvr.microapps.cdk.MicroAppsCF build() {
return new com.pwrdrvr.microapps.cdk.MicroAppsCF(
this.scope,
this.id,
this.props.build()
);
}
}
}