forked from opensearch-project/common-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved cluster-based regex to separate file.
Signed-off-by: AWSHurneyt <[email protected]>
- Loading branch information
1 parent
4636569
commit c913185
Showing
3 changed files
with
29 additions
and
17 deletions.
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
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/org/opensearch/commons/alerting/util/ValidationHelpers.kt
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.commons.alerting.util | ||
|
||
class ValidationHelpers { | ||
companion object { | ||
/** | ||
* This regex asserts that the string: | ||
* Starts with a lowercase letter, or digit | ||
* Contains a sequence of characters followed by an optional colon and another sequence of characters | ||
* The sequences of characters can include lowercase letters, uppercase letters, digits, underscores, or hyphens | ||
* The total length of the string can range from 1 to 255 characters | ||
*/ | ||
val CLUSTER_NAME_REGEX = Regex("^(?=.{1,255}$)[a-z0-9]([a-zA-Z0-9_-]*:?[a-zA-Z0-9_-]*)$") | ||
|
||
/** | ||
* This regex asserts that the string: | ||
* Starts with a lowercase letter, digit, or asterisk | ||
* Contains a sequence of characters followed by an optional colon and another sequence of characters | ||
* The sequences of characters can include lowercase letters, uppercase letters, digits, underscores, asterisks, or hyphens | ||
* The total length of the string can range from 1 to 255 characters | ||
*/ | ||
val CLUSTER_PATTERN_REGEX = Regex("^(?=.{1,255}$)[a-z0-9]([a-zA-Z0-9_-]*:?[a-zA-Z0-9_-]*)$") | ||
} | ||
} |