Skip to content

Commit

Permalink
RHCLOUD-28235 Unify how org ID is passed to connectors (phase 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenneg committed Sep 25, 2023
1 parent 28aad98 commit b164fdb
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public class ServiceNowCloudEventDataExtractor extends CloudEventDataExtractor {
@Override
public void extract(Exchange exchange, JsonObject cloudEventData) throws Exception {

// TODO Rely on the org ID parsing from IncomingCloudEventProcessor?
exchange.setProperty(ORG_ID, cloudEventData.getString("org_id"));
exchange.setProperty(ACCOUNT_ID, cloudEventData.getString("account_id"));

JsonObject metadata = cloudEventData.getJsonObject(NOTIF_METADATA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public class SplunkCloudEventDataExtractor extends CloudEventDataExtractor {
@Override
public void extract(Exchange exchange, JsonObject cloudEventData) throws Exception {

// TODO Rely on the org ID parsing from IncomingCloudEventProcessor?
exchange.setProperty(ORG_ID, cloudEventData.getString("org_id"));
exchange.setProperty(ACCOUNT_ID, cloudEventData.getString("account_id"));

JsonObject metadata = cloudEventData.getJsonObject(NOTIF_METADATA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ public void extract(Exchange exchange, JsonObject cloudEventData) throws Malform
exchange.setProperty(BASIC_AUTH_PASSWORD, basicAuth.getString("password"));
}

if (cloudEventData.getJsonObject(PAYLOAD).containsKey("org_id")) {
exchange.setProperty(ORG_ID, cloudEventData.getJsonObject(PAYLOAD).getString("org_id"));
} else if (cloudEventData.getJsonObject(PAYLOAD).containsKey("redhatorgid")) {
exchange.setProperty(ORG_ID, cloudEventData.getJsonObject(PAYLOAD).getString("redhatorgid"));
}

exchange.getIn().setBody(cloudEventData.getJsonObject(PAYLOAD).encode());
exchange.getIn().setHeader(Exchange.HTTP_METHOD, HttpMethods.valueOf(endpointProperties.getString("method")));

Expand Down

0 comments on commit b164fdb

Please sign in to comment.