Skip to content

Commit

Permalink
fix lint errors (pulumi#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBoyle committed Feb 25, 2020
1 parent c877bbb commit 11d7bb9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions aws-ts-scheduled-function/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright 2016-2020, Pulumi Corporation. All rights reserved.

import * as aws from "@pulumi/aws";
import { ObjectIdentifier } from "aws-sdk/clients/s3";

Expand All @@ -7,7 +9,7 @@ const trashBucket = new aws.s3.Bucket("trash");

// A handler function that will list objects in the bucket and bulk delete them
const emptyTrash: aws.cloudwatch.EventRuleEventHandler = async (
event: aws.cloudwatch.EventRuleEvent
event: aws.cloudwatch.EventRuleEvent,
) => {
const s3Client = new aws.sdk.S3();
const bucket = trashBucket.id.get();
Expand All @@ -22,15 +24,14 @@ const emptyTrash: aws.cloudwatch.EventRuleEventHandler = async (
await s3Client
.deleteObjects({
Bucket: bucket,
Delete: { Objects: objects, Quiet: false }
Delete: { Objects: objects, Quiet: false },
})
.promise()
.catch(error => console.log(error));
console.log(
`Deleted ${Contents.length} item${
Contents.length === 1 ? "" : "s"
} from ${bucket}.`
);
Contents.length === 1 ? "" : "s"
} from ${bucket}.`);
};

// Schedule the function to run every Friday at 11:00pm UTC (6:00pm EST)
Expand All @@ -39,7 +40,7 @@ const emptyTrash: aws.cloudwatch.EventRuleEventHandler = async (
const emptyTrashSchedule: aws.cloudwatch.EventRuleEventSubscription = aws.cloudwatch.onSchedule(
"emptyTrash",
"cron(0 23 ? * FRI *)",
emptyTrash
emptyTrash,
);

// Export the name of the bucket
Expand Down

0 comments on commit 11d7bb9

Please sign in to comment.