1010import java .nio .file .Files ;
1111import java .nio .file .Path ;
1212import java .util .LinkedList ;
13- import java .util .Map ;
1413import org .apache .logging .log4j .LogManager ;
1514import org .apache .logging .log4j .Logger ;
1615import org .jooq .exception .DataAccessException ;
@@ -29,6 +28,8 @@ public class CloudFormationCustomResource extends AbstractCustomResourceHandler
2928
3029 // Initialize the Log4j logger.
3130 Logger log = LogManager .getLogger ();
31+
32+ private final static String RESOURCE_ID = "db_sql_initialize" ;
3233
3334 @ Override
3435 protected Response create (CloudFormationCustomResourceEvent cfcre , Context cntxt ) {
@@ -66,7 +67,8 @@ protected Response create(CloudFormationCustomResourceEvent cfcre, Context cntxt
6667 log .error ("Could Not Process SQL Files" , e );
6768 }
6869 return Response .builder ()
69- .value (Map .of ("dboperations" , "success" ))
70+ .reason ("SQL files applied to database" )
71+ .physicalResourceId (RESOURCE_ID )
7072 .build ();
7173 }
7274
@@ -79,7 +81,10 @@ protected Response create(CloudFormationCustomResourceEvent cfcre, Context cntxt
7981 @ Override
8082 protected Response update (CloudFormationCustomResourceEvent cfcre , Context cntxt ) {
8183 log .debug ("Received UPDATE Event from Cloudformation" , cfcre );
82- return null ;
84+ return Response .builder ()
85+ .physicalResourceId (RESOURCE_ID )
86+ .reason ("UPDATE event ignored" )
87+ .build ();
8388 }
8489
8590 /**
@@ -91,7 +96,10 @@ protected Response update(CloudFormationCustomResourceEvent cfcre, Context cntxt
9196 @ Override
9297 protected Response delete (CloudFormationCustomResourceEvent cfcre , Context cntxt ) {
9398 log .debug ("Received DELETE Event from Cloudformation" , cfcre );
94- return null ;
99+ return Response .builder ()
100+ .physicalResourceId (RESOURCE_ID )
101+ .reason ("DELETE event ignored" )
102+ .build ();
95103 }
96104
97105}
0 commit comments