-
Notifications
You must be signed in to change notification settings - Fork 94
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
Adds legacy chime, slack, custom webhook messages, request/response f #53
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see same code in the PR as well. please refer other PR for my comments
@akbhatta As mentioned on previous PR, most of this code is ported over from alerting and the intention is to keep it the same, i.e. not converting it to Kotlin and not changing business logic. Reason being this is only for ISM, ISM was already using these classes as they were, no other plugin will be using these, and we want to ensure they work the same as they did previously. This PR is simply to bring them over, if we decide to refactor them we'll do it in a later PR. |
Even though the code might be just moving over, the environment it will be used will be completely different. I would recommend fixing the issues before merging. |
Can you clarify on this part -> "the environment it will be used will be completely different"? This keeps the usage in ISM the same w/ no code changes. The classes were originally written in Java so there should be no issues there. The only new part is the fact that the notification Kotlin project is utilizing them specifically in the one transport action for the pass through API. But, no matter what new code has to be written somewhere and since that is all new code to begin with it makes more sense to have it there rather than make changes in ISM for the backwards compatible support of old destinations. |
Even though ISM code is almost same (I believe it cannot be exact same), it will be transport call instead of internal java call. the same classes are used in notification plugin as well as you mentioned. If there are issues with the code previously uncovered, it might cause problem in notification plugin or in transport layer. You need not do any refactor (or convert to kotlin if you are not comfortable) however please address the issues in the code. |
@akbhatta Of the comments on old PR, username/password were removed, and the main other one I see is regarding the constructing of the URI from parts being done by caller. I can make that change, were there any others that you were concerned about? |
src/main/java/org/opensearch/commons/destination/message/LegacyBaseMessage.java
Show resolved
Hide resolved
src/main/java/org/opensearch/commons/destination/message/LegacyChimeMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/commons/destination/message/LegacyBaseMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/commons/destination/message/LegacyBaseMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/commons/destination/message/LegacyBaseMessage.java
Show resolved
Hide resolved
*/ | ||
public class LegacyCustomWebhookMessage extends LegacyBaseMessage { | ||
|
||
private final String message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make use of buildUri() and only save 1 object (uri or url) ?
src/main/java/org/opensearch/commons/destination/message/LegacyDestinationType.java
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/notifications/NotificationsPluginInterface.kt
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/notifications/action/LegacyPublishNotificationRequest.kt
Show resolved
Hide resolved
...main/kotlin/org/opensearch/commons/notifications/action/LegacyPublishNotificationResponse.kt
Outdated
Show resolved
Hide resolved
other comments mentioned in PR #45 can be punted to next PR when you are refactoring the code. |
…or publishing legacy notifications, and method for executing transport action Signed-off-by: Drew Baugher <[email protected]>
Signed-off-by: Drew Baugher <[email protected]>
Signed-off-by: Drew Baugher <[email protected]>
Signed-off-by: Drew Baugher <[email protected]>
Signed-off-by: Drew Baugher <[email protected]>
Signed-off-by: Drew Baugher <[email protected]>
Signed-off-by: Drew Baugher <[email protected]>
Signed-off-by: Drew Baugher <[email protected]>
…ss transport wire and only writes the full url instead of each individual part Signed-off-by: Drew Baugher <[email protected]>
* Added support for SesAccount (#54) Also updated Feature to be simple string for future plugin easy addition [Tests] Added unit tests for SesAccount Updated Unit tests for changes Signed-off-by: @akbhatta * Adds legacy chime, slack, custom webhook messages, request/response f (#53) * Adds legacy chime, slack, custom webhook messages, request/response for publishing legacy notifications, and method for executing transport action Signed-off-by: Drew Baugher <[email protected]> * Fixes import and removes username/password that is not used by ISM Signed-off-by: Drew Baugher <[email protected]> * Throws error for toXContent for legacy notification response Signed-off-by: Drew Baugher <[email protected]> * Renames legacy destination types to have legacy prefix Signed-off-by: Drew Baugher <[email protected]> * Obfuscates message to remove from logs in toString method Signed-off-by: Drew Baugher <[email protected]> * Makes destinationt type private and updates places to use getter Signed-off-by: Drew Baugher <[email protected]> * Inlines destination type Signed-off-by: Drew Baugher <[email protected]> * Makes base message content final Signed-off-by: Drew Baugher <[email protected]> * Requires url to be defined in LegacyCustomWebhookMessage for use across transport wire and only writes the full url instead of each individual part Signed-off-by: Drew Baugher <[email protected]> Co-authored-by: Drew Baugher <[email protected]>
…#53) * Adds legacy chime, slack, custom webhook messages, request/response for publishing legacy notifications, and method for executing transport action Signed-off-by: Drew Baugher <[email protected]> * Fixes import and removes username/password that is not used by ISM Signed-off-by: Drew Baugher <[email protected]> * Throws error for toXContent for legacy notification response Signed-off-by: Drew Baugher <[email protected]> * Renames legacy destination types to have legacy prefix Signed-off-by: Drew Baugher <[email protected]> * Obfuscates message to remove from logs in toString method Signed-off-by: Drew Baugher <[email protected]> * Makes destinationt type private and updates places to use getter Signed-off-by: Drew Baugher <[email protected]> * Inlines destination type Signed-off-by: Drew Baugher <[email protected]> * Makes base message content final Signed-off-by: Drew Baugher <[email protected]> * Requires url to be defined in LegacyCustomWebhookMessage for use across transport wire and only writes the full url instead of each individual part Signed-off-by: Drew Baugher <[email protected]> Signed-off-by: Zelin Hao <[email protected]>
…opensearch-project#53) * Adds legacy chime, slack, custom webhook messages, request/response for publishing legacy notifications, and method for executing transport action Signed-off-by: Drew Baugher <[email protected]> * Fixes import and removes username/password that is not used by ISM Signed-off-by: Drew Baugher <[email protected]> * Throws error for toXContent for legacy notification response Signed-off-by: Drew Baugher <[email protected]> * Renames legacy destination types to have legacy prefix Signed-off-by: Drew Baugher <[email protected]> * Obfuscates message to remove from logs in toString method Signed-off-by: Drew Baugher <[email protected]> * Makes destinationt type private and updates places to use getter Signed-off-by: Drew Baugher <[email protected]> * Inlines destination type Signed-off-by: Drew Baugher <[email protected]> * Makes base message content final Signed-off-by: Drew Baugher <[email protected]> * Requires url to be defined in LegacyCustomWebhookMessage for use across transport wire and only writes the full url instead of each individual part Signed-off-by: Drew Baugher <[email protected]>
…or publishing legacy notifications, and method for executing transport action
Signed-off-by: Drew Baugher [email protected]
Description
Adds required legacy messages, request/response classes, and methods for ISM to publish a notification through the notification plugin with the old embedded types without having to create a channel first.
opensearch-project/notifications#253
Issues Resolved
#44
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.