-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: pranikum <109206473+pranikum@users.noreply.github.com>
- Loading branch information
Showing
17 changed files
with
458 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...-api-spec/src/main/resources/rest-api-spec/api/cluster.delete_decommission_awareness.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"cluster.delete_decommission_awareness": { | ||
"documentation": { | ||
"url": "https://opensearch.org/docs/latest/opensearch/rest-api/decommission/", | ||
"description": "Delete any existing decommission." | ||
}, | ||
"stability": "experimental", | ||
"url": { | ||
"paths": [ | ||
{ | ||
"path": "/_cluster/decommission/awareness/", | ||
"methods": [ | ||
"DELETE" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...rch/action/admin/cluster/decommission/awareness/delete/DeleteDecommissionStateAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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.action.admin.cluster.decommission.awareness.delete; | ||
|
||
import org.opensearch.action.ActionType; | ||
|
||
/** | ||
* Transport action delete decommission. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
|
||
public class DeleteDecommissionStateAction extends ActionType<DeleteDecommissionStateResponse> { | ||
public static final DeleteDecommissionStateAction INSTANCE = new DeleteDecommissionStateAction(); | ||
public static final String NAME = "cluster:admin/decommission/awareness/delete"; | ||
|
||
private DeleteDecommissionStateAction() { | ||
super(NAME, DeleteDecommissionStateResponse::new); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...ch/action/admin/cluster/decommission/awareness/delete/DeleteDecommissionStateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* 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.action.admin.cluster.decommission.awareness.delete; | ||
|
||
import org.opensearch.action.ActionRequestValidationException; | ||
import org.opensearch.action.support.clustermanager.ClusterManagerNodeRequest; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.io.stream.StreamOutput; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Request for deleting decommission request. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class DeleteDecommissionStateRequest extends ClusterManagerNodeRequest<DeleteDecommissionStateRequest> { | ||
|
||
public DeleteDecommissionStateRequest() {} | ||
|
||
public DeleteDecommissionStateRequest(StreamInput in) throws IOException { | ||
super(in); | ||
} | ||
|
||
@Override | ||
public ActionRequestValidationException validate() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...on/admin/cluster/decommission/awareness/delete/DeleteDecommissionStateRequestBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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.action.admin.cluster.decommission.awareness.delete; | ||
|
||
import org.opensearch.action.support.clustermanager.ClusterManagerNodeOperationRequestBuilder; | ||
import org.opensearch.client.OpenSearchClient; | ||
|
||
/** | ||
* Builder for a Delete decommission request. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class DeleteDecommissionStateRequestBuilder extends ClusterManagerNodeOperationRequestBuilder< | ||
DeleteDecommissionStateRequest, | ||
DeleteDecommissionStateResponse, | ||
DeleteDecommissionStateRequestBuilder> { | ||
|
||
public DeleteDecommissionStateRequestBuilder(OpenSearchClient client, DeleteDecommissionStateAction action) { | ||
super(client, action, new DeleteDecommissionStateRequest()); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...h/action/admin/cluster/decommission/awareness/delete/DeleteDecommissionStateResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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.action.admin.cluster.decommission.awareness.delete; | ||
|
||
import org.opensearch.action.support.master.AcknowledgedResponse; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.common.xcontent.ToXContentObject; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Response returned after deletion of decommission request. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class DeleteDecommissionStateResponse extends AcknowledgedResponse implements ToXContentObject { | ||
|
||
public DeleteDecommissionStateResponse(StreamInput in) throws IOException { | ||
super(in); | ||
} | ||
|
||
public DeleteDecommissionStateResponse(boolean acknowledged) { | ||
super(acknowledged); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
...n/admin/cluster/decommission/awareness/delete/TransportDeleteDecommissionStateAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* 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.action.admin.cluster.decommission.awareness.delete; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.opensearch.action.ActionListener; | ||
import org.opensearch.action.support.ActionFilters; | ||
import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction; | ||
import org.opensearch.cluster.ClusterState; | ||
import org.opensearch.cluster.block.ClusterBlockException; | ||
import org.opensearch.cluster.block.ClusterBlockLevel; | ||
import org.opensearch.cluster.metadata.IndexNameExpressionResolver; | ||
import org.opensearch.cluster.service.ClusterService; | ||
import org.opensearch.common.inject.Inject; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.threadpool.ThreadPool; | ||
import org.opensearch.transport.TransportService; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Transport action for delete decommission. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class TransportDeleteDecommissionStateAction extends TransportClusterManagerNodeAction< | ||
DeleteDecommissionStateRequest, | ||
DeleteDecommissionStateResponse> { | ||
|
||
private static final Logger logger = LogManager.getLogger(TransportDeleteDecommissionStateAction.class); | ||
|
||
@Inject | ||
public TransportDeleteDecommissionStateAction( | ||
TransportService transportService, | ||
ClusterService clusterService, | ||
ThreadPool threadPool, | ||
ActionFilters actionFilters, | ||
IndexNameExpressionResolver indexNameExpressionResolver | ||
) { | ||
super( | ||
DeleteDecommissionStateAction.NAME, | ||
transportService, | ||
clusterService, | ||
threadPool, | ||
actionFilters, | ||
DeleteDecommissionStateRequest::new, | ||
indexNameExpressionResolver | ||
); | ||
} | ||
|
||
@Override | ||
protected String executor() { | ||
return ThreadPool.Names.SAME; | ||
} | ||
|
||
@Override | ||
protected DeleteDecommissionStateResponse read(StreamInput in) throws IOException { | ||
return new DeleteDecommissionStateResponse(in); | ||
} | ||
|
||
@Override | ||
protected ClusterBlockException checkBlock(DeleteDecommissionStateRequest request, ClusterState state) { | ||
return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE); | ||
} | ||
|
||
@Override | ||
protected void clusterManagerOperation( | ||
DeleteDecommissionStateRequest request, | ||
ClusterState state, | ||
ActionListener<DeleteDecommissionStateResponse> listener | ||
) { | ||
// TODO: Enable when service class change is merged | ||
logger.info("Received delete decommission Request"); | ||
listener.onResponse(new DeleteDecommissionStateResponse(true)); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
.../java/org/opensearch/action/admin/cluster/decommission/awareness/delete/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/** Delete decommission transport handlers. */ | ||
package org.opensearch.action.admin.cluster.decommission.awareness.delete; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.