From d1292da8d39f5e77fd73eeb606fd492675f0f1e5 Mon Sep 17 00:00:00 2001 From: Alisherova Madinabonu <54506754+MadinaBonuAlisherova@users.noreply.github.com> Date: Wed, 10 May 2023 21:29:41 +0500 Subject: [PATCH] spotlesApply Signed-off-by: Alisherova Madinabonu <54506754+MadinaBonuAlisherova@users.noreply.github.com> --- .../rest/action/DeleteJobDetailsAPI.java | 38 +++++++++---------- .../rest/request/DeleteJobDetailsRequest.java | 11 +++--- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/opensearch/jobscheduler/rest/action/DeleteJobDetailsAPI.java b/src/main/java/org/opensearch/jobscheduler/rest/action/DeleteJobDetailsAPI.java index 6ec64f63..4504bf13 100644 --- a/src/main/java/org/opensearch/jobscheduler/rest/action/DeleteJobDetailsAPI.java +++ b/src/main/java/org/opensearch/jobscheduler/rest/action/DeleteJobDetailsAPI.java @@ -1,8 +1,11 @@ /* * 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.jobscheduler.rest.action; import com.google.common.collect.ImmutableList; @@ -32,7 +35,6 @@ import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import static org.opensearch.jobscheduler.rest.request.DeleteJobDetailsRequest.DOCUMENT_ID; import static org.opensearch.rest.RestRequest.Method.DELETE; -import static org.opensearch.rest.RestRequest.Method.PUT; public class DeleteJobDetailsAPI extends BaseRestHandler { @@ -54,11 +56,8 @@ public String getName() { @Override public List routes() { return ImmutableList.of( - // Delete Job Details Entry Request - new Route( - DELETE, - String.format(Locale.ROOT, "%s/%s/{%s}", JobSchedulerPlugin.JS_BASE_URI, "_job_details", DOCUMENT_ID) - ) + // Delete Job Details Entry Request + new Route(DELETE, String.format(Locale.ROOT, "%s/%s/{%s}", JobSchedulerPlugin.JS_BASE_URI, "_job_details", DOCUMENT_ID)) ); } @@ -74,22 +73,19 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient CompletableFuture inProgressFuture = new CompletableFuture<>(); - jobDetailsService.deleteJobDetails( - documentId, - new ActionListener<>() { + jobDetailsService.deleteJobDetails(documentId, new ActionListener<>() { - @Override - public void onResponse(Boolean aBoolean) { - inProgressFuture.complete(aBoolean); - } + @Override + public void onResponse(Boolean aBoolean) { + inProgressFuture.complete(aBoolean); + } - @Override - public void onFailure(Exception e) { - logger.info("could not process job index", e); - inProgressFuture.completeExceptionally(e); - } - } - ); + @Override + public void onFailure(Exception e) { + logger.info("could not process job index", e); + inProgressFuture.completeExceptionally(e); + } + }); try { inProgressFuture.orTimeout(JobDetailsService.TIME_OUT_FOR_REQUEST, TimeUnit.SECONDS); diff --git a/src/main/java/org/opensearch/jobscheduler/rest/request/DeleteJobDetailsRequest.java b/src/main/java/org/opensearch/jobscheduler/rest/request/DeleteJobDetailsRequest.java index 69750d7b..397b0777 100644 --- a/src/main/java/org/opensearch/jobscheduler/rest/request/DeleteJobDetailsRequest.java +++ b/src/main/java/org/opensearch/jobscheduler/rest/request/DeleteJobDetailsRequest.java @@ -1,8 +1,11 @@ /* * 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.jobscheduler.rest.request; import org.opensearch.action.ActionRequest; @@ -12,16 +15,13 @@ import java.io.IOException; - public class DeleteJobDetailsRequest extends ActionRequest { public static String documentId; public static final String DOCUMENT_ID = "document_id"; - public DeleteJobDetailsRequest( - String documentId - ) { + public DeleteJobDetailsRequest(String documentId) { super(); this.documentId = documentId; } @@ -46,7 +46,6 @@ public static DeleteJobDetailsRequest parse(XContentParser parser) throws IOExce } - @Override public ActionRequestValidationException validate() { return null;