Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAMEL-21324 - Camel-AWS-Secret-Manager: for context reloading on secr… #15867

Merged
merged 1 commit into from
Oct 7, 2024
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 @@ -90,6 +90,8 @@ public class CloudTrailReloadTriggerTask extends ServiceSupport implements Camel

private static final String SECRETSMANAGER_UPDATE_EVENT = "PutSecretValue";

private static final String SECRETSMANAGER_UPDATE_SECRET_EVENT = "UpdateSecret";

private CamelContext camelContext;
private boolean reloadEnabled = true;
private String secrets;
Expand Down Expand Up @@ -286,7 +288,8 @@ public void run() {
LOG.debug("Found {} events", events.size());
for (Event event : events) {
if (event.eventSource().equalsIgnoreCase(SECRETSMANAGER_AMAZONAWS_COM)) {
if (event.eventName().equalsIgnoreCase(SECRETSMANAGER_UPDATE_EVENT)) {
if (event.eventName().equalsIgnoreCase(SECRETSMANAGER_UPDATE_EVENT)
|| event.eventName().equalsIgnoreCase(SECRETSMANAGER_UPDATE_SECRET_EVENT)) {
List<Resource> a = event.resources();
for (Resource res : a) {
String name = res.resourceName();
Expand Down Expand Up @@ -332,7 +335,9 @@ public void run() {
if (ObjectHelper.isNotEmpty(event.get("detail"))) {
JsonNode innerDetail = event.get("detail");
if (innerDetail.get("eventSource").asText().equalsIgnoreCase(SECRETSMANAGER_AMAZONAWS_COM)) {
if (innerDetail.get("eventName").asText().equalsIgnoreCase(SECRETSMANAGER_UPDATE_EVENT)) {
if (innerDetail.get("eventName").asText().equalsIgnoreCase(SECRETSMANAGER_UPDATE_EVENT)
|| innerDetail.get("eventName").asText()
.equalsIgnoreCase(SECRETSMANAGER_UPDATE_SECRET_EVENT)) {
String name = innerDetail.get("requestParameters").get("secretId").asText();
if (matchSecret(name)) {
updates.put(name, Instant.parse(innerDetail.get("eventTime").asText()));
Expand Down