feat(alerting): Plan 01 — outbound HTTP infra + admin-managed outbound connections #139

Merged
hsiegeln merged 22 commits from feat/alerting-01-outbound-infra into main 2026-04-20 08:57:41 +02:00
2 changed files with 16 additions and 1 deletions
Showing only changes of commit cacedd3f16 - Show all commits

View File

@@ -30,7 +30,7 @@ public record OutboundConnectionRequest(
defaultHeaders = defaultHeaders == null ? Map.of() : defaultHeaders;
tlsCaPemPaths = tlsCaPemPaths == null ? List.of() : tlsCaPemPaths;
allowedEnvironmentIds = allowedEnvironmentIds == null ? List.of() : allowedEnvironmentIds;
if (tlsTrustMode == TrustMode.TRUST_PATHS && tlsCaPemPaths.isEmpty()) {
if (tlsTrustMode != null && tlsTrustMode == TrustMode.TRUST_PATHS && tlsCaPemPaths.isEmpty()) {
throw new IllegalArgumentException("tlsCaPemPaths must not be empty when tlsTrustMode = TRUST_PATHS");
}
}

View File

@@ -176,4 +176,19 @@ class OutboundConnectionAdminControllerIT extends AbstractPostgresIT {
assertThat(body.path("tlsProtocol").asText()).isEqualTo("TLS");
assertThat(body.path("error").isNull()).isTrue();
}
@Test
void operatorCannotTest() throws Exception {
ResponseEntity<String> create = restTemplate.exchange(
"/api/v1/admin/outbound-connections", HttpMethod.POST,
new HttpEntity<>(CREATE_BODY, securityHelper.authHeaders(adminJwt)),
String.class);
String id = objectMapper.readTree(create.getBody()).path("id").asText();
ResponseEntity<String> test = restTemplate.exchange(
"/api/v1/admin/outbound-connections/" + id + "/test", HttpMethod.POST,
new HttpEntity<>(securityHelper.authHeaders(operatorJwt)),
String.class);
assertThat(test.getStatusCode()).isEqualTo(HttpStatus.FORBIDDEN);
}
}