forked from opensearch-project/security
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndexDocumentIntoSystemIndexResponse.java
48 lines (39 loc) · 1.52 KB
/
IndexDocumentIntoSystemIndexResponse.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Copyright OpenSearch Contributors
* 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.
*
*/
package org.opensearch.security.systemindex.sampleplugin;
// CS-SUPPRESS-SINGLE: RegexpSingleline It is not possible to use phrase "cluster manager" instead of master here
import java.io.IOException;
import org.opensearch.action.support.master.AcknowledgedResponse;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.core.common.io.stream.StreamOutput;
import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.core.xcontent.ToXContentObject;
import org.opensearch.core.xcontent.XContentBuilder;
// CS-ENFORCE-SINGLE
public class IndexDocumentIntoSystemIndexResponse extends AcknowledgedResponse implements ToXContentObject {
private String plugin;
public IndexDocumentIntoSystemIndexResponse(boolean status, String plugin) {
super(status);
this.plugin = plugin;
}
public IndexDocumentIntoSystemIndexResponse(StreamInput in) throws IOException {
super(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeString(plugin);
}
@Override
public void addCustomFields(XContentBuilder builder, ToXContent.Params params) throws IOException {
super.addCustomFields(builder, params);
builder.field("plugin", plugin);
}
}