forked from opensearch-project/index-management
-
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.
Adds snapshot management notification implementation (opensearch-proj…
…ect#387) * Adds notification integration for snapshot management Signed-off-by: Clay Downs <[email protected]> * Changes based on PR comments Signed-off-by: Clay Downs <[email protected]>
- Loading branch information
Showing
26 changed files
with
450 additions
and
80 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
27 changes: 27 additions & 0 deletions
27
...main/kotlin/org/opensearch/indexmanagement/common/model/notification/NotificationUtils.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,27 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
@file:JvmName("NotificationUtils") | ||
package org.opensearch.indexmanagement.common.model.notification | ||
|
||
import org.opensearch.OpenSearchStatusException | ||
import org.opensearch.rest.RestStatus | ||
|
||
/** | ||
* all valid response status | ||
*/ | ||
private val VALID_RESPONSE_STATUS = setOf( | ||
RestStatus.OK.status, RestStatus.CREATED.status, RestStatus.ACCEPTED.status, | ||
RestStatus.NON_AUTHORITATIVE_INFORMATION.status, RestStatus.NO_CONTENT.status, | ||
RestStatus.RESET_CONTENT.status, RestStatus.PARTIAL_CONTENT.status, | ||
RestStatus.MULTI_STATUS.status | ||
) | ||
|
||
@Throws(OpenSearchStatusException::class) | ||
fun validateResponseStatus(restStatus: RestStatus, responseContent: String) { | ||
if (!VALID_RESPONSE_STATUS.contains(restStatus.status)) { | ||
throw OpenSearchStatusException("Failed: $responseContent", restStatus) | ||
} | ||
} |
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
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.