forked from opensearch-project/opensearch-py-ml
-
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.
Signed-off-by: kalyanr <[email protected]>
- Loading branch information
Showing
2 changed files
with
33 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
# Any modifications Copyright OpenSearch Contributors. See | ||
# GitHub history for details. | ||
|
||
"""Module for validating Stats API parameters """ | ||
|
||
|
||
def validate_stats_input(node_id, stat_id, payload): | ||
if payload: | ||
if node_id or stat_id: | ||
raise ValueError( | ||
"Stats API does not accept node_id or stat_id with payload" | ||
) | ||
if payload is not None and not isinstance(payload, dict): | ||
raise ValueError("payload needs to be a dictionary or None") | ||
if node_id is not None and not isinstance(node_id, str): | ||
raise ValueError("node_id needs to be a string or None") | ||
if stat_id is not None and not isinstance(stat_id, str): | ||
raise ValueError("stat_id needs to be a string or None") |