@@ -74,6 +74,15 @@ export class WebhookApiConstruct extends Construct {
7474 timeout,
7575 } ) ;
7676
77+ const githubDeleteArtifactsLambda = new NodejsFunction ( this , 'githubDeleteArtifactsLambda' , {
78+ entry : `${ HANDLERS_PATH } /github.ts` ,
79+ runtime,
80+ handler : 'MarkBuildArtifactsForDeletion' ,
81+ bundling,
82+ environment,
83+ timeout,
84+ } ) ;
85+
7786 const triggerLocalBuildLambda = new NodejsFunction ( this , 'triggerLocalBuildLambda' , {
7887 entry : `${ HANDLERS_PATH } /jobs.ts` ,
7988 runtime,
@@ -92,6 +101,15 @@ export class WebhookApiConstruct extends Construct {
92101 timeout,
93102 } ) ;
94103
104+ const snootyBuildCompleteLambda = new NodejsFunction ( this , 'snootyBuildCompleteLambda' , {
105+ entry : `${ HANDLERS_PATH } /jobs.ts` ,
106+ runtime,
107+ handler : 'SnootyBuildComplete' ,
108+ environment,
109+ bundling,
110+ timeout,
111+ } ) ;
112+
95113 // generic handler for the root endpoint
96114 const rootEndpointLambda = new Function ( this , 'RootEndpointLambda' , {
97115 code : Code . fromInline ( 'exports.default = (event) => { console.log("hello, world!!"); }' ) ,
@@ -113,6 +131,7 @@ export class WebhookApiConstruct extends Construct {
113131 const dochubEndpoint = webhookEndpoint . addResource ( 'dochub' ) ;
114132 const githubEndpoint = webhookEndpoint . addResource ( 'githubEndpoint' ) ;
115133 const localEndpoint = webhookEndpoint . addResource ( 'local' ) ;
134+ const snootyEndpoint = webhookEndpoint . addResource ( 'snooty' ) ;
116135
117136 const defaultCorsPreflightOptions : CorsOptions = {
118137 allowOrigins : Cors . ALL_ORIGINS ,
@@ -139,11 +158,21 @@ export class WebhookApiConstruct extends Construct {
139158 . addResource ( 'build' , { defaultCorsPreflightOptions } )
140159 . addMethod ( 'POST' , new LambdaIntegration ( githubTriggerLambda ) ) ;
141160
161+ githubEndpoint
162+ . addResource ( 'trigger' )
163+ . addResource ( 'delete' , { defaultCorsPreflightOptions } )
164+ . addMethod ( 'POST' , new LambdaIntegration ( githubDeleteArtifactsLambda ) ) ;
165+
142166 localEndpoint
143167 . addResource ( 'trigger' )
144168 . addResource ( 'build' , { defaultCorsPreflightOptions } )
145169 . addMethod ( 'POST' , new LambdaIntegration ( triggerLocalBuildLambda ) ) ;
146170
171+ snootyEndpoint
172+ . addResource ( 'trigger' )
173+ . addResource ( 'complete' , { defaultCorsPreflightOptions } )
174+ . addMethod ( 'POST' , new LambdaIntegration ( snootyBuildCompleteLambda ) ) ;
175+
147176 // grant permission for lambdas to enqueue messages to the jobs queue
148177 jobsQueue . grantSendMessages ( slackTriggerLambda ) ;
149178 jobsQueue . grantSendMessages ( githubTriggerLambda ) ;
0 commit comments