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

Adds legacy chime, slack, custom webhook messages, request/response f #53

Merged
merged 9 commits into from
Aug 13, 2021

Conversation

dbbaughe
Copy link
Contributor

…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

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

lezzago
lezzago previously approved these changes Aug 11, 2021
Copy link
Contributor

@akbhatta akbhatta left a 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

@dbbaughe
Copy link
Contributor Author

@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.

@akbhatta
Copy link
Contributor

@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.

@dbbaughe
Copy link
Contributor Author

dbbaughe commented Aug 11, 2021

@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.

@akbhatta
Copy link
Contributor

@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.

@dbbaughe
Copy link
Contributor Author

@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?

*/
public class LegacyCustomWebhookMessage extends LegacyBaseMessage {

private final String message;
Copy link
Contributor

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) ?

@akbhatta
Copy link
Contributor

other comments mentioned in PR #45 can be punted to next PR when you are refactoring the code.

@dbbaughe dbbaughe merged commit 4b1c21c into opensearch-project:main Aug 13, 2021
@dbbaughe dbbaughe deleted the notif-ism branch August 13, 2021 00:47
akbhatta added a commit that referenced this pull request Aug 13, 2021
* 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]>
zelinh pushed a commit that referenced this pull request Aug 18, 2022
…#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]>
wuychn pushed a commit to ochprince/common-utils that referenced this pull request Mar 16, 2023
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants