Skip to content

Commit

Permalink
fix: fix nitpicks
Browse files Browse the repository at this point in the history
Signed-off-by: vikhy-aws <[email protected]>
  • Loading branch information
vikhy-aws committed Feb 1, 2025
1 parent fb915f5 commit 1cb8cd9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class RestIndexMonitorAction : BaseRestHandler() {
if (request.method() == PUT && !isValidId(id)) {
throw IllegalArgumentException(
"Invalid monitor ID [$id]. " +
"Monitor ID should be alphanumeric string with +, /, _, or - characters only"
"Monitor ID should be alphanumeric string with +, /, _, or - characters only."
)
}

Expand All @@ -109,7 +109,7 @@ class RestIndexMonitorAction : BaseRestHandler() {
if (!isValidName(monitor.name)) {
throw IllegalArgumentException(
"Invalid monitor name [${monitor.name}]. " +
"Monitor Name should be alphanumeric (4-50 chars) starting with letter or underscore"
"Monitor Name should be alphanumeric (4-50 chars) starting with letter or underscore."
)
}

Expand All @@ -124,20 +124,20 @@ class RestIndexMonitorAction : BaseRestHandler() {
Monitor.MonitorType.QUERY_LEVEL_MONITOR -> {
triggers.forEach {
if (it !is QueryLevelTrigger) {
throw (IllegalArgumentException("Illegal trigger type, ${it.javaClass.name}, for query level monitor"))
throw (IllegalArgumentException("Illegal trigger type, ${it.javaClass.name}, for query level monitor."))
}
if (!isValidName(it.name)) {
throw IllegalArgumentException(
"Invalid trigger name [${it.name}]. " +
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore"
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore."
)
}
it.actions.forEach { action ->
val destinationId = action.destinationId
if (!isValidId(destinationId)) {
throw IllegalArgumentException(
"Invalid destination ID [$destinationId]. " +
"Destination ID should be alphanumeric string with +, /, _, or - characters only"
"Destination ID should be alphanumeric string with +, /, _, or - characters only."
)
}
}
Expand All @@ -147,20 +147,20 @@ class RestIndexMonitorAction : BaseRestHandler() {
Monitor.MonitorType.BUCKET_LEVEL_MONITOR -> {
triggers.forEach {
if (it !is BucketLevelTrigger) {
throw IllegalArgumentException("Illegal trigger type, ${it.javaClass.name}, for bucket level monitor")
throw IllegalArgumentException("Illegal trigger type, ${it.javaClass.name}, for bucket level monitor.")
}
if (!isValidName(it.name)) {
throw IllegalArgumentException(
"Invalid trigger name [${it.name}]. " +
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore"
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore."
)
}
it.actions.forEach { action ->
val destinationId = action.destinationId
if (!isValidId(destinationId)) {
throw IllegalArgumentException(
"Invalid destination ID [$destinationId]. " +
"Destination ID should be alphanumeric string with +, /, _, or - characters only"
"Destination ID should be alphanumeric string with +, /, _, or - characters only."
)
}
}
Expand All @@ -170,20 +170,20 @@ class RestIndexMonitorAction : BaseRestHandler() {
Monitor.MonitorType.CLUSTER_METRICS_MONITOR -> {
triggers.forEach {
if (it !is QueryLevelTrigger) {
throw IllegalArgumentException("Illegal trigger type, ${it.javaClass.name}, for cluster metrics monitor")
throw IllegalArgumentException("Illegal trigger type, ${it.javaClass.name}, for cluster metrics monitor.")
}
if (!isValidName(it.name)) {
throw IllegalArgumentException(
"Invalid trigger name [${it.name}]. " +
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore"
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore."
)
}
it.actions.forEach { action ->
val destinationId = action.destinationId
if (!isValidId(destinationId)) {
throw IllegalArgumentException(
"Invalid destination ID [$destinationId]. " +
"Destination ID should be alphanumeric string with +, /, _, or - characters only"
"Destination ID should be alphanumeric string with +, /, _, or - characters only."
)
}
}
Expand All @@ -194,20 +194,20 @@ class RestIndexMonitorAction : BaseRestHandler() {
validateDocLevelQueryName(monitor)
triggers.forEach {
if (it !is DocumentLevelTrigger) {
throw IllegalArgumentException("Illegal trigger type, ${it.javaClass.name}, for document level monitor")
throw IllegalArgumentException("Illegal trigger type, ${it.javaClass.name}, for document level monitor.")
}
if (!isValidName(it.name)) {
throw IllegalArgumentException(
"Invalid trigger name [${it.name}]. " +
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore"
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore."
)
}
it.actions.forEach { action ->
val destinationId = action.destinationId
if (!isValidId(destinationId)) {
throw IllegalArgumentException(
"Invalid destination ID [$destinationId]. " +
"Destination ID should be alphanumeric string with +, /, _, or - characters only"
"Destination ID should be alphanumeric string with +, /, _, or - characters only."
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,17 @@ class MonitorRestApiIT : AlertingRestTestCase() {
val expectedError = mapOf(
"error" to mapOf(
"reason" to "Invalid monitor name [$invalidName]. " +
"Monitor Name should be alphanumeric (4-50 chars) starting with letter or underscore",
"Monitor Name should be alphanumeric (4-50 chars) starting with letter or underscore.",
"caused_by" to mapOf(
"reason" to "java.lang.IllegalArgumentException: Invalid monitor name [$invalidName]. " +
"Monitor Name should be alphanumeric (4-50 chars) starting with letter or underscore",
"Monitor Name should be alphanumeric (4-50 chars) starting with letter or underscore.",
"type" to "exception"
),
"type" to "alerting_exception",
"root_cause" to listOf(
mapOf(
"reason" to "Invalid monitor name [$invalidName]. " +
"Monitor Name should be alphanumeric (4-50 chars) starting with letter or underscore",
"Monitor Name should be alphanumeric (4-50 chars) starting with letter or underscore.",
"type" to "alerting_exception",
)
)
Expand All @@ -304,17 +304,17 @@ class MonitorRestApiIT : AlertingRestTestCase() {
val expectedError = mapOf(
"error" to mapOf(
"reason" to "Invalid trigger name [$invalidName]. " +
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore",
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore.",
"caused_by" to mapOf(
"reason" to "java.lang.IllegalArgumentException: Invalid trigger name [$invalidName]. " +
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore",
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore.",
"type" to "exception"
),
"type" to "alerting_exception",
"root_cause" to listOf(
mapOf(
"reason" to "Invalid trigger name [$invalidName]. " +
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore",
"Trigger Name should be alphanumeric (4-50 chars) starting with letter or underscore.",
"type" to "alerting_exception",
)
)
Expand All @@ -335,17 +335,17 @@ class MonitorRestApiIT : AlertingRestTestCase() {
val expectedError = mapOf(
"error" to mapOf(
"reason" to "Invalid destination ID [$invalidId]. " +
"Destination ID should be alphanumeric string with +, /, _, or - characters only",
"Destination ID should be alphanumeric string with +, /, _, or - characters only.",
"caused_by" to mapOf(
"reason" to "java.lang.IllegalArgumentException: Invalid destination ID [$invalidId]. " +
"Destination ID should be alphanumeric string with +, /, _, or - characters only",
"Destination ID should be alphanumeric string with +, /, _, or - characters only.",
"type" to "exception"
),
"type" to "alerting_exception",
"root_cause" to listOf(
mapOf(
"reason" to "Invalid destination ID [$invalidId]. " +
"Destination ID should be alphanumeric string with +, /, _, or - characters only",
"Destination ID should be alphanumeric string with +, /, _, or - characters only.",
"type" to "alerting_exception",
)
)
Expand Down

0 comments on commit 1cb8cd9

Please sign in to comment.