Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
Update aws-sdk v2 to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-NCSU committed May 10, 2024
1 parent b800224 commit 80724b6
Show file tree
Hide file tree
Showing 4 changed files with 1,030 additions and 181 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"postversion": "cp package.json ./dist/package.json"
},
"dependencies": {
"aws-sdk": "^2.184.0",
"@aws-sdk/client-s3": "^3.574.0",
"dotenv": "^10.0.0",
"jira-client": "^7.1.0",
"lodash": "^4.17.21",
Expand Down
14 changes: 7 additions & 7 deletions src/actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { S3 } from 'aws-sdk';
import { GetObjectCommand, S3, S3Client } from '@aws-sdk/client-s3';
import {
Issue,
IssueFields,
Expand Down Expand Up @@ -144,25 +144,25 @@ function isValidCreateIssueActionProperties(
}

async function getStoredActionData(
s3Client: S3,
s3Client: S3Client,
actionDataS3Key: string,
): Promise<FullCreateIssueActionProperties> {
if (!jupiteroneEnv) {
throw new Error('Environment variable JUPITERONE_ENVIRONMENT must be set.');
}
const { Body: s3ObjectBody } = await s3Client
.getObject({
const { Body: s3ObjectBody } = await s3Client.send(
new GetObjectCommand({
Bucket: `${jupiteroneEnv}-${jiraActionsBucket}`,
Key: actionDataS3Key,
})
.promise();
}),
);

if (!s3ObjectBody) {
throw new Error('Could not fetch action data.');
}

const actionProperties = JSON.parse(
s3ObjectBody.toString('utf-8'),
await s3ObjectBody.transformToString('utf-8'),
) as unknown;
if (!isValidCreateIssueActionProperties(actionProperties)) {
throw new Error(
Expand Down
Loading

0 comments on commit 80724b6

Please sign in to comment.