Skip to content

Commit 06676fe

Browse files
committed
updates:
1 parent 8bd79d0 commit 06676fe

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

.tools/test/stacks/config/resources.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,21 @@ interface ResourceConfig {
99
bucket_name: string;
1010
admin_acct: string;
1111
aws_region: string;
12+
s3_bucket_name_prefix: string;
1213
}
1314

1415
export function readResourceConfig(filePath: string): ResourceConfig {
1516
try {
1617
const fileContents = fs.readFileSync(filePath, "utf8");
1718
const data: ResourceConfig = parse(fileContents);
1819

20+
// Validate the required fields
1921
if (
2022
!data.topic_name ||
2123
!data.bucket_name ||
2224
!data.admin_acct ||
23-
!data.aws_region
25+
!data.aws_region ||
26+
!data.s3_bucket_name_prefix
2427
) {
2528
throw new Error(
2629
"Validation failed: Missing required AWS configuration fields.",

.tools/test/stacks/config/resources.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ topic_name: "aws-weathertop-admin-sns-fanout-topic"
22
bucket_name: "aws-weathertop-admin-log-bucket"
33
admin_acct: "808326389482"
44
aws_region: "us-east-1"
5+
s3_bucket_name_prefix: "sdk-example-code"

.tools/test/stacks/plugin/typescript/plugin_stack.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class PluginStack extends cdk.Stack {
3333

3434
const adminTopicName = resourceConfig["topic_name"];
3535
const adminBucketName = resourceConfig["bucket_name"];
36+
const exampleBucketName = resourceConfig["s3_bucket_name_prefix"];
3637
this.awsRegion = resourceConfig["aws_region"];
3738
this.adminAccountId = resourceConfig["admin_acct"];
3839
const snsTopic = this.initGetTopic(adminTopicName);
@@ -42,7 +43,7 @@ class PluginStack extends cdk.Stack {
4243
this.batchMemory = acctConfig[`${toolName}`]?.memory ?? "16384";
4344
this.batchVcpus = acctConfig[`${toolName}`]?.vcpus ?? "4";
4445
}
45-
const [jobDefinition, jobQueue] = this.initBatchFargate();
46+
const [jobDefinition, jobQueue] = this.initBatchFargate(exampleBucketName);
4647
const batchFunction = this.initBatchLambda(jobQueue, jobDefinition);
4748
this.initSqsLambdaIntegration(batchFunction, sqsQueue);
4849
if (acctConfig[`${toolName}`].status === "enabled") {
@@ -59,7 +60,7 @@ class PluginStack extends cdk.Stack {
5960
);
6061
}
6162

62-
private initBatchFargate(): [batch.CfnJobDefinition, batch.CfnJobQueue] {
63+
private initBatchFargate(exampleBucketName: string): [batch.CfnJobDefinition, batch.CfnJobQueue] {
6364
const batchExecutionRole = new iam.Role(
6465
this,
6566
`BatchExecutionRole-${toolName}`,
@@ -134,6 +135,12 @@ class PluginStack extends cdk.Stack {
134135
value: this.batchMemory,
135136
},
136137
],
138+
environment: [
139+
{
140+
name: "S3_BUCKET_NAME_PREFIX",
141+
value: exampleBucketName
142+
},
143+
],
137144
},
138145
platformCapabilities: ["FARGATE"],
139146
});
@@ -159,7 +166,7 @@ class PluginStack extends cdk.Stack {
159166

160167
private initBatchLambda(
161168
jobQueue: batch.CfnJobQueue,
162-
jobDefinition: batch.CfnJobDefinition,
169+
jobDefinition: batch.CfnJobDefinition
163170
): lambda.Function {
164171
const executionRole = new iam.Role(
165172
this,
@@ -188,7 +195,7 @@ class PluginStack extends cdk.Stack {
188195
environment: {
189196
JOB_QUEUE: jobQueue.ref,
190197
JOB_DEFINITION: jobDefinition.ref,
191-
JOB_NAME: `job-${toolName}`,
198+
JOB_NAME: `job-${toolName}`
192199
},
193200
role: executionRole,
194201
});

0 commit comments

Comments
 (0)