Skip to content

Commit f9c089d

Browse files
dineshSajwanDinesh Sajwangithub-actions
authored
feat(construct): Updated field types and removed unused code (#29)
* Added summary construct and lambda functions for summary stepfunction * updated summary construct lambda functions * fixed summary lambda issues * summary construct fixes * summary construct fixes * removed unused nltk with bedrock client * chore: self mutation Signed-off-by: github-actions <[email protected]> * added review comments * removed unused merge api code and made fields stringly typedd * updated bedrock icon in draw.io and architecture diagram --------- Signed-off-by: github-actions <[email protected]> Co-authored-by: Dinesh Sajwan <[email protected]> Co-authored-by: github-actions <[email protected]>
1 parent 82af9ee commit f9c089d

File tree

4 files changed

+552
-39
lines changed

4 files changed

+552
-39
lines changed

docs/emerging_tech_cdk_constructs.drawio

Lines changed: 545 additions & 1 deletion
Large diffs are not rendered by default.

lambda/input_validation/src/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
aws-lambda-powertools
22
aws-xray-sdk
3-
fastjsonschema
43
typing-extensions
54
boto3
65
requests
221 KB
Loading

src/patterns/gen-ai/aws-summarization-appsync-stepfn/index.ts

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import * as sqs from 'aws-cdk-lib/aws-sqs';
2626
import * as sfn from 'aws-cdk-lib/aws-stepfunctions';
2727
import * as sfnTask from 'aws-cdk-lib/aws-stepfunctions-tasks';
2828
import { Construct } from 'constructs';
29-
import * as appsyncMergedApi from '../../../common/helpers/appsyncmergedapi-helper';
3029
import * as eventBridge from '../../../common/helpers/eventbridge-helper';
3130
import * as redisHelper from '../../../common/helpers/redis-helper';
3231
import * as s3BucketHelper from '../../../common/helpers/s3-bucket-helper';
@@ -190,21 +189,21 @@ export class SummarizationAppsyncStepfn extends Construct {
190189
/**
191190
* Returns an instance of events.IEventBus created by the construct
192191
*/
193-
public readonly eventBridgeBus: events.IEventBus | undefined;
192+
public readonly eventBridgeBus: events.IEventBus;
194193
/**
195194
* Returns an instance of appsync.CfnGraphQLApi for merge api created by the construct
196195
*/
197-
public readonly mergeApi: appsync.CfnGraphQLApi | undefined;
196+
public readonly mergeApi: appsync.CfnGraphQLApi;
198197

199198
/**
200199
* Returns an instance of appsync.CfnGraphQLApi for summary created by the construct
201200
*/
202-
public readonly summaryGraphqlApi: appsync.IGraphqlApi | undefined;
201+
public readonly summaryGraphqlApi: appsync.IGraphqlApi ;
203202

204203
/**
205204
* Returns an instance of redis cluster created by the construct
206205
*/
207-
public readonly redisCluster: elasticache.CfnCacheCluster | undefined;
206+
public readonly redisCluster: elasticache.CfnCacheCluster;
208207

209208
/**
210209
* Returns the instance of ec2.IVpc used by the construct
@@ -218,12 +217,12 @@ export class SummarizationAppsyncStepfn extends Construct {
218217
/**
219218
* Returns the instance of s3.IBucket used by the construct
220219
*/
221-
public readonly inputAssetBucket: s3.IBucket | undefined;
220+
public readonly inputAssetBucket: s3.IBucket;
222221

223222
/**
224223
* Returns the instance of s3.IBucket used by the construct
225224
*/
226-
public readonly processedAssetBucket: s3.IBucket | undefined;
225+
public readonly processedAssetBucket: s3.IBucket;
227226

228227
/**
229228
* Logging configuration for AppSync
@@ -330,7 +329,7 @@ export class SummarizationAppsyncStepfn extends Construct {
330329
});
331330
redisHelper.setInboundRules(redisSecurityGroup, this.securityGroup);
332331
} else {
333-
this.redisCluster= props?.existingRedisCulster;
332+
this.redisCluster= props?.existingRedisCulster!;
334333
}
335334

336335
const redisHost = this.redisCluster?.attrRedisEndpointAddress!;
@@ -344,16 +343,6 @@ export class SummarizationAppsyncStepfn extends Construct {
344343
eventBusProps: props.eventBusProps,
345344
});
346345

347-
348-
appsyncMergedApi.checkAppsyncMergedApiProps(props);
349-
350-
const appsyncServicePrincipleRoleName = 'appsync.amazonaws.com';
351-
352-
const mergeApiRole = new iam.Role(this, 'mergedapirole'+stage, {
353-
assumedBy: new iam.ServicePrincipal(appsyncServicePrincipleRoleName),
354-
});
355-
356-
357346
this.mergeApi = props.existingMergeApi;
358347

359348
const mergeApiId = this.mergeApi.attrApiId;
@@ -406,25 +395,6 @@ export class SummarizationAppsyncStepfn extends Construct {
406395
const updateGraphQlApiId = !mergeApiId ? summarizationGraphqlApi.apiId : mergeApiId;
407396

408397

409-
// associate source api with merge api
410-
const sourceApiAssociationConfigProperty:
411-
appsync.CfnSourceApiAssociation.SourceApiAssociationConfigProperty = {
412-
mergeType: 'AUTO_MERGE',
413-
};
414-
415-
const sourceApiAssociation = new appsync.CfnSourceApiAssociation(this,
416-
'sourceApiAssociations'+stage,
417-
{
418-
mergedApiIdentifier: mergeApiId,
419-
sourceApiAssociationConfig: sourceApiAssociationConfigProperty,
420-
sourceApiIdentifier: summarizationGraphqlApi.apiId,
421-
});
422-
423-
sourceApiAssociation.node.addDependency(summarizationGraphqlApi);
424-
425-
// update merge api role with access
426-
appsyncMergedApi.setMergedApiRole(mergeApiId, summarizationGraphqlApi.apiId, mergeApiRole);
427-
428398
// Lambda function to validate Input
429399
const inputValidatorLambda =
430400
new lambdaFunction.DockerImageFunction(this, 'inputValidatorLambda'+stage,

0 commit comments

Comments
 (0)