diff --git a/plugins/transport-grpc/src/main/java/org/opensearch/transport/grpc/GrpcModulePlugin.java b/plugins/transport-grpc/src/main/java/org/opensearch/transport/grpc/GrpcModulePlugin.java index 452c07f8e59bb..b2fc6a12cb211 100644 --- a/plugins/transport-grpc/src/main/java/org/opensearch/transport/grpc/GrpcModulePlugin.java +++ b/plugins/transport-grpc/src/main/java/org/opensearch/transport/grpc/GrpcModulePlugin.java @@ -30,7 +30,6 @@ import org.opensearch.script.ScriptService; import org.opensearch.telemetry.tracing.Tracer; import org.opensearch.threadpool.ThreadPool; -import org.opensearch.transport.grpc.actions.MainActionService; import org.opensearch.watcher.ResourceWatcherService; import java.util.Collection; @@ -42,6 +41,7 @@ import io.grpc.BindableService; +import static java.util.Collections.EMPTY_LIST; import static java.util.Collections.emptyList; import static org.opensearch.common.settings.Setting.intSetting; import static org.opensearch.common.settings.Setting.listSetting; @@ -99,8 +99,7 @@ public Collection createComponents( if (FeatureFlags.isEnabled(FeatureFlags.GRPC_ENABLE_SETTING) == false) { throw new IllegalArgumentException("transport-grpc is experimental and feature flag must be enabled before use"); } - final List services = List.of(new MainActionService(client)); - this.transport = new Netty4GrpcServerTransport(clusterService.getSettings(), services); + this.transport = new Netty4GrpcServerTransport(clusterService.getSettings(), Collections.emptyList()); // The server will manage the lifecycle of any instance of LifecycleComponent that is returned here return List.of(transport); diff --git a/plugins/transport-grpc/src/main/java/org/opensearch/transport/grpc/actions/MainActionService.java b/plugins/transport-grpc/src/main/java/org/opensearch/transport/grpc/actions/MainActionService.java deleted file mode 100644 index 38d6370d113a0..0000000000000 --- a/plugins/transport-grpc/src/main/java/org/opensearch/transport/grpc/actions/MainActionService.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.transport.grpc.actions; - -import org.opensearch.action.main.MainRequest; -import org.opensearch.action.main.MainResponse; -import org.opensearch.client.Client; -import org.opensearch.core.action.ActionListener; -import org.opensearch.proto.grpc.MainAction; -import org.opensearch.proto.grpc.MainActionServiceGrpc; - -import io.grpc.stub.StreamObserver; - -/** - * gRPC version of the MainAction, i.e. `GET /` - */ -public final class MainActionService extends MainActionServiceGrpc.MainActionServiceImplBase { - private final Client client; - - public MainActionService(Client client) { - this.client = client; - } - - @Override - public void get(MainAction.MainRequest request, StreamObserver responseObserver) { - client.execute(org.opensearch.action.main.MainAction.INSTANCE, new MainRequest(), new ActionListener<>() { - @Override - public void onResponse(MainResponse mainResponse) { - responseObserver.onNext( - MainAction.MainResponse.newBuilder() - .setName(mainResponse.getNodeName()) - .setClusterName(mainResponse.getClusterName().value()) - .setClusterUuid(mainResponse.getClusterUuid()) - .setVersion( - MainAction.MainResponse.Version.newBuilder() - .setDistribution(mainResponse.getBuild().getDistribution()) - .setNumber(mainResponse.getBuild().getQualifiedVersion()) - .setBuildType(mainResponse.getBuild().type().displayName()) - .setBuildHash(mainResponse.getBuild().hash()) - .setBuildDate(mainResponse.getBuild().date()) - .setBuildSnapshot(Boolean.toString(mainResponse.getBuild().isSnapshot())) - .setLuceneVersion(mainResponse.getVersion().luceneVersion.toString()) - .setMinimumWireCompatibilityVersion(mainResponse.getVersion().minimumCompatibilityVersion().toString()) - .setMinimumIndexCompatibilityVersion( - mainResponse.getVersion().minimumIndexCompatibilityVersion().toString() - ) - .build() - ) - .setTagline("The OpenSearch Project: https://opensearch.org/") - .build() - ); - responseObserver.onCompleted(); - } - - @Override - public void onFailure(Exception e) { - responseObserver.onError(e); - } - }); - } -} diff --git a/plugins/transport-grpc/src/main/proto/opensearch/main_action.proto b/plugins/transport-grpc/src/main/proto/opensearch/main_action.proto deleted file mode 100644 index af521002d8241..0000000000000 --- a/plugins/transport-grpc/src/main/proto/opensearch/main_action.proto +++ /dev/null @@ -1,30 +0,0 @@ -syntax = "proto3"; -package org.opensearch.proto.grpc; - -message MainRequest { - -} - -message MainResponse { - string name = 1; - string cluster_name = 2; - string cluster_uuid = 3; - Version version = 4; - string tagline = 5; - - message Version { - string distribution = 1; - string number = 2; - string build_type = 3; - string build_hash = 4; - string build_date = 5; - string build_snapshot = 6; - string lucene_version = 7; - string minimum_wire_compatibility_version = 8; - string minimum_index_compatibility_version = 9; - } -} - -service MainActionService { - rpc Get(MainRequest) returns (MainResponse) {} -}