Skip to content

Commit

Permalink
Update ktlint
Browse files Browse the repository at this point in the history
Signed-off-by: Annie Lee <[email protected]>
  • Loading branch information
Annie Lee committed Mar 10, 2022
1 parent 043fd22 commit 9f8305f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class GetFindingsSearchResponse : ActionResponse, ToXContentObject {
var findings: List<Finding>

constructor(
status: RestStatus,
totalFindings: Int?,
findings: List<Destination>
status: RestStatus,
totalFindings: Int?,
findings: List<Destination>
) : super() {
this.status = status
this.totalFindings = totalFindings
Expand Down Expand Up @@ -55,8 +55,8 @@ class GetFindingsSearchResponse : ActionResponse, ToXContentObject {
@Throws(IOException::class)
override fun toXContent(builder: XContentBuilder, params: ToXContent.Params): XContentBuilder {
builder.startObject()
.field("totalFindings", totalFindings)
.field("findings", findings)
.field("totalFindings", totalFindings)
.field("findings", findings)

return builder.endObject()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@

package org.opensearch.alerting.resthandler

import org.apache.logging.log4j.LogManager
import org.opensearch.alerting.action.GetFindingsSearchAction
import org.opensearch.alerting.action.GetFindingsSearchRequest
import org.opensearch.alerting.model.Table
import org.opensearch.alerting.util.context
import org.opensearch.client.node.NodeClient
import org.opensearch.rest.BaseRestHandler
import org.opensearch.rest.BaseRestHandler.RestChannelConsumer
import org.opensearch.rest.RestHandler.Route
import org.opensearch.rest.RestRequest
import org.opensearch.rest.action.RestActions
import org.opensearch.rest.action.RestToXContentListener
import org.opensearch.search.fetch.subphase.FetchSourceContext

/**
* This class consists of the REST handler to search findings .
*/
Expand All @@ -30,7 +44,7 @@ class RestGetFindingsSearchAction : BaseRestHandler() {
srcContext = FetchSourceContext.DO_NOT_FETCH_SOURCE
}

val sortString = request.param("sortString", "destination.name.keyword")
val sortString = request.param("sortString", "finding.name.keyword")
val sortOrder = request.param("sortOrder", "asc")
val missing: String? = request.param("missing")
val size = request.paramAsInt("size", 20)
Expand All @@ -54,7 +68,7 @@ class RestGetFindingsSearchAction : BaseRestHandler() {
)
return RestChannelConsumer {
channel ->
client.execute(RestGetFindingsSearchAction.INSTANCE, getFindingsSearchRequest, RestToXContentListener(channel))
client.execute(GetFindingsSearchAction.INSTANCE, getFindingsSearchRequest, RestToXContentListener(channel))
}
}
}

0 comments on commit 9f8305f

Please sign in to comment.