diff --git a/src/main/kotlin/org/opensearch/commons/alerting/model/ClusterMetricsInput.kt b/src/main/kotlin/org/opensearch/commons/alerting/model/ClusterMetricsInput.kt index ec740bbd..7dd7a12e 100644 --- a/src/main/kotlin/org/opensearch/commons/alerting/model/ClusterMetricsInput.kt +++ b/src/main/kotlin/org/opensearch/commons/alerting/model/ClusterMetricsInput.kt @@ -26,17 +26,14 @@ data class ClusterMetricsInput( var path: String, var pathParams: String = "", var url: String, - var clustersAliases: List = listOf() + var clusters: List = listOf() ) : Input { val clusterMetricType: ClusterMetricType val constructedUri: URI // Verify parameters are valid during creation init { - logger.info("hurneyt ClusterMetricsInput::clustersAliases = $clustersAliases") - - // TODO hurneyt -// if (clustersAliases.isNullOrEmpty()) clustersAliases = listOf() + logger.info("hurneyt ClusterMetricsInput::clusters = $clusters") require(validateFields()) { "The uri.api_type field, uri.path field, or uri.uri field must be defined." @@ -88,7 +85,7 @@ data class ClusterMetricsInput( .field(PATH_FIELD, path) .field(PATH_PARAMS_FIELD, pathParams) .field(URL_FIELD, url) - .field(CLUSTER_ALIASES_FIELD, clustersAliases) + .field(CLUSTERS_FIELD, clusters) .endObject() .endObject() } @@ -102,7 +99,7 @@ data class ClusterMetricsInput( out.writeString(path) out.writeString(pathParams) out.writeString(url) - out.writeStringArray(clustersAliases.toTypedArray()) + out.writeStringArray(clusters.toTypedArray()) } companion object { @@ -115,7 +112,7 @@ data class ClusterMetricsInput( const val PATH_PARAMS_FIELD = "path_params" const val URL_FIELD = "url" const val URI_FIELD = "uri" - const val CLUSTER_ALIASES_FIELD = "cluster_aliases" + const val CLUSTERS_FIELD = "clusters" val XCONTENT_REGISTRY = NamedXContentRegistry.Entry(Input::class.java, ParseField(URI_FIELD), CheckedFunction { parseInner(it) }) @@ -128,7 +125,7 @@ data class ClusterMetricsInput( var path = "" var pathParams = "" var url = "" - val clustersAliases = mutableListOf() + val clusters = mutableListOf() XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, xcp.currentToken(), xcp) @@ -139,7 +136,7 @@ data class ClusterMetricsInput( PATH_FIELD -> path = xcp.text() PATH_PARAMS_FIELD -> pathParams = xcp.text() URL_FIELD -> url = xcp.text() - CLUSTER_ALIASES_FIELD -> { + CLUSTERS_FIELD -> { XContentParserUtils.ensureExpectedToken( XContentParser.Token.START_ARRAY, xcp.currentToken(), @@ -147,12 +144,12 @@ data class ClusterMetricsInput( ) while (xcp.nextToken() != XContentParser.Token.END_ARRAY) { logger.info("hurneyt ClusterMetricsInput::parseInner xcp.text() = ${xcp.text()}") - clustersAliases.add(xcp.text()) + clusters.add(xcp.text()) } } } } - return ClusterMetricsInput(path, pathParams, url, clustersAliases) + return ClusterMetricsInput(path, pathParams, url, clusters) } }