Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
import org.hypertrace.notification.config.service.v1.AwsS3BucketChannelConfig;
import org.hypertrace.notification.config.service.v1.AwsS3BucketChannelConfig.WebIdentityAuthenticationCredential;
import org.hypertrace.notification.config.service.v1.CreateNotificationChannelRequest;
import org.hypertrace.notification.config.service.v1.CrowdStrikeIntegrationChannelConfig;
import org.hypertrace.notification.config.service.v1.DeleteNotificationChannelRequest;
import org.hypertrace.notification.config.service.v1.EmailChannelConfig;
import org.hypertrace.notification.config.service.v1.GetAllNotificationChannelsRequest;
import org.hypertrace.notification.config.service.v1.GetNotificationChannelRequest;
import org.hypertrace.notification.config.service.v1.HttpEventCollectorChannelConfig;
import org.hypertrace.notification.config.service.v1.NotificationChannel;
import org.hypertrace.notification.config.service.v1.NotificationChannelMutableData;
import org.hypertrace.notification.config.service.v1.SplunkIntegrationChannelConfig;
Expand Down Expand Up @@ -128,7 +130,8 @@ private void validateNotificationChannelMutableData(NotificationChannelMutableDa
&& data.getWebhookChannelConfigCount() == 0
&& data.getS3BucketChannelConfigCount() == 0
&& data.getSplunkIntegrationChannelConfigCount() == 0
&& data.getSyslogIntegrationChannelConfigCount() == 0) {
&& data.getSyslogIntegrationChannelConfigCount() == 0
&& data.getHttpEventCollectorChannelConfigCount() == 0) {
throw Status.INVALID_ARGUMENT.withDescription("No config present").asRuntimeException();
}
data.getEmailChannelConfigList().forEach(this::validateEmailChannelConfig);
Expand All @@ -138,6 +141,8 @@ private void validateNotificationChannelMutableData(NotificationChannelMutableDa
.forEach(this::validateSplunkIntegrationChannelConfig);
data.getSyslogIntegrationChannelConfigList()
.forEach(this::validateSyslogIntegrationChannelConfig);
data.getHttpEventCollectorChannelConfigList()
.forEach(this::validateHttpEventCollectorChannelConfig);
}

public void validateGetAllNotificationChannelsRequest(
Expand Down Expand Up @@ -199,6 +204,29 @@ private void validateSplunkIntegrationChannelConfig(
SplunkIntegrationChannelConfig.SPLUNK_INTEGRATION_ID_FIELD_NUMBER);
}

private void validateHttpEventCollectorChannelConfig(
HttpEventCollectorChannelConfig httpEventCollectorChannelConfig) {
switch (httpEventCollectorChannelConfig.getChannelTypeCase()) {
case CROWD_STRIKE_INTEGRATION_CHANNEL_CONFIG:
validateNonDefaultPresenceOrThrow(
httpEventCollectorChannelConfig.getCrowdStrikeIntegrationChannelConfig(),
CrowdStrikeIntegrationChannelConfig.CROWD_STRIKE_INTEGRATION_ID_FIELD_NUMBER);
break;
case SPLUNK_INTEGRATION_CHANNEL_CONFIG:
validateNonDefaultPresenceOrThrow(
httpEventCollectorChannelConfig.getSplunkIntegrationChannelConfig(),
SplunkIntegrationChannelConfig.SPLUNK_INTEGRATION_ID_FIELD_NUMBER);
break;
default:
throw Status.INVALID_ARGUMENT
.withDescription(
String.format(
"Invalid Channel Type for Http Event Collector: %s",
httpEventCollectorChannelConfig.getChannelTypeCase()))
.asRuntimeException();
}
}

private void validateSyslogIntegrationChannelConfig(
SyslogIntegrationChannelConfig syslogIntegrationChannelConfig) {
validateNonDefaultPresenceOrThrow(
Expand Down