diff --git a/src/main/java/gyro/aws/wafv2/RuleGroupResource.java b/src/main/java/gyro/aws/wafv2/RuleGroupResource.java index a92686309..6011f2c18 100644 --- a/src/main/java/gyro/aws/wafv2/RuleGroupResource.java +++ b/src/main/java/gyro/aws/wafv2/RuleGroupResource.java @@ -473,7 +473,7 @@ protected void doCreate(GyroUI ui, State state) { .capacity(capacity) .visibilityConfig(getVisibilityConfig().toVisibilityConfig()) .rules(getRule().stream().map(RuleResource::toRule).collect(Collectors.toList())) - .customResponseBodies(getCustomResponseBody().stream() + .customResponseBodies(getCustomResponseBody().isEmpty() ? null : getCustomResponseBody().stream() .collect(Collectors.toMap(CustomResponseBodyResource::getName, CustomResponseBodyResource::toCustomResponseBody))) .build()); @@ -504,7 +504,7 @@ protected void doUpdate( .lockToken(lockToken(client)) .rules(getRule().stream().map(RuleResource::toRule).collect(Collectors.toList())) .visibilityConfig(getVisibilityConfig().toVisibilityConfig()) - .customResponseBodies(getCustomResponseBody().stream() + .customResponseBodies(getCustomResponseBody().isEmpty() ? null : getCustomResponseBody().stream() .collect(Collectors.toMap(CustomResponseBodyResource::getName, CustomResponseBodyResource::toCustomResponseBody)))); } diff --git a/src/main/java/gyro/aws/wafv2/WebAclResource.java b/src/main/java/gyro/aws/wafv2/WebAclResource.java index f1e43b855..de0c8d38f 100644 --- a/src/main/java/gyro/aws/wafv2/WebAclResource.java +++ b/src/main/java/gyro/aws/wafv2/WebAclResource.java @@ -379,7 +379,7 @@ public void doCreate(GyroUI ui, State state) { .defaultAction(toDefaultAction()) .rules(getRule().stream().map(RuleResource::toRule).collect(Collectors.toList())) .visibilityConfig(getVisibilityConfig().toVisibilityConfig()) - .customResponseBodies(getCustomResponseBody().stream() + .customResponseBodies(getCustomResponseBody().isEmpty() ? null : getCustomResponseBody().stream() .collect(Collectors.toMap(CustomResponseBodyResource::getName, CustomResponseBodyResource::toCustomResponseBody))) ); @@ -440,7 +440,7 @@ public void doUpdate( .defaultAction(toDefaultAction()) .rules(getRule().stream().map(RuleResource::toRule).collect(Collectors.toList())) .visibilityConfig(getVisibilityConfig().toVisibilityConfig()) - .customResponseBodies(getCustomResponseBody().stream() + .customResponseBodies(getCustomResponseBody().isEmpty() ? null : getCustomResponseBody().stream() .collect(Collectors.toMap(CustomResponseBodyResource::getName, CustomResponseBodyResource::toCustomResponseBody)))); }