Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: forum ads api second #343

Merged
merged 2 commits into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions lib/constructs/common/lambda-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ export class ForumCommentFunctions extends Construct {

export class ThreadImageProcessFunctions extends Construct {
// readonly getFunction: lambda.Function;
readonly syncImageFunction: lambda.Function;
// readonly syncImageFunction: lambda.Function;
readonly resizeImageFunction: lambda.Function;
// readonly deleteFunction: lambda.Function;

Expand Down Expand Up @@ -877,19 +877,6 @@ export class ThreadImageProcessFunctions extends Construct {
},
);

this.syncImageFunction = new lambda_py.PythonFunction(this, 'sync-image', {
entry: 'src/lambda/sync-image',
description:
'post image to dyanamo db database when image inputed in s3 bucket',
functionName: 'sync-image',
logRetention: logs.RetentionDays.ONE_MONTH,
memorySize: 256,
role: DBSyncRole,
runtime: lambda.Runtime.PYTHON_3_9,
timeout: Duration.seconds(5),
environment: props.envVars,
});

this.resizeImageFunction = new lambda_py.PythonFunction(
this,
'resize-image',
Expand Down Expand Up @@ -944,13 +931,13 @@ export class AdsImageProcessFunctions extends Construct {

const DBReadRole: iam.LazyRole = new iam.LazyRole(
this,
'dynamo-s3-read-role',
'dynamodb-s3-lambda-ads-imgs-read',
{
assumedBy: new iam.ServicePrincipal(AwsServicePrincipal.LAMBDA),
description:
'Allow lambda function to perform read operation on dynamodb and s3',
path: `/service-role/${AwsServicePrincipal.LAMBDA}/`,
roleName: 'dynamodb-s3-lambda-read-ads-imgs', // Changed the new role name
roleName: 'dynamodb-s3-lambda-ads-imgs-read',
managedPolicies: [
iam.ManagedPolicy.fromManagedPolicyArn(
this,
Expand All @@ -973,13 +960,13 @@ export class AdsImageProcessFunctions extends Construct {

const DBSyncRole: iam.LazyRole = new iam.LazyRole(
this,
'dynamo-s3-ads-sync-role',
'dynamo-s3-ads-imgs-sync-role',
{
assumedBy: new iam.ServicePrincipal(AwsServicePrincipal.LAMBDA),
description:
'Allow lambda function to perform crud operation on dynamodb and s3',
path: `/service-role/${AwsServicePrincipal.LAMBDA}/`,
roleName: 'dynamodb-s3-ads-sync-role',
roleName: 'dynamodb-s3-ads-imgs-sync-role',
managedPolicies: [
iam.ManagedPolicy.fromManagedPolicyArn(
this,
Expand Down
Loading