mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Migrates ToXContent classes (elastic/x-pack-elasticsearch#2024)
* Migrates ToXContent classes * review comments Original commit: elastic/x-pack-elasticsearch@74ce3755ab
This commit is contained in:
parent
ccf0b6f2ed
commit
a4dd177978
@ -11,7 +11,6 @@ import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.xpack.XPackBuild;
|
||||
@ -77,7 +76,7 @@ public class XPackInfoResponse extends ActionResponse {
|
||||
this.featureSetsInfo = in.readOptionalWriteable(FeatureSetsInfo::new);
|
||||
}
|
||||
|
||||
public static class LicenseInfo implements ToXContent, Writeable {
|
||||
public static class LicenseInfo implements ToXContentObject, Writeable {
|
||||
|
||||
private final String uid;
|
||||
private final String type;
|
||||
@ -225,7 +224,7 @@ public class XPackInfoResponse extends ActionResponse {
|
||||
}
|
||||
}
|
||||
|
||||
public static class FeatureSet implements ToXContent, Writeable {
|
||||
public static class FeatureSet implements ToXContentObject, Writeable {
|
||||
|
||||
private final String name;
|
||||
@Nullable private final String description;
|
||||
|
@ -11,7 +11,7 @@ import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentFragment;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
@ -22,7 +22,7 @@ import java.net.Proxy;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class HttpProxy implements ToXContent, Streamable {
|
||||
public class HttpProxy implements ToXContentFragment, Streamable {
|
||||
|
||||
public static final HttpProxy NO_PROXY = new HttpProxy(null, null);
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -20,7 +20,7 @@ import java.util.Objects;
|
||||
/**
|
||||
* Information about deprecated items
|
||||
*/
|
||||
public class DeprecationIssue implements Writeable, ToXContent {
|
||||
public class DeprecationIssue implements Writeable, ToXContentObject {
|
||||
|
||||
public enum Level implements Writeable {
|
||||
NONE,
|
||||
|
@ -29,7 +29,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
@ -148,7 +147,7 @@ public class GetDatafeedsStatsAction extends Action<GetDatafeedsStatsAction.Requ
|
||||
|
||||
public static class Response extends ActionResponse implements ToXContentObject {
|
||||
|
||||
public static class DatafeedStats implements ToXContent, Writeable {
|
||||
public static class DatafeedStats implements ToXContentObject, Writeable {
|
||||
|
||||
private final String datafeedId;
|
||||
private final DatafeedState datafeedState;
|
||||
|
@ -33,7 +33,6 @@ import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.AtomicArray;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
@ -175,7 +174,7 @@ public class GetJobsStatsAction extends Action<GetJobsStatsAction.Request, GetJo
|
||||
|
||||
public static class Response extends BaseTasksResponse implements ToXContentObject {
|
||||
|
||||
public static class JobStats implements ToXContent, Writeable {
|
||||
public static class JobStats implements ToXContentObject, Writeable {
|
||||
private final String jobId;
|
||||
private DataCounts dataCounts;
|
||||
@Nullable
|
||||
|
@ -14,7 +14,6 @@ import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||
import org.elasticsearch.common.xcontent.ObjectParser;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
||||
@ -342,7 +341,7 @@ public class JobUpdate implements Writeable, ToXContentObject {
|
||||
modelSnapshotId);
|
||||
}
|
||||
|
||||
public static class DetectorUpdate implements Writeable, ToXContent {
|
||||
public static class DetectorUpdate implements Writeable, ToXContentObject {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final ConstructingObjectParser<DetectorUpdate, Void> PARSER =
|
||||
new ConstructingObjectParser<>("detector_update", a -> new DetectorUpdate((int) a[0], (String) a[1],
|
||||
|
@ -12,7 +12,7 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
|
||||
@ -73,7 +73,7 @@ public class MonitoringBulkResponse extends ActionResponse {
|
||||
out.writeOptionalWriteable(error);
|
||||
}
|
||||
|
||||
public static class Error implements Writeable, ToXContent {
|
||||
public static class Error implements Writeable, ToXContentObject {
|
||||
|
||||
private final Throwable cause;
|
||||
private final RestStatus status;
|
||||
|
@ -15,10 +15,6 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -30,6 +26,11 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import static java.util.Collections.unmodifiableMap;
|
||||
|
||||
public class Email implements ToXContentObject {
|
||||
@ -491,7 +492,7 @@ public class Email implements ToXContentObject {
|
||||
}
|
||||
}
|
||||
|
||||
public static class AddressList implements Iterable<Address>, ToXContent {
|
||||
public static class AddressList implements Iterable<Address>, ToXContentObject {
|
||||
|
||||
public static final AddressList EMPTY = new AddressList(Collections.<Address>emptyList());
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.notification.email.attachment;
|
||||
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentFragment;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -14,7 +14,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
||||
public class EmailAttachments implements ToXContent {
|
||||
public class EmailAttachments implements ToXContentFragment {
|
||||
|
||||
public static final EmailAttachments EMPTY_ATTACHMENTS = new EmailAttachments(
|
||||
Collections.<EmailAttachmentParser.EmailAttachment>emptyList());
|
||||
|
@ -10,6 +10,7 @@ import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.common.text.TextTemplate;
|
||||
@ -20,7 +21,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class IncidentEventContext implements ToXContent {
|
||||
public class IncidentEventContext implements ToXContentObject {
|
||||
|
||||
enum Type {
|
||||
LINK, IMAGE
|
||||
|
@ -12,14 +12,14 @@ import org.elasticsearch.cluster.ClusterName;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentFragment;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class ClearRealmCacheResponse extends BaseNodesResponse<ClearRealmCacheResponse.Node> implements ToXContent {
|
||||
public class ClearRealmCacheResponse extends BaseNodesResponse<ClearRealmCacheResponse.Node> implements ToXContentFragment {
|
||||
|
||||
public ClearRealmCacheResponse() {
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import org.elasticsearch.cluster.ClusterName;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentFragment;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
|
||||
@ -22,7 +22,7 @@ import java.util.List;
|
||||
/**
|
||||
* The response object that will be returned when clearing the cache of native roles
|
||||
*/
|
||||
public class ClearRolesCacheResponse extends BaseNodesResponse<ClearRolesCacheResponse.Node> implements ToXContent {
|
||||
public class ClearRolesCacheResponse extends BaseNodesResponse<ClearRolesCacheResponse.Node> implements ToXContentFragment {
|
||||
|
||||
public ClearRolesCacheResponse() {
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.security.action.user;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -17,7 +17,7 @@ import java.io.IOException;
|
||||
* Response when deleting a native user. Returns a single boolean field for whether the user was
|
||||
* found (and deleted) or not found.
|
||||
*/
|
||||
public class DeleteUserResponse extends ActionResponse implements ToXContent {
|
||||
public class DeleteUserResponse extends ActionResponse implements ToXContentObject {
|
||||
|
||||
private boolean found;
|
||||
|
||||
|
@ -5,14 +5,6 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.security.authc.support.mapper.expressiondsl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.elasticsearch.common.Numbers;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
@ -21,6 +13,14 @@ import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.xpack.security.support.Automatons;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* An expression that evaluates to <code>true</code> if a field (map element) matches
|
||||
* the provided values. A <em>field</em> expression may have more than one provided value, in which
|
||||
|
@ -17,7 +17,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||
@ -473,7 +472,7 @@ public class RoleDescriptor implements ToXContentObject {
|
||||
* A class representing permissions for a group of indices mapped to
|
||||
* privileges, field permissions, and a query.
|
||||
*/
|
||||
public static class IndicesPrivileges implements ToXContent, Streamable {
|
||||
public static class IndicesPrivileges implements ToXContentObject, Streamable {
|
||||
|
||||
private static final IndicesPrivileges[] NONE = new IndicesPrivileges[0];
|
||||
|
||||
|
@ -187,7 +187,7 @@ public class ActionStatus implements ToXContentObject {
|
||||
return new ActionStatus(ackStatus, lastExecution, lastSuccessfulExecution, lastThrottle);
|
||||
}
|
||||
|
||||
public static class AckStatus implements ToXContent {
|
||||
public static class AckStatus implements ToXContentObject {
|
||||
|
||||
public enum State {
|
||||
AWAITS_SUCCESSFUL_EXECUTION((byte) 1),
|
||||
@ -291,7 +291,7 @@ public class ActionStatus implements ToXContentObject {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Execution implements ToXContent {
|
||||
public static class Execution implements ToXContentObject {
|
||||
|
||||
public static Execution successful(DateTime timestamp) {
|
||||
return new Execution(timestamp, true, null);
|
||||
|
@ -6,14 +6,14 @@
|
||||
package org.elasticsearch.xpack.watcher.transform;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentFragment;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.watch.Payload;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class ExecutableTransform<T extends Transform, R extends Transform.Result> implements ToXContent {
|
||||
public abstract class ExecutableTransform<T extends Transform, R extends Transform.Result> implements ToXContentFragment {
|
||||
|
||||
protected final T transform;
|
||||
protected final Logger logger;
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.watcher.trigger.schedule;
|
||||
|
||||
import org.elasticsearch.common.util.CollectionUtils;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayOfWeek;
|
||||
@ -357,7 +357,7 @@ public abstract class ScheduleTestCase extends ESTestCase {
|
||||
return randomBoolean() ? randomIntBetween(24, 40) : randomIntBetween(-60, -1);
|
||||
}
|
||||
|
||||
static class HourAndMinute implements ToXContent {
|
||||
static class HourAndMinute implements ToXContentObject {
|
||||
|
||||
int hour;
|
||||
int minute;
|
||||
|
Loading…
x
Reference in New Issue
Block a user