Skip to content

Commit

Permalink
spotlesApply
Browse files Browse the repository at this point in the history
Signed-off-by: Alisherova Madinabonu <[email protected]>
  • Loading branch information
MadinaBonuAlisherova committed May 10, 2023
1 parent 4f6bd4d commit d1292da
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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 {

Expand All @@ -54,11 +56,8 @@ public String getName() {
@Override
public List<Route> 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))

);
}
Expand All @@ -74,22 +73,19 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient

CompletableFuture<Boolean> 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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
}
Expand All @@ -46,7 +46,6 @@ public static DeleteJobDetailsRequest parse(XContentParser parser) throws IOExce

}


@Override
public ActionRequestValidationException validate() {
return null;
Expand Down

0 comments on commit d1292da

Please sign in to comment.