All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pwrdrvr.microapps.cdk.MicroApps Maven / Gradle / Ivy

package com.pwrdrvr.microapps.cdk;

/**
 * (experimental) Create a new MicroApps "turnkey" construct for simple deployments and for initial evaulation of the MicroApps framework.
 * 

* Use this construct to create a PoC working entire stack. *

* Do not use this construct when adding MicroApps to an existing * CloudFront, API Gateway, S3 Bucket, etc. or where access * to all features of the AWS Resources are needed (e.g. to * add additional Behaviors to the CloudFront distribution, set authorizors * on API Gateway, etc.). *

* @see {@link https://github.com/pwrdrvr/microapps-core/blob/main/packages/cdk/lib/MicroApps.ts | example usage in a CDK Stack } */ @javax.annotation.Generated(value = "jsii-pacmak/1.75.0 (build 63bb957)", date = "2023-06-14T17:32:47.040Z") @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.MicroApps") public class MicroApps extends software.constructs.Construct implements com.pwrdrvr.microapps.cdk.IMicroApps { protected MicroApps(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected MicroApps(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } /** * @param scope This parameter is required. * @param id This parameter is required. * @param props */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public MicroApps(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable com.pwrdrvr.microapps.cdk.MicroAppsProps 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"), props }); } /** * @param scope This parameter is required. * @param id This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public MicroApps(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id) { 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") }); } /** * (experimental) {@inheritdoc IMicroAppsCF}. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull com.pwrdrvr.microapps.cdk.IMicroAppsCF getCf() { return software.amazon.jsii.Kernel.get(this, "cf", software.amazon.jsii.NativeType.forClass(com.pwrdrvr.microapps.cdk.IMicroAppsCF.class)); } /** * (experimental) {@inheritdoc IMicroAppsS3}. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull com.pwrdrvr.microapps.cdk.IMicroAppsS3 getS3() { return software.amazon.jsii.Kernel.get(this, "s3", software.amazon.jsii.NativeType.forClass(com.pwrdrvr.microapps.cdk.IMicroAppsS3.class)); } /** * (experimental) {@inheritdoc IMicroAppsSvcs}. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull com.pwrdrvr.microapps.cdk.IMicroAppsSvcs getSvcs() { return software.amazon.jsii.Kernel.get(this, "svcs", software.amazon.jsii.NativeType.forClass(com.pwrdrvr.microapps.cdk.IMicroAppsSvcs.class)); } /** * (experimental) {@inheritdoc IMicroAppsAPIGwy}. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.Nullable com.pwrdrvr.microapps.cdk.IMicroAppsAPIGwy getApigwy() { return software.amazon.jsii.Kernel.get(this, "apigwy", software.amazon.jsii.NativeType.forClass(com.pwrdrvr.microapps.cdk.IMicroAppsAPIGwy.class)); } /** * (experimental) {@inheritdoc IMicroAppsEdgeToOrigin}. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.Nullable com.pwrdrvr.microapps.cdk.IMicroAppsEdgeToOrigin getEdgeToOrigin() { return software.amazon.jsii.Kernel.get(this, "edgeToOrigin", software.amazon.jsii.NativeType.forClass(com.pwrdrvr.microapps.cdk.IMicroAppsEdgeToOrigin.class)); } /** * (experimental) A fluent builder for {@link com.pwrdrvr.microapps.cdk.MicroApps}. */ @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 com.pwrdrvr.microapps.cdk.MicroAppsProps.Builder props; private Builder(final software.constructs.Construct scope, final java.lang.String id) { this.scope = scope; this.id = id; } /** * (experimental) Passed to NODE_ENV of Router and Deployer Lambda functions. *

* Default: dev *

* @return {@code this} * @param appEnv Passed to NODE_ENV of Router and Deployer Lambda functions. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder appEnv(final java.lang.String appEnv) { this.props().appEnv(appEnv); return this; } /** * (experimental) Adds an X-Forwarded-Host-Header when calling API Gateway. *

* Can only be trusted if signingMode is enabled, which restricts * access to API Gateway to only IAM signed requests. *

* Note: if true, creates OriginRequest Lambda @ Edge function for API Gateway Origin *

* Default: true *

* @return {@code this} * @param addXForwardedHostHeader Adds an X-Forwarded-Host-Header when calling API Gateway. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder addXForwardedHostHeader(final java.lang.Boolean addXForwardedHostHeader) { this.props().addXForwardedHostHeader(addXForwardedHostHeader); return this; } /** * (experimental) Account IDs allowed for cross-account Function URL invocations. *

* Default: [] *

* @return {@code this} * @param allowedFunctionUrlAccounts Account IDs allowed for cross-account Function URL invocations. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder allowedFunctionUrlAccounts(final java.util.List allowedFunctionUrlAccounts) { this.props().allowedFunctionUrlAccounts(allowedFunctionUrlAccounts); return this; } /** * (experimental) List of allowed locale prefixes for pages. *

* Default: none *

* Example: *

*

         * : ['en', 'fr', 'es']
         * 
*

* @return {@code this} * @param allowedLocalePrefixes List of allowed locale prefixes for pages. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder allowedLocalePrefixes(final java.util.List allowedLocalePrefixes) { this.props().allowedLocalePrefixes(allowedLocalePrefixes); 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) Certificate in US-East-1 for the CloudFront distribution. *

* @return {@code this} * @param certEdge Certificate in US-East-1 for the CloudFront distribution. 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) Certificate in deployed region for the API Gateway. *

* @return {@code this} * @param certOrigin Certificate in deployed region for the API Gateway. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder certOrigin(final software.amazon.awscdk.services.certificatemanager.ICertificate certOrigin) { this.props().certOrigin(certOrigin); return this; } /** * (experimental) Create API Gateway for non-edge invocation. *

* Default: false *

* @return {@code this} * @param createApiGateway Create API Gateway for non-edge invocation. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder createApiGateway(final java.lang.Boolean createApiGateway) { this.props().createApiGateway(createApiGateway); 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 *

* @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 *

* @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) Optional custom domain name for the CloudFront distribution. *

* Default: auto-assigned *

* Example: *

*

         * apps.pwrdrvr.com
         * 
*

* @return {@code this} * @param domainNameEdge Optional custom domain name for the CloudFront distribution. 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) Optional custom domain name for the API Gateway HTTPv2 API. *

* Default: auto-assigned *

* Example: *

*

         * apps-origin.pwrdrvr.com
         * 
*

* @return {@code this} * @param domainNameOrigin Optional custom domain name for the API Gateway HTTPv2 API. 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) Additional edge lambda functions. *

* @return {@code this} * @param edgeLambdas Additional edge lambda functions. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder edgeLambdas(final java.util.List edgeLambdas) { this.props().edgeLambdas(edgeLambdas); return this; } /** * (experimental) Additional IAM Role ARNs that should be allowed to invoke apps in child accounts. *

* @return {@code this} * @param edgeToOriginRoleArNs Additional IAM Role ARNs that should be allowed to invoke apps in child accounts. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder edgeToOriginRoleArNs(final java.util.List edgeToOriginRoleArNs) { this.props().edgeToOriginRoleArNs(edgeToOriginRoleArNs); return this; } /** * (experimental) Origin region that API Gateway or Lambda function will be deployed to, used for the config.yml on the Edge function to sign requests for the correct region. *

* Default: undefined *

* @return {@code this} * @param originRegion Origin region that API Gateway or Lambda function will be deployed to, used for the config.yml on the Edge function to sign requests for the correct region. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder originRegion(final java.lang.String originRegion) { this.props().originRegion(originRegion); 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: originRegion if specified, otherwise undefined *

* @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) Replaces Host header (which will be the Edge domain name) with the Origin domain name when enabled. *

* This is necessary when API Gateway has not been configured * with a custom domain name that matches the exact domain name used by the CloudFront * Distribution AND when the OriginRequestPolicy.HeadersBehavior is set * to pass all headers to the origin. *

* Note: if true, creates OriginRequest Lambda @ Edge function for API Gateway Origin *

* Default: true *

* @return {@code this} * @param replaceHostHeader Replaces Host header (which will be the Edge domain name) with the Origin domain name when enabled. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder replaceHostHeader(final java.lang.Boolean replaceHostHeader) { this.props().replaceHostHeader(replaceHostHeader); 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; } /** * (experimental) Applies when using s3StrictBucketPolicy = true. *

* AROAs of the IAM Role to exclude from the DENY rules on the S3 Bucket Policy. * This allows sessions that assume the IAM Role to be excluded from the * DENY rules on the S3 Bucket Policy. *

* Typically any admin roles / users that need to view or manage the S3 Bucket * would be added to this list. *

* Roles / users that are used directly, not assumed, can be added to s3PolicyBypassRoleNames instead. *

* Note: This AROA must be specified to prevent this policy from locking * out non-root sessions that have assumed the admin role. *

* The notPrincipals will only match the role name exactly and will not match * any session that has assumed the role since notPrincipals does not allow * wildcard matches and does not do wildcard matches implicitly either. *

* The AROA must be used because there are only 3 Principal variables available: * https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable * aws:username, aws:userid, aws:PrincipalTag *

* For an assumed role, aws:username is blank, aws:userid is: * [unique id AKA AROA for Role]:[session name] *

* Table of unique ID prefixes such as AROA: * https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-prefixes *

* The name of the role is simply not available for an assumed role and, if it was, * a complicated comparison would be requierd to prevent exclusion * of applying the Deny Rule to roles from other accounts. *

* To get the AROA with the AWS CLI: * aws iam get-role --role-name ROLE-NAME * aws iam get-user --user-name USER-NAME *

* Example: *

*

         * [ 'AROA1234567890123' ]
         * 
*

* @return {@code this} * @see s3StrictBucketPolicy * @param s3PolicyBypassAroAs Applies when using s3StrictBucketPolicy = true. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder s3PolicyBypassAroAs(final java.util.List s3PolicyBypassAroAs) { this.props().s3PolicyBypassAroAs(s3PolicyBypassAroAs); return this; } /** * (experimental) Applies when using s3StrictBucketPolicy = true. *

* IAM Role or IAM User names to exclude from the DENY rules on the S3 Bucket Policy. *

* Roles that are Assumed must instead have their AROA added to s3PolicyBypassAROAs. *

* Typically any admin roles / users that need to view or manage the S3 Bucket * would be added to this list. *

* Example: *

*

         * ['arn:aws:iam::1234567890123:role/AdminAccess', 'arn:aws:iam::1234567890123:user/MyAdminUser']
         * 
*

* @return {@code this} * @see s3PolicyBypassAROAs * @param s3PolicyBypassPrincipalArNs Applies when using s3StrictBucketPolicy = true. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder s3PolicyBypassPrincipalArNs(final java.util.List s3PolicyBypassPrincipalArNs) { this.props().s3PolicyBypassPrincipalArNs(s3PolicyBypassPrincipalArNs); return this; } /** * (experimental) Use a strict S3 Bucket Policy that prevents applications from reading/writing/modifying/deleting files in the S3 Bucket outside of the path that is specific to their app/version. *

* This setting should be used when applications are less than * fully trusted. *

* Default: false *

* @return {@code this} * @param s3StrictBucketPolicy Use a strict S3 Bucket Policy that prevents applications from reading/writing/modifying/deleting files in the S3 Bucket outside of the path that is specific to their app/version. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder s3StrictBucketPolicy(final java.lang.Boolean s3StrictBucketPolicy) { this.props().s3StrictBucketPolicy(s3StrictBucketPolicy); return this; } /** * (experimental) Requires IAM auth on the API Gateway origin if not set to 'none'. *

* 'sign' - Uses request headers for auth. * 'presign' - Uses query string for auth. *

* If enabled, *

* Note: if 'sign' or 'presign', creates OriginRequest Lambda @ Edge function for API Gateway Origin *

* Default: 'sign' *

* @return {@code this} * @param signingMode Requires IAM auth on the API Gateway origin if not set to 'none'. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder signingMode(final java.lang.String signingMode) { this.props().signingMode(signingMode); return this; } /** * (experimental) Existing table for apps/versions/rules. *

* Default: created by construct *

* @return {@code this} * @param table Existing table for apps/versions/rules. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder table(final software.amazon.awscdk.services.dynamodb.ITable table) { this.props().table(table); return this; } /** * (experimental) Pre-set table name for apps/versions/rules. *

* This is required when using v2 routing *

* @return {@code this} * @param tableNameForEdgeToOrigin Pre-set table name for apps/versions/rules. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder tableNameForEdgeToOrigin(final java.lang.String tableNameForEdgeToOrigin) { this.props().tableNameForEdgeToOrigin(tableNameForEdgeToOrigin); return this; } /** * @returns a newly built instance of {@link com.pwrdrvr.microapps.cdk.MicroApps}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public com.pwrdrvr.microapps.cdk.MicroApps build() { return new com.pwrdrvr.microapps.cdk.MicroApps( this.scope, this.id, this.props != null ? this.props.build() : null ); } private com.pwrdrvr.microapps.cdk.MicroAppsProps.Builder props() { if (this.props == null) { this.props = new com.pwrdrvr.microapps.cdk.MicroAppsProps.Builder(); } return this.props; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy