From 3c4d4b28b526ff2dbf0dc7314f6b6c865b6ebf3f Mon Sep 17 00:00:00 2001 From: ruokun-niu Date: Tue, 7 Jan 2025 14:56:07 -0800 Subject: [PATCH] modified reaction provider --- cli/service/resources/default-reaction-providers.yaml | 6 ++++++ .../azure/eventgrid-reaction/Services/ChangeHandler.cs | 4 ---- .../eventgrid-reaction/Services/ControlSignalHandler.cs | 5 ----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cli/service/resources/default-reaction-providers.yaml b/cli/service/resources/default-reaction-providers.yaml index 2a0a688a..c238b5c0 100644 --- a/cli/service/resources/default-reaction-providers.yaml +++ b/cli/service/resources/default-reaction-providers.yaml @@ -72,6 +72,12 @@ spec: - "CloudEvents" - "EventGrid" default: "CloudEvents" + format: + type: string + enum: + - "packed" + - "unpacked" + default: "packed" required: - eventGridUri --- diff --git a/reactions/azure/eventgrid-reaction/Services/ChangeHandler.cs b/reactions/azure/eventgrid-reaction/Services/ChangeHandler.cs index ddf17093..04e3b5d7 100644 --- a/reactions/azure/eventgrid-reaction/Services/ChangeHandler.cs +++ b/reactions/azure/eventgrid-reaction/Services/ChangeHandler.cs @@ -42,10 +42,6 @@ public ChangeHandler(EventGridPublisherClient publisherClient,IConfiguration con _formatter = formatter; _logger = logger; _eventGridSchema = config.GetValue("eventGridSchema").ToLower(); - if (_eventGridSchema != "eventgrid" && _eventGridSchema != "cloudevents") - { - throw new ArgumentException("Invalid event grid schema. Supported schemas are 'EventGrid' and 'CloudEvents'."); - } } public async Task HandleChange(ChangeEvent evt, object? queryConfig) diff --git a/reactions/azure/eventgrid-reaction/Services/ControlSignalHandler.cs b/reactions/azure/eventgrid-reaction/Services/ControlSignalHandler.cs index 86dbd08b..065d2e71 100644 --- a/reactions/azure/eventgrid-reaction/Services/ControlSignalHandler.cs +++ b/reactions/azure/eventgrid-reaction/Services/ControlSignalHandler.cs @@ -39,11 +39,6 @@ public ControlSignalHandler(EventGridPublisherClient publisherClient, IConfigura _format = Enum.Parse(config.GetValue("format", "packed") ?? "packed", true); _logger = logger; _eventGridSchema = config.GetValue("eventGridSchema").ToLower(); - if (_eventGridSchema != "eventgrid" && _eventGridSchema != "cloudevents") - { - throw new ArgumentException("Invalid event grid schema. Supported schemas are 'EventGrid' and 'CloudEvents'."); - } - Console.WriteLine("schema: " + _eventGridSchema); } public async Task HandleControlSignal(ControlEvent evt, object? queryConfig)