Skip to content

Commit

Permalink
feat: added syslog support in notification channel
Browse files Browse the repository at this point in the history
  • Loading branch information
singhalprerana committed Oct 14, 2023
1 parent 73e3e05 commit 47c4d1d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ message NotificationChannelMutableData {
repeated WebhookChannelConfig webhook_channel_config = 3;
repeated AwsS3BucketChannelConfig s3_bucket_channel_config = 4;
repeated SplunkIntegrationChannelConfig splunk_integration_channel_config = 5;
repeated SyslogIntegrationChannelConfig syslog_integration_channel_config = 6;
}

message AwsS3BucketChannelConfig {
Expand Down Expand Up @@ -55,3 +56,7 @@ message WebhookHeader {
message SplunkIntegrationChannelConfig {
string splunk_integration_id = 1;
}

message SyslogIntegrationChannelConfig {
string syslog_server_integration_id = 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.hypertrace.notification.config.service.v1.GetNotificationChannelRequest;
import org.hypertrace.notification.config.service.v1.NotificationChannelMutableData;
import org.hypertrace.notification.config.service.v1.SplunkIntegrationChannelConfig;
import org.hypertrace.notification.config.service.v1.SyslogIntegrationChannelConfig;
import org.hypertrace.notification.config.service.v1.UpdateNotificationChannelRequest;
import org.hypertrace.notification.config.service.v1.WebhookChannelConfig;
import org.hypertrace.notification.config.service.v1.WebhookHeader;
Expand Down Expand Up @@ -112,14 +113,17 @@ private void validateNotificationChannelMutableData(NotificationChannelMutableDa
if (data.getEmailChannelConfigCount() == 0
&& data.getWebhookChannelConfigCount() == 0
&& data.getS3BucketChannelConfigCount() == 0
&& data.getSplunkIntegrationChannelConfigCount() == 0) {
&& data.getSplunkIntegrationChannelConfigCount() == 0
&& data.getSyslogIntegrationChannelConfigCount() == 0) {
throw Status.INVALID_ARGUMENT.withDescription("No config present").asRuntimeException();
}
data.getEmailChannelConfigList().forEach(this::validateEmailChannelConfig);
data.getWebhookChannelConfigList().forEach(this::validateWebhookChannelConfig);
data.getS3BucketChannelConfigList().forEach(this::validateS3BucketConfig);
data.getSplunkIntegrationChannelConfigList()
.forEach(this::validateSplunkIntegrationChannelConfig);
data.getSyslogIntegrationChannelConfigList()
.forEach(this::validateSyslogIntegrationChannelConfig);
}

public void validateGetAllNotificationChannelsRequest(
Expand Down Expand Up @@ -180,4 +184,11 @@ private void validateSplunkIntegrationChannelConfig(
splunkIntegrationChannelConfig,
SplunkIntegrationChannelConfig.SPLUNK_INTEGRATION_ID_FIELD_NUMBER);
}

private void validateSyslogIntegrationChannelConfig(
SyslogIntegrationChannelConfig syslogIntegrationChannelConfig) {
validateNonDefaultPresenceOrThrow(
syslogIntegrationChannelConfig,
SyslogIntegrationChannelConfig.SYSLOG_SERVER_INTEGRATION_ID_FIELD_NUMBER);
}
}

0 comments on commit 47c4d1d

Please sign in to comment.