Skip to content

Commit

Permalink
update to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
t-richard committed Apr 20, 2023
1 parent 2473083 commit 41e89d5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"description": "Lift",
"dependencies": {
"@aws-cdk/aws-apigatewayv2-alpha": "^2.21.1-alpha.0",
"@aws-cdk/aws-apigatewayv2-integrations-alpha": "^2.76.0-alpha.0",
"aws-cdk-lib": "^2.21.1",
"chalk": "^4.1.1",
"change-case": "^4.1.2",
Expand Down
33 changes: 20 additions & 13 deletions src/constructs/aws/Upload.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { BlockPublicAccess, Bucket, BucketEncryption, HttpMethods } from "@aws-cdk/aws-s3";
import type { Construct as CdkConstruct } from "@aws-cdk/core";
import { CfnOutput, Duration, Fn, Stack } from "@aws-cdk/core";
import { Code, Function as LambdaFunction, Runtime } from "@aws-cdk/aws-lambda";
import type { CfnBucket } from "aws-cdk-lib/aws-s3";
import { BlockPublicAccess, Bucket, BucketEncryption, HttpMethods } from "aws-cdk-lib/aws-s3";
import type { Construct as CdkConstruct } from "constructs";
import type { CfnResource } from "aws-cdk-lib/core";
import { CfnOutput, Duration, Fn, Stack } from "aws-cdk-lib/core";
import { Code, Function as LambdaFunction, Runtime } from "aws-cdk-lib/aws-lambda";
import type { FromSchema } from "json-schema-to-ts";
import type { AwsProvider } from "@lift/providers";
import { AwsConstruct } from "@lift/constructs/abstracts";
import type { IHttpApi } from "@aws-cdk/aws-apigatewayv2";
import { HttpApi, HttpMethod, HttpRoute, HttpRouteKey } from "@aws-cdk/aws-apigatewayv2";
import type { Resource } from "@aws-cdk/aws-apigateway";
import { LambdaIntegration, RestApi } from "@aws-cdk/aws-apigateway";
import { LambdaProxyIntegration } from "@aws-cdk/aws-apigatewayv2-integrations";
import { Role } from "@aws-cdk/aws-iam";
import type { IHttpApi } from "@aws-cdk/aws-apigatewayv2-alpha";
import { HttpApi, HttpMethod, HttpRoute, HttpRouteKey } from "@aws-cdk/aws-apigatewayv2-alpha";
import type { Resource } from "aws-cdk-lib/aws-apigateway";
import { LambdaIntegration, RestApi } from "aws-cdk-lib/aws-apigateway";
import { HttpLambdaIntegration } from "@aws-cdk/aws-apigatewayv2-integrations-alpha";
import { Role } from "aws-cdk-lib/aws-iam";
import { CfnDistribution } from "aws-cdk-lib/aws-cloudfront";
import { PolicyStatement } from "../../CloudFormation";

const UPLOAD_DEFINITION = {
Expand Down Expand Up @@ -95,9 +98,7 @@ export class Upload extends AwsConstruct {
httpApiId: Fn.ref(this.provider.naming.getHttpApiLogicalId()),
});

const lambdaProxyIntegration = new LambdaProxyIntegration({
handler: this.function,
});
const lambdaProxyIntegration = new HttpLambdaIntegration("LambdaProxyIntegration", this.function);

this.route = new HttpRoute(this, "Route", {
httpApi: this.httpApi,
Expand Down Expand Up @@ -184,4 +185,10 @@ exports.handler = async (event) => {
}
`;
}

extend(): Record<string, CfnResource> {
return {
bucket: this.bucket.node.defaultChild as CfnBucket,
};
}
}

0 comments on commit 41e89d5

Please sign in to comment.