diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java
index 7a6b3ae137029..0b7ad26e3f342 100644
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java
+++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java
@@ -260,7 +260,6 @@ public class RestHighLevelClient implements Closeable {
private final IngestClient ingestClient = new IngestClient(this);
private final SnapshotClient snapshotClient = new SnapshotClient(this);
private final TasksClient tasksClient = new TasksClient(this);
- private final TransformClient transformClient = new TransformClient(this);
/**
* Creates a {@link RestHighLevelClient} given the low level {@link RestClientBuilder} that allows to build the
@@ -351,20 +350,6 @@ public final TasksClient tasks() {
return tasksClient;
}
- /**
- * Provides methods for accessing the Elastic Licensed Data Frame APIs that
- * are shipped with the Elastic Stack distribution of Elasticsearch. All of
- * these APIs will 404 if run against the OSS distribution of Elasticsearch.
- *
- * See the
- * Transform APIs on elastic.co for more information.
- *
- * @return the client wrapper for making Data Frame API calls
- */
- public TransformClient transform() {
- return transformClient;
- }
-
/**
* Executes a bulk request using the Bulk API.
* See Bulk API on elastic.co
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/TransformClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/TransformClient.java
deleted file mode 100644
index 9b18fbc06af02..0000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/TransformClient.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.client;
-
-import org.elasticsearch.action.ActionListener;
-import org.elasticsearch.client.core.AcknowledgedResponse;
-import org.elasticsearch.client.transform.DeleteTransformRequest;
-import org.elasticsearch.client.transform.GetTransformRequest;
-import org.elasticsearch.client.transform.GetTransformResponse;
-import org.elasticsearch.client.transform.GetTransformStatsRequest;
-import org.elasticsearch.client.transform.GetTransformStatsResponse;
-import org.elasticsearch.client.transform.PreviewTransformRequest;
-import org.elasticsearch.client.transform.PreviewTransformResponse;
-import org.elasticsearch.client.transform.PutTransformRequest;
-import org.elasticsearch.client.transform.StartTransformRequest;
-import org.elasticsearch.client.transform.StartTransformResponse;
-import org.elasticsearch.client.transform.StopTransformRequest;
-import org.elasticsearch.client.transform.StopTransformResponse;
-import org.elasticsearch.client.transform.UpdateTransformRequest;
-import org.elasticsearch.client.transform.UpdateTransformResponse;
-
-import java.io.IOException;
-import java.util.Collections;
-
-public final class TransformClient {
-
- private final RestHighLevelClient restHighLevelClient;
-
- TransformClient(RestHighLevelClient restHighLevelClient) {
- this.restHighLevelClient = restHighLevelClient;
- }
-
- /**
- * Creates a new transform
- *
- * For additional info
- * see
- * Create transform documentation
- *
- * @param request The PutTransformRequest containing the
- * {@link org.elasticsearch.client.transform.transforms.TransformConfig}.
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return An AcknowledgedResponse object indicating request success
- * @throws IOException when there is a serialization issue sending the request or receiving the response
- */
- public AcknowledgedResponse putTransform(PutTransformRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request,
- TransformRequestConverters::putTransform,
- options,
- AcknowledgedResponse::fromXContent,
- Collections.emptySet());
- }
-
- /**
- * Creates a new transform asynchronously and notifies listener on completion
- *
- * For additional info
- * see
- * Create transform documentation
- * @param request The PutTransformRequest containing the
- * {@link org.elasticsearch.client.transform.transforms.TransformConfig}.
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @param listener Listener to be notified upon request completion
- * @return cancellable that may be used to cancel the request
- */
- public Cancellable putTransformAsync(PutTransformRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request,
- TransformRequestConverters::putTransform,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- Collections.emptySet());
- }
-
- /**
- * Updates an existing transform
- *
- * For additional info
- * see
- * Create transform documentation
- *
- * @param request The UpdateTransformRequest containing the
- * {@link org.elasticsearch.client.transform.transforms.TransformConfigUpdate}.
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return An UpdateTransformResponse object containing the updated configuration
- * @throws IOException when there is a serialization issue sending the request or receiving the response
- */
- public UpdateTransformResponse updateTransform(UpdateTransformRequest request,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request,
- TransformRequestConverters::updateTransform,
- options,
- UpdateTransformResponse::fromXContent,
- Collections.emptySet());
- }
-
- /**
- * Updates an existing transform asynchronously and notifies listener on completion
- *
- * For additional info
- * see
- * Create transform documentation
- * @param request The UpdateTransformRequest containing the
- * {@link org.elasticsearch.client.transform.transforms.TransformConfigUpdate}.
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @param listener Listener to be notified upon request completion
- * @return cancellable that may be used to cancel the request
- */
- public Cancellable updateTransformAsync(UpdateTransformRequest request,
- RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request,
- TransformRequestConverters::updateTransform,
- options,
- UpdateTransformResponse::fromXContent,
- listener,
- Collections.emptySet());
- }
-
- /**
- * Get the running statistics of a transform
- *
- * For additional info
- * see
- * Get transform stats documentation
- *
- * @param request Specifies which transforms to get the stats for
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return The transform stats
- * @throws IOException when there is a serialization issue sending the request or receiving the response
- */
- public GetTransformStatsResponse getTransformStats(GetTransformStatsRequest request, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request,
- TransformRequestConverters::getTransformStats,
- options,
- GetTransformStatsResponse::fromXContent,
- Collections.emptySet());
- }
-
- /**
- * Get the running statistics of a transform asynchronously and notifies listener on completion
- *
- * For additional info
- * see
- * Get transform stats documentation
- * @param request Specifies which transforms to get the stats for
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @param listener Listener to be notified upon request completion
- * @return cancellable that may be used to cancel the request
- */
- public Cancellable getTransformStatsAsync(GetTransformStatsRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request,
- TransformRequestConverters::getTransformStats,
- options,
- GetTransformStatsResponse::fromXContent,
- listener,
- Collections.emptySet());
- }
-
- /**
- * Delete a transform
- *
- * For additional info
- * see
- * Delete transform documentation
- *
- * @param request The delete transform request
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return An AcknowledgedResponse object indicating request success
- * @throws IOException when there is a serialization issue sending the request or receiving the response
- */
- public AcknowledgedResponse deleteTransform(DeleteTransformRequest request, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request,
- TransformRequestConverters::deleteTransform,
- options,
- AcknowledgedResponse::fromXContent,
- Collections.emptySet());
- }
-
- /**
- * Delete a transform asynchronously and notifies listener on completion
- *
- * For additional info
- * see
- * Delete transform documentation
- * @param request The delete transform request
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @param listener Listener to be notified upon request completion
- * @return cancellable that may be used to cancel the request
- */
- public Cancellable deleteTransformAsync(DeleteTransformRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request,
- TransformRequestConverters::deleteTransform,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- Collections.emptySet());
- }
-
- /**
- * Preview the result of a transform
- *
- * For additional info
- * see
- * Preview transform documentation
- *
- * @param request The preview transform request
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return A response containing the results of the applied transform
- * @throws IOException when there is a serialization issue sending the request or receiving the response
- */
- public PreviewTransformResponse previewTransform(PreviewTransformRequest request, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request,
- TransformRequestConverters::previewTransform,
- options,
- PreviewTransformResponse::fromXContent,
- Collections.emptySet());
- }
-
- /**
- * Preview the result of a transform asynchronously and notifies listener on completion
- *
- * see
- * Preview transform documentation
- * @param request The preview transform request
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @param listener Listener to be notified upon request completion
- * @return cancellable that may be used to cancel the request
- */
- public Cancellable previewTransformAsync(PreviewTransformRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request,
- TransformRequestConverters::previewTransform,
- options,
- PreviewTransformResponse::fromXContent,
- listener,
- Collections.emptySet());
- }
-
- /**
- * Start a transform
- *
- * For additional info
- * see
- * Start transform documentation
- *
- * @param request The start transform request
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return A response object indicating request success
- * @throws IOException when there is a serialization issue sending the request or receiving the response
- */
- public StartTransformResponse startTransform(StartTransformRequest request, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request,
- TransformRequestConverters::startTransform,
- options,
- StartTransformResponse::fromXContent,
- Collections.emptySet());
- }
-
- /**
- * Start a transform asynchronously and notifies listener on completion
- *
- * For additional info
- * see
- * Start transform documentation
- * @param request The start transform request
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @param listener Listener to be notified upon request completion
- * @return cancellable that may be used to cancel the request
- */
- public Cancellable startTransformAsync(StartTransformRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request,
- TransformRequestConverters::startTransform,
- options,
- StartTransformResponse::fromXContent,
- listener,
- Collections.emptySet());
- }
-
- /**
- * Stop a transform
- *
- * For additional info
- * see
- * Stop transform documentation
- *
- * @param request The stop transform request
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return A response object indicating request success
- * @throws IOException when there is a serialization issue sending the request or receiving the response
- */
- public StopTransformResponse stopTransform(StopTransformRequest request, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request,
- TransformRequestConverters::stopTransform,
- options,
- StopTransformResponse::fromXContent,
- Collections.emptySet());
- }
-
- /**
- * Stop a transform asynchronously and notifies listener on completion
- *
- * For additional info
- * see
- * Stop transform documentation
- * @param request The stop transform request
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @param listener Listener to be notified upon request completion
- * @return cancellable that may be used to cancel the request
- */
- public Cancellable stopTransformAsync(StopTransformRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request,
- TransformRequestConverters::stopTransform,
- options,
- StopTransformResponse::fromXContent,
- listener,
- Collections.emptySet());
- }
-
- /**
- * Get one or more transform configurations
- *
- * For additional info
- * see
- * Get transform documentation
- *
- * @param request The get transform request
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return An GetTransformResponse containing the requested transforms
- * @throws IOException when there is a serialization issue sending the request or receiving the response
- */
- public GetTransformResponse getTransform(GetTransformRequest request, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request,
- TransformRequestConverters::getTransform,
- options,
- GetTransformResponse::fromXContent,
- Collections.emptySet());
- }
-
- /**
- * Get one or more transform configurations asynchronously and notifies listener on completion
- *
- * For additional info
- * see
- * Get data transform documentation
- * @param request The get transform request
- * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @param listener Listener to be notified upon request completion
- * @return cancellable that may be used to cancel the request
- */
- public Cancellable getTransformAsync(GetTransformRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request,
- TransformRequestConverters::getTransform,
- options,
- GetTransformResponse::fromXContent,
- listener,
- Collections.emptySet());
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/TransformRequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/TransformRequestConverters.java
deleted file mode 100644
index 4815353936b28..0000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/TransformRequestConverters.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.client;
-
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpPut;
-import org.elasticsearch.client.core.PageParams;
-import org.elasticsearch.client.transform.DeleteTransformRequest;
-import org.elasticsearch.client.transform.GetTransformRequest;
-import org.elasticsearch.client.transform.GetTransformStatsRequest;
-import org.elasticsearch.client.transform.PreviewTransformRequest;
-import org.elasticsearch.client.transform.PutTransformRequest;
-import org.elasticsearch.client.transform.StartTransformRequest;
-import org.elasticsearch.client.transform.StopTransformRequest;
-import org.elasticsearch.client.transform.UpdateTransformRequest;
-import org.elasticsearch.common.Strings;
-
-import java.io.IOException;
-
-import static org.elasticsearch.client.RequestConverters.REQUEST_BODY_CONTENT_TYPE;
-import static org.elasticsearch.client.RequestConverters.createEntity;
-import static org.elasticsearch.client.transform.DeleteTransformRequest.FORCE;
-import static org.elasticsearch.client.transform.GetTransformRequest.ALLOW_NO_MATCH;
-import static org.elasticsearch.client.transform.PutTransformRequest.DEFER_VALIDATION;
-import static org.elasticsearch.client.transform.StopTransformRequest.WAIT_FOR_CHECKPOINT;
-
-final class TransformRequestConverters {
-
- private TransformRequestConverters() {}
-
- static Request putTransform(PutTransformRequest putRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_transform")
- .addPathPart(putRequest.getConfig().getId())
- .build();
- Request request = new Request(HttpPut.METHOD_NAME, endpoint);
- request.setEntity(createEntity(putRequest, REQUEST_BODY_CONTENT_TYPE));
- if (putRequest.getDeferValidation() != null) {
- request.addParameter(DEFER_VALIDATION, Boolean.toString(putRequest.getDeferValidation()));
- }
- return request;
- }
-
- static Request updateTransform(UpdateTransformRequest updateDataFrameTransformRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_transform")
- .addPathPart(updateDataFrameTransformRequest.getId())
- .addPathPart("_update")
- .build();
- Request request = new Request(HttpPost.METHOD_NAME, endpoint);
- request.setEntity(createEntity(updateDataFrameTransformRequest, REQUEST_BODY_CONTENT_TYPE));
- if (updateDataFrameTransformRequest.getDeferValidation() != null) {
- request.addParameter(DEFER_VALIDATION, Boolean.toString(updateDataFrameTransformRequest.getDeferValidation()));
- }
- return request;
- }
-
- static Request getTransform(GetTransformRequest getRequest) {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_transform")
- .addPathPart(Strings.collectionToCommaDelimitedString(getRequest.getId()))
- .build();
- Request request = new Request(HttpGet.METHOD_NAME, endpoint);
- if (getRequest.getPageParams() != null && getRequest.getPageParams().getFrom() != null) {
- request.addParameter(PageParams.FROM.getPreferredName(), getRequest.getPageParams().getFrom().toString());
- }
- if (getRequest.getPageParams() != null && getRequest.getPageParams().getSize() != null) {
- request.addParameter(PageParams.SIZE.getPreferredName(), getRequest.getPageParams().getSize().toString());
- }
- if (getRequest.getAllowNoMatch() != null) {
- request.addParameter(ALLOW_NO_MATCH, getRequest.getAllowNoMatch().toString());
- }
- return request;
- }
-
- static Request deleteTransform(DeleteTransformRequest deleteRequest) {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_transform")
- .addPathPart(deleteRequest.getId())
- .build();
- Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
- if (deleteRequest.getForce() != null) {
- request.addParameter(FORCE, Boolean.toString(deleteRequest.getForce()));
- }
- return request;
- }
-
- static Request startTransform(StartTransformRequest startRequest) {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_transform")
- .addPathPart(startRequest.getId())
- .addPathPartAsIs("_start")
- .build();
- Request request = new Request(HttpPost.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- if (startRequest.getTimeout() != null) {
- params.withTimeout(startRequest.getTimeout());
- }
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request stopTransform(StopTransformRequest stopRequest) {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_transform")
- .addPathPart(stopRequest.getId())
- .addPathPartAsIs("_stop")
- .build();
- Request request = new Request(HttpPost.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- if (stopRequest.getWaitForCompletion() != null) {
- params.withWaitForCompletion(stopRequest.getWaitForCompletion());
- }
- if (stopRequest.getTimeout() != null) {
- params.withTimeout(stopRequest.getTimeout());
- }
- if (stopRequest.getAllowNoMatch() != null) {
- request.addParameter(ALLOW_NO_MATCH, stopRequest.getAllowNoMatch().toString());
- }
- if (stopRequest.getWaitForCheckpoint() != null) {
- request.addParameter(WAIT_FOR_CHECKPOINT, stopRequest.getWaitForCheckpoint().toString());
- }
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request previewTransform(PreviewTransformRequest previewRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_transform", "_preview")
- .build();
- Request request = new Request(HttpPost.METHOD_NAME, endpoint);
- request.setEntity(createEntity(previewRequest, REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request getTransformStats(GetTransformStatsRequest statsRequest) {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_transform")
- .addPathPart(statsRequest.getId())
- .addPathPartAsIs("_stats")
- .build();
- Request request = new Request(HttpGet.METHOD_NAME, endpoint);
- if (statsRequest.getPageParams() != null && statsRequest.getPageParams().getFrom() != null) {
- request.addParameter(PageParams.FROM.getPreferredName(), statsRequest.getPageParams().getFrom().toString());
- }
- if (statsRequest.getPageParams() != null && statsRequest.getPageParams().getSize() != null) {
- request.addParameter(PageParams.SIZE.getPreferredName(), statsRequest.getPageParams().getSize().toString());
- }
- if (statsRequest.getAllowNoMatch() != null) {
- request.addParameter(ALLOW_NO_MATCH, statsRequest.getAllowNoMatch().toString());
- }
- return request;
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/AcknowledgedTasksResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/AcknowledgedTasksResponse.java
deleted file mode 100644
index 32cfc5aee2b7e..0000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/AcknowledgedTasksResponse.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.client.transform;
-
-import org.elasticsearch.ElasticsearchException;
-import org.elasticsearch.action.TaskOperationFailure;
-import org.elasticsearch.common.Nullable;
-import org.elasticsearch.common.ParseField;
-import org.elasticsearch.common.TriFunction;
-import org.elasticsearch.common.xcontent.ConstructingObjectParser;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-
-import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
-import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
-
-public class AcknowledgedTasksResponse {
-
- public static final ParseField TASK_FAILURES = new ParseField("task_failures");
- public static final ParseField NODE_FAILURES = new ParseField("node_failures");
-
- @SuppressWarnings("unchecked")
- protected static ConstructingObjectParser generateParser(
- String name,
- TriFunction, List extends ElasticsearchException>, T> ctor,
- String ackFieldName) {
-
- ConstructingObjectParser parser = new ConstructingObjectParser<>(name, true,
- args -> ctor.apply((boolean) args[0], (List) args[1], (List) args[2]));
- parser.declareBoolean(constructorArg(), new ParseField(ackFieldName));
- parser.declareObjectArray(optionalConstructorArg(), (p, c) -> TaskOperationFailure.fromXContent(p), TASK_FAILURES);
- parser.declareObjectArray(optionalConstructorArg(), (p, c) -> ElasticsearchException.fromXContent(p), NODE_FAILURES);
- return parser;
- }
-
- private boolean acknowledged;
- private List taskFailures;
- private List nodeFailures;
-
- public AcknowledgedTasksResponse(boolean acknowledged, @Nullable List taskFailures,
- @Nullable List extends ElasticsearchException> nodeFailures) {
- this.acknowledged = acknowledged;
- this.taskFailures = taskFailures == null ? Collections.emptyList() : Collections.unmodifiableList(taskFailures);
- this.nodeFailures = nodeFailures == null ? Collections.emptyList() : Collections.unmodifiableList(nodeFailures);
- }
-
- public boolean isAcknowledged() {
- return acknowledged;
- }
-
- public List getTaskFailures() {
- return taskFailures;
- }
-
- public List getNodeFailures() {
- return nodeFailures;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
-
- AcknowledgedTasksResponse other = (AcknowledgedTasksResponse) obj;
- return acknowledged == other.acknowledged
- && taskFailures.equals(other.taskFailures)
- && nodeFailures.equals(other.nodeFailures);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(acknowledged, taskFailures, nodeFailures);
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/DeleteTransformRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/DeleteTransformRequest.java
deleted file mode 100644
index 7eaeb1435b6f6..0000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/DeleteTransformRequest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.client.transform;
-
-import org.elasticsearch.client.Validatable;
-import org.elasticsearch.client.ValidationException;
-
-import java.util.Objects;
-import java.util.Optional;
-
-
-/**
- * Request to delete a transform
- */
-public class DeleteTransformRequest implements Validatable {
-
- public static final String FORCE = "force";
-
- private final String id;
- private Boolean force;
-
- public DeleteTransformRequest(String id) {
- this.id = id;
- }
-
- public String getId() {
- return id;
- }
-
- public Boolean getForce() {
- return force;
- }
-
- public void setForce(boolean force) {
- this.force = force;
- }
-
- @Override
- public Optional validate() {
- if (id == null) {
- ValidationException validationException = new ValidationException();
- validationException.addValidationError("transform id must not be null");
- return Optional.of(validationException);
- } else {
- return Optional.empty();
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, force);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- DeleteTransformRequest other = (DeleteTransformRequest) obj;
- return Objects.equals(id, other.id) && Objects.equals(force, other.force);
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformRequest.java
deleted file mode 100644
index f0238083f6af0..0000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformRequest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.client.transform;
-
-import org.elasticsearch.client.Validatable;
-import org.elasticsearch.client.ValidationException;
-import org.elasticsearch.client.core.PageParams;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-
-public class GetTransformRequest implements Validatable {
-
- public static final String ALLOW_NO_MATCH = "allow_no_match";
- /**
- * Helper method to create a request that will get ALL Transforms
- * @return new {@link GetTransformRequest} object for the id "_all"
- */
- public static GetTransformRequest getAllTransformRequest() {
- return new GetTransformRequest("_all");
- }
-
- private final List ids;
- private PageParams pageParams;
- private Boolean allowNoMatch;
-
- public GetTransformRequest(String... ids) {
- this.ids = Arrays.asList(ids);
- }
-
- public List getId() {
- return ids;
- }
-
- public PageParams getPageParams() {
- return pageParams;
- }
-
- public void setPageParams(PageParams pageParams) {
- this.pageParams = pageParams;
- }
-
- public Boolean getAllowNoMatch() {
- return allowNoMatch;
- }
-
- public void setAllowNoMatch(Boolean allowNoMatch) {
- this.allowNoMatch = allowNoMatch;
- }
-
- @Override
- public Optional validate() {
- if (ids == null || ids.isEmpty()) {
- ValidationException validationException = new ValidationException();
- validationException.addValidationError("transform id must not be null");
- return Optional.of(validationException);
- } else {
- return Optional.empty();
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(ids, pageParams, allowNoMatch);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- GetTransformRequest other = (GetTransformRequest) obj;
- return Objects.equals(ids, other.ids)
- && Objects.equals(pageParams, other.pageParams)
- && Objects.equals(allowNoMatch, other.allowNoMatch);
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformResponse.java
deleted file mode 100644
index c566911bb2ffe..0000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformResponse.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.client.transform;
-
-import org.elasticsearch.client.transform.transforms.TransformConfig;
-import org.elasticsearch.common.Nullable;
-import org.elasticsearch.common.ParseField;
-import org.elasticsearch.common.xcontent.ConstructingObjectParser;
-import org.elasticsearch.common.xcontent.XContentParser;
-
-import java.util.List;
-import java.util.Objects;
-
-import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
-import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
-
-public class GetTransformResponse {
-
- public static final ParseField TRANSFORMS = new ParseField("transforms");
- public static final ParseField INVALID_TRANSFORMS = new ParseField("invalid_transforms");
- public static final ParseField COUNT = new ParseField("count");
-
- @SuppressWarnings("unchecked")
- static final ConstructingObjectParser INVALID_TRANSFORMS_PARSER = new ConstructingObjectParser<>(
- "invalid_transforms",
- true,
- args -> new InvalidTransforms((List) args[0])
- );
-
- @SuppressWarnings("unchecked")
- static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
- "get_transform",
- true,
- args -> new GetTransformResponse((List) args[0], (long) args[1], (InvalidTransforms) args[2])
- );
- static {
- // Discard the count field which is the size of the transforms array
- INVALID_TRANSFORMS_PARSER.declareLong((a, b) -> {}, COUNT);
- INVALID_TRANSFORMS_PARSER.declareStringArray(constructorArg(), TRANSFORMS);
-
- PARSER.declareObjectArray(constructorArg(), TransformConfig.PARSER::apply, TRANSFORMS);
- PARSER.declareLong(constructorArg(), COUNT);
- PARSER.declareObject(optionalConstructorArg(), INVALID_TRANSFORMS_PARSER::apply, INVALID_TRANSFORMS);
- }
-
- public static GetTransformResponse fromXContent(final XContentParser parser) {
- return GetTransformResponse.PARSER.apply(parser, null);
- }
-
- private List transformConfigurations;
- private long count;
- private InvalidTransforms invalidTransforms;
-
- public GetTransformResponse(List transformConfigurations, long count, @Nullable InvalidTransforms invalidTransforms) {
- this.transformConfigurations = transformConfigurations;
- this.count = count;
- this.invalidTransforms = invalidTransforms;
- }
-
- @Nullable
- public InvalidTransforms getInvalidTransforms() {
- return invalidTransforms;
- }
-
- public long getCount() {
- return count;
- }
-
- public List getTransformConfigurations() {
- return transformConfigurations;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(transformConfigurations, count, invalidTransforms);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (other == null || getClass() != other.getClass()) {
- return false;
- }
-
- final GetTransformResponse that = (GetTransformResponse) other;
- return Objects.equals(this.transformConfigurations, that.transformConfigurations)
- && Objects.equals(this.count, that.count)
- && Objects.equals(this.invalidTransforms, that.invalidTransforms);
- }
-
- static class InvalidTransforms {
- private final List transformIds;
-
- InvalidTransforms(List transformIds) {
- this.transformIds = transformIds;
- }
-
- public long getCount() {
- return transformIds.size();
- }
-
- public List getTransformIds() {
- return transformIds;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(transformIds);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (other == null || getClass() != other.getClass()) {
- return false;
- }
-
- final InvalidTransforms that = (InvalidTransforms) other;
- return Objects.equals(this.transformIds, that.transformIds);
- }
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformStatsRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformStatsRequest.java
deleted file mode 100644
index d226d5c67bb58..0000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformStatsRequest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.client.transform;
-
-import org.elasticsearch.client.Validatable;
-import org.elasticsearch.client.ValidationException;
-import org.elasticsearch.client.core.PageParams;
-
-import java.util.Objects;
-import java.util.Optional;
-
-public class GetTransformStatsRequest implements Validatable {
- private final String id;
- private PageParams pageParams;
- private Boolean allowNoMatch;
-
- public GetTransformStatsRequest(String id) {
- this.id = id;
- }
-
- public String getId() {
- return id;
- }
-
- public PageParams getPageParams() {
- return pageParams;
- }
-
- public void setPageParams(PageParams pageParams) {
- this.pageParams = pageParams;
- }
-
- public Boolean getAllowNoMatch() {
- return allowNoMatch;
- }
-
- public void setAllowNoMatch(Boolean allowNoMatch) {
- this.allowNoMatch = allowNoMatch;
- }
-
- @Override
- public Optional validate() {
- if (id == null) {
- ValidationException validationException = new ValidationException();
- validationException.addValidationError("transform id must not be null");
- return Optional.of(validationException);
- } else {
- return Optional.empty();
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, pageParams, allowNoMatch);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- GetTransformStatsRequest other = (GetTransformStatsRequest) obj;
- return Objects.equals(id, other.id)
- && Objects.equals(pageParams, other.pageParams)
- && Objects.equals(allowNoMatch, other.allowNoMatch);
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformStatsResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformStatsResponse.java
deleted file mode 100644
index 8b8c2bd48ed08..0000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/GetTransformStatsResponse.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.client.transform;
-
-import org.elasticsearch.ElasticsearchException;
-import org.elasticsearch.action.TaskOperationFailure;
-import org.elasticsearch.client.transform.transforms.TransformStats;
-import org.elasticsearch.common.Nullable;
-import org.elasticsearch.common.ParseField;
-import org.elasticsearch.common.xcontent.ConstructingObjectParser;
-import org.elasticsearch.common.xcontent.XContentParser;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-
-import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
-import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
-
-public class GetTransformStatsResponse {
-
- public static final ParseField TRANSFORMS = new ParseField("transforms");
- public static final ParseField COUNT = new ParseField("count");
-
- @SuppressWarnings("unchecked")
- static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
- "get_transform_stats_response",
- true,
- args -> new GetTransformStatsResponse(
- (List) args[0],
- (long) args[1],
- (List) args[2],
- (List) args[3]
- )
- );
-
- static {
- PARSER.declareObjectArray(constructorArg(), TransformStats.PARSER::apply, TRANSFORMS);
- PARSER.declareLong(constructorArg(), COUNT);
- PARSER.declareObjectArray(
- optionalConstructorArg(),
- (p, c) -> TaskOperationFailure.fromXContent(p),
- AcknowledgedTasksResponse.TASK_FAILURES
- );
- PARSER.declareObjectArray(
- optionalConstructorArg(),
- (p, c) -> ElasticsearchException.fromXContent(p),
- AcknowledgedTasksResponse.NODE_FAILURES
- );
- }
-
- public static GetTransformStatsResponse fromXContent(final XContentParser parser) {
- return GetTransformStatsResponse.PARSER.apply(parser, null);
- }
-
- private final List transformsStats;
- private final long count;
- private final List taskFailures;
- private final List nodeFailures;
-
- public GetTransformStatsResponse(
- List transformsStats,
- long count,
- @Nullable List taskFailures,
- @Nullable List extends ElasticsearchException> nodeFailures
- ) {
- this.transformsStats = transformsStats;
- this.count = count;
- this.taskFailures = taskFailures == null ? Collections.emptyList() : Collections.unmodifiableList(taskFailures);
- this.nodeFailures = nodeFailures == null ? Collections.emptyList() : Collections.unmodifiableList(nodeFailures);
- }
-
- public List getTransformsStats() {
- return transformsStats;
- }
-
- public long getCount() {
- return count;
- }
-
- public List getNodeFailures() {
- return nodeFailures;
- }
-
- public List getTaskFailures() {
- return taskFailures;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(transformsStats, count, nodeFailures, taskFailures);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (other == null || getClass() != other.getClass()) {
- return false;
- }
-
- final GetTransformStatsResponse that = (GetTransformStatsResponse) other;
- return Objects.equals(this.transformsStats, that.transformsStats)
- && Objects.equals(this.count, that.count)
- && Objects.equals(this.nodeFailures, that.nodeFailures)
- && Objects.equals(this.taskFailures, that.taskFailures);
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/PreviewTransformRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/PreviewTransformRequest.java
deleted file mode 100644
index 4eba5c60aa71d..0000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/PreviewTransformRequest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.client.transform;
-
-import org.elasticsearch.client.Validatable;
-import org.elasticsearch.client.ValidationException;
-import org.elasticsearch.client.transform.transforms.TransformConfig;
-import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.ToXContentObject;
-import org.elasticsearch.common.xcontent.XContentBuilder;
-
-import java.io.IOException;
-import java.util.Objects;
-import java.util.Optional;
-
-public class PreviewTransformRequest implements ToXContentObject, Validatable {
-
- private final TransformConfig config;
-
- public PreviewTransformRequest(TransformConfig config) {
- this.config = config;
- }
-
- public TransformConfig getConfig() {
- return config;
- }
-
- @Override
- public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
- return config.toXContent(builder, params);
- }
-
- @Override
- public Optional validate() {
- ValidationException validationException = new ValidationException();
- if (config == null) {
- validationException.addValidationError("preview requires a non-null transform config");
- return Optional.of(validationException);
- } else {
- if (config.getSource() == null) {
- validationException.addValidationError("transform source cannot be null");
- }
- }
-
- if (validationException.validationErrors().isEmpty()) {
- return Optional.empty();
- } else {
- return Optional.of(validationException);
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(config);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- PreviewTransformRequest other = (PreviewTransformRequest) obj;
- return Objects.equals(config, other.config);
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/PreviewTransformResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/PreviewTransformResponse.java
deleted file mode 100644
index 12a37d1f9d791..0000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/transform/PreviewTransformResponse.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.client.transform;
-
-import org.elasticsearch.action.admin.indices.alias.Alias;
-import org.elasticsearch.client.indices.CreateIndexRequest;
-import org.elasticsearch.common.ParseField;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.ConstructingObjectParser;
-import org.elasticsearch.common.xcontent.XContentParser;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
-
-public class PreviewTransformResponse {
-
- public static class GeneratedDestIndexSettings {
- static final ParseField MAPPINGS = new ParseField("mappings");
- private static final ParseField SETTINGS = new ParseField("settings");
- private static final ParseField ALIASES = new ParseField("aliases");
-
- private final Map mappings;
- private final Settings settings;
- private final Set aliases;
-
- private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
- "transform_preview_generated_dest_index",
- true,
- args -> {
- @SuppressWarnings("unchecked")
- Map mappings = (Map) args[0];
- Settings settings = (Settings) args[1];
- @SuppressWarnings("unchecked")
- Set aliases = (Set) args[2];
-
- return new GeneratedDestIndexSettings(mappings, settings, aliases);
- }
- );
-
- static {
- PARSER.declareObject(optionalConstructorArg(), (p, c) -> p.mapOrdered(), MAPPINGS);
- PARSER.declareObject(optionalConstructorArg(), (p, c) -> Settings.fromXContent(p), SETTINGS);
- PARSER.declareObject(optionalConstructorArg(), (p, c) -> {
- Set aliases = new HashSet<>();
- while ((p.nextToken()) != XContentParser.Token.END_OBJECT) {
- aliases.add(Alias.fromXContent(p));
- }
- return aliases;
- }, ALIASES);
- }
-
- public GeneratedDestIndexSettings(Map mappings, Settings settings, Set aliases) {
- this.mappings = mappings == null ? Collections.emptyMap() : Collections.unmodifiableMap(mappings);
- this.settings = settings == null ? Settings.EMPTY : settings;
- this.aliases = aliases == null ? Collections.emptySet() : Collections.unmodifiableSet(aliases);
- }
-
- public Map getMappings() {
- return mappings;
- }
-
- public Settings getSettings() {
- return settings;
- }
-
- public Set getAliases() {
- return aliases;
- }
-
- public static GeneratedDestIndexSettings fromXContent(final XContentParser parser) {
- return PARSER.apply(parser, null);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
-
- if (obj == null || obj.getClass() != getClass()) {
- return false;
- }
-
- GeneratedDestIndexSettings other = (GeneratedDestIndexSettings) obj;
- return Objects.equals(other.mappings, mappings)
- && Objects.equals(other.settings, settings)
- && Objects.equals(other.aliases, aliases);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(mappings, settings, aliases);
- }
- }
-
- public static final ParseField PREVIEW = new ParseField("preview");
- public static final ParseField GENERATED_DEST_INDEX_SETTINGS = new ParseField("generated_dest_index");
-
- private final List