Skip to content

Commit

Permalink
Fixed lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Au <[email protected]>
  • Loading branch information
Joshua152 committed Dec 14, 2023
1 parent d6dd760 commit 19796f0
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ data class ExplainFilter(
val state: String? = null,
val actionType: String? = null,
val failed: Boolean? = null
) : Writeable {

) : ToXContentObject, Writeable {

@Throws(IOException::class)
constructor(sin: StreamInput) : this(
Expand All @@ -36,6 +35,19 @@ data class ExplainFilter(
failed = sin.readOptionalBoolean()
)

override fun toXContent(builder: XContentBuilder, params: ToXContent.Params): XContentBuilder {
builder.startObject()
builder.startObject(FILTER_FIELD)

if (policyID != null) builder.field(POLICY_ID_FIELD, policyID)
if (state != null) builder.field(STATE_FIELD, state)
if (actionType != null) builder.field(ACTION_FIELD, actionType)
if (failed != null) builder.field(FAILED_FIELD, failed)

builder.endObject()
return builder.endObject()
}

@Throws(IOException::class)
override fun writeTo(out: StreamOutput) {
out.writeOptionalString(policyID)
Expand Down

0 comments on commit 19796f0

Please sign in to comment.