Skip to content

Commit 2a4adce

Browse files
author
RJ Lohan
authored
Retains writeOnlyProperties through reinvocations (#284)
1 parent 3883c47 commit 2a4adce

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/java/software/amazon/cloudformation/LambdaWrapper.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ public void handleRequest(final InputStream inputStream, final OutputStream outp
186186
this.lambdaLogger = context.getLogger();
187187
ProgressEvent<ResourceT, CallbackT> handlerResponse = null;
188188
HandlerRequest<ResourceT, CallbackT> request = null;
189-
String bearerToken = null;
190189
scrubFiles();
191190
try {
192191
if (inputStream == null) {
@@ -374,7 +373,13 @@ private void writeResponse(final OutputStream outputStream, final ProgressEvent<
374373
ResourceT model = response.getResourceModel();
375374
if (model != null) {
376375
JSONObject modelObject = new JSONObject(this.serializer.serialize(model));
377-
ResourceTypeSchema.load(provideResourceSchemaJSONObject()).removeWriteOnlyProperties(modelObject);
376+
377+
// strip write only properties on final results, we will need the intact model
378+
// while provisioning
379+
if (response.getStatus() != OperationStatus.IN_PROGRESS) {
380+
ResourceTypeSchema.load(provideResourceSchemaJSONObject()).removeWriteOnlyProperties(modelObject);
381+
}
382+
378383
ResourceT sanitizedModel = this.serializer.deserializeStrict(modelObject.toString(), getModelTypeReference());
379384

380385
response.setResourceModel(sanitizedModel);

src/test/java/software/amazon/cloudformation/LambdaWrapperTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ public void invokeHandler_CompleteSynchronously_returnsSuccess(final String requ
330330

331331
@Test
332332
public void invokeHandler_DependenciesInitialised_CompleteSynchronously_returnsSuccess() throws IOException {
333-
final Action action = Action.CREATE;
334333
final WrapperOverride wrapper = new WrapperOverride();
335334
final TestModel model = new TestModel();
336335

0 commit comments

Comments
 (0)