From efffed288379556e45b492b6aeece0fc777e84e2 Mon Sep 17 00:00:00 2001 From: msvinaykumar Date: Tue, 19 Nov 2024 16:36:53 +0530 Subject: [PATCH] incorporated review comments Signed-off-by: msvinaykumar --- .../analyzer/serviceObjects/BulkInput.java | 19 +++++++++++++++++++ .../serviceObjects/BulkJobStatus.java | 8 ++++++++ .../analyzer/workerimpl/BulkJobManager.java | 6 +++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/autotune/analyzer/serviceObjects/BulkInput.java b/src/main/java/com/autotune/analyzer/serviceObjects/BulkInput.java index e5e31d40d..dd5934945 100644 --- a/src/main/java/com/autotune/analyzer/serviceObjects/BulkInput.java +++ b/src/main/java/com/autotune/analyzer/serviceObjects/BulkInput.java @@ -25,6 +25,7 @@ public class BulkInput { private FilterWrapper filter; private TimeRange time_range; private String datasource; + private Webhook webhook; // Getters and Setters @@ -136,4 +137,22 @@ public void setEnd(String end) { this.end = end; } } + + public static class Webhook{ + private String url; + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + } + + public Webhook getWebhook() { + return webhook; + } + + public void setWebhook(Webhook webhook) { + this.webhook = webhook; + } } diff --git a/src/main/java/com/autotune/analyzer/serviceObjects/BulkJobStatus.java b/src/main/java/com/autotune/analyzer/serviceObjects/BulkJobStatus.java index 0e760d885..7dae51bb6 100644 --- a/src/main/java/com/autotune/analyzer/serviceObjects/BulkJobStatus.java +++ b/src/main/java/com/autotune/analyzer/serviceObjects/BulkJobStatus.java @@ -197,6 +197,14 @@ public Recommendation getRecommendations() { public void setNotification(Notification notification) { this.notification = notification; } + + public Notification getNotification() { + return notification; + } + + public void setRecommendations(Recommendation recommendations) { + this.recommendations = recommendations; + } } public static class Recommendation { diff --git a/src/main/java/com/autotune/analyzer/workerimpl/BulkJobManager.java b/src/main/java/com/autotune/analyzer/workerimpl/BulkJobManager.java index d1fe844e7..8c3620b4c 100644 --- a/src/main/java/com/autotune/analyzer/workerimpl/BulkJobManager.java +++ b/src/main/java/com/autotune/analyzer/workerimpl/BulkJobManager.java @@ -252,7 +252,11 @@ public void setFinalJobStatus(String status,String notificationKey,BulkJobStatus if(null!=notification) jobData.setNotification(notificationKey,notification); GenericRestApiClient apiClient = new GenericRestApiClient(finalDatasource); - apiClient.setBaseURL(KruizeDeploymentInfo.webhook_url); + if(null != bulkInput.getWebhook() && null != bulkInput.getWebhook().getUrl()){ + apiClient.setBaseURL(bulkInput.getWebhook().getUrl()); + }else { + apiClient.setBaseURL(KruizeDeploymentInfo.webhook_url); + } GenericRestApiClient.HttpResponseWrapper responseCode; BulkJobStatus.Webhook webhook = new BulkJobStatus.Webhook(WebHookStatus.IN_PROGRESS); jobData.setWebhook(webhook);