10
10
import java .nio .file .Files ;
11
11
import java .nio .file .Path ;
12
12
import java .util .LinkedList ;
13
- import java .util .Map ;
14
13
import org .apache .logging .log4j .LogManager ;
15
14
import org .apache .logging .log4j .Logger ;
16
15
import org .jooq .exception .DataAccessException ;
@@ -29,6 +28,8 @@ public class CloudFormationCustomResource extends AbstractCustomResourceHandler
29
28
30
29
// Initialize the Log4j logger.
31
30
Logger log = LogManager .getLogger ();
31
+
32
+ private final static String RESOURCE_ID = "db_sql_initialize" ;
32
33
33
34
@ Override
34
35
protected Response create (CloudFormationCustomResourceEvent cfcre , Context cntxt ) {
@@ -66,7 +67,8 @@ protected Response create(CloudFormationCustomResourceEvent cfcre, Context cntxt
66
67
log .error ("Could Not Process SQL Files" , e );
67
68
}
68
69
return Response .builder ()
69
- .value (Map .of ("dboperations" , "success" ))
70
+ .reason ("SQL files applied to database" )
71
+ .physicalResourceId (RESOURCE_ID )
70
72
.build ();
71
73
}
72
74
@@ -79,7 +81,10 @@ protected Response create(CloudFormationCustomResourceEvent cfcre, Context cntxt
79
81
@ Override
80
82
protected Response update (CloudFormationCustomResourceEvent cfcre , Context cntxt ) {
81
83
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 ();
83
88
}
84
89
85
90
/**
@@ -91,7 +96,10 @@ protected Response update(CloudFormationCustomResourceEvent cfcre, Context cntxt
91
96
@ Override
92
97
protected Response delete (CloudFormationCustomResourceEvent cfcre , Context cntxt ) {
93
98
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 ();
95
103
}
96
104
97
105
}
0 commit comments