mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(eventbridge): require EventPattern or ScheduleExpression in PutRule (#5172)
AWS rejects a PutRule that has neither field with a ValidationException, "Parameter(s) EventPattern or ScheduleExpression must be specified." Floci accepted it and stored a rule that matched every event on its bus. Validate before the bus lookup, and give the existing tests that created such rules a pattern or schedule.
This commit is contained in:
1 parent
bb24ee09d1
commit
be668acefd
6 files changed
+47
-6
No files matched your search
@@ -313,6 +313,11 @@ public class EventBridgeService implements ResourceProvider {
|
||||
public Rule putRule(String name, String busName, String eventPattern,
|
||||
String scheduleExpression, RuleState state, String description,
|
||||
String roleArn, Map<String, String> tags, String region) {
|
||||
if ((eventPattern == null || eventPattern.isBlank())
|
||||
&& (scheduleExpression == null || scheduleExpression.isBlank())) {
|
||||
throw new AwsException("ValidationException",
|
||||
"Parameter(s) EventPattern or ScheduleExpression must be specified.", 400);
|
||||
}
|
||||
String effectiveBus = resolvedBusName(busName);
|
||||
ensureBusExists(effectiveBus, region);
|
||||
|
||||
|
||||
Reference in new issue
Block a user