File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
main/kotlin/org/opensearch/commons/notifications/model
test/kotlin/org/opensearch/commons/notifications/model Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ data class Sns(val topicArn: String, val roleArn: String?) : BaseConfigData {
5858 private val log by logger(Sns ::class .java)
5959
6060 private val SNS_ARN_REGEX =
61- Pattern .compile(" ^arn:aws(-[^:]+)?:sns:([a-zA-Z0-9-]+):([0-9]{12}):([a-zA-Z0-9-_ ]+)$" )
61+ Pattern .compile(" ^arn:aws(-[^:]+)?:sns:([a-zA-Z0-9-]+):([0-9]{12}):([a-zA-Z_0-9+=,.@ \\ -_/ ]+)$" )
6262
6363 /* *
6464 * reader to create instance of class from writable.
Original file line number Diff line number Diff line change @@ -8,9 +8,11 @@ package org.opensearch.commons.notifications.model
88import com.fasterxml.jackson.core.JsonParseException
99import org.junit.jupiter.api.Assertions
1010import org.junit.jupiter.api.Assertions.assertThrows
11+ import org.junit.jupiter.api.Assertions.fail
1112import org.junit.jupiter.api.Test
1213import org.opensearch.commons.utils.createObjectFromJsonString
1314import org.opensearch.commons.utils.getJsonString
15+ import org.opensearch.commons.utils.logger
1416import org.opensearch.commons.utils.recreateObject
1517
1618internal class SnsTests {
@@ -49,6 +51,15 @@ internal class SnsTests {
4951 }
5052 }
5153
54+ @Test
55+ fun `test SNS correctly validates SNS FIFO topic ARN` () {
56+ try {
57+ Sns (" arn:aws:sns:ap-southeast-2:333654771707:sns-fifo-alerting.fifo" , " arn:aws:iam::012345678912:role/iam-test" )
58+ } catch (e: Exception ) {
59+ fail(" Expected fifo sns topic ARN to be validated successfully" , e)
60+ }
61+ }
62+
5263 @Test
5364 fun `SNS serialize and deserialize transport object should be equal` () {
5465 val sampleSns = Sns (" arn:aws:sns:us-east-1:012345678912:topic-test" , " arn:aws:iam::012345678912:role/iam-test" )
You can’t perform that action at this time.
0 commit comments