This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
Add logged-on User details to the Monitor and Destination #255
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cffa376
Fix 1/ IllegalStateException warn messages, 2/ location header in des…
skkosuri-amzn 1ceb3a9
Merge branch 'master' of https://github.com/opendistro-for-elasticsea…
skkosuri-amzn ff14293
Add User details to Monitor and Destination
skkosuri-amzn 39411a0
refacted
skkosuri-amzn 58baa44
Merge branch 'master' of https://github.com/opendistro-for-elasticsea…
skkosuri-amzn c37ed20
Merged from master
skkosuri-amzn c8c476c
Increase schema version
skkosuri-amzn 8e1092f
Use ESRestTestCase.randomAlphaOfLength for random str
skkosuri-amzn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,9 @@ import com.amazon.opendistroforelasticsearch.alerting.model.ActionRunResult | |
import com.amazon.opendistroforelasticsearch.alerting.model.InputRunResults | ||
import com.amazon.opendistroforelasticsearch.alerting.model.MonitorRunResult | ||
import com.amazon.opendistroforelasticsearch.alerting.model.TriggerRunResult | ||
import com.amazon.opendistroforelasticsearch.alerting.model.User | ||
import com.amazon.opendistroforelasticsearch.alerting.core.model.User | ||
import com.amazon.opendistroforelasticsearch.alerting.model.action.Throttle | ||
import org.apache.commons.text.RandomStringGenerator | ||
import com.amazon.opendistroforelasticsearch.alerting.model.destination.email.EmailAccount | ||
import com.amazon.opendistroforelasticsearch.alerting.model.destination.email.EmailEntry | ||
import com.amazon.opendistroforelasticsearch.alerting.model.destination.email.EmailGroup | ||
|
@@ -220,13 +221,27 @@ fun Monitor.toJsonString(): String { | |
} | ||
|
||
fun randomUser(): User { | ||
return User("joe", listOf("ops", "backup"), listOf("all_access"), listOf("test_attr=test")) | ||
val ranStrGen = RandomStringGenerator.Builder().build() | ||
val randomUser = ranStrGen.generate(5) | ||
val bckEndRole1 = ranStrGen.generate(10) | ||
val bckEndRole2 = ranStrGen.generate(10) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are already provided helper methods for generating random values, e.g. |
||
return User(randomUser, listOf(bckEndRole1, bckEndRole2), listOf("all_access"), listOf("test_attr=test")) | ||
} | ||
|
||
fun randomUserEmpty(): User { | ||
return User("", listOf(), listOf(), listOf()) | ||
} | ||
|
||
fun EmailAccount.toJsonString(): String { | ||
val builder = XContentFactory.jsonBuilder() | ||
return this.toXContent(builder).string() | ||
} | ||
|
||
fun EmailGroup.toJsonString(): String { | ||
val builder = XContentFactory.jsonBuilder() | ||
return this.toXContent(builder).string() | ||
} | ||
|
||
/** | ||
* Wrapper for [RestClient.performRequest] which was deprecated in ES 6.5 and is used in tests. This provides | ||
* a single place to suppress deprecation warnings. This will probably need further work when the API is removed entirely | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is nice!