[#1] code cleanup

update README.md
Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
Ori Bruk 2024-07-23 19:30:07 +03:00
parent b0db7df192
commit a7fab6f314
28 changed files with 177 additions and 203 deletions

View file

@ -1,26 +0,0 @@
package info.FrostFS.sdk;
import io.grpc.Channel;
import io.grpc.ChannelCredentials;
import io.grpc.netty.NettyChannelBuilder;
import java.net.URI;
import java.net.URISyntaxException;
import static java.util.Objects.isNull;
public class GrpcClient {
public static Channel initGrpcChannel(String host, ChannelCredentials creds) {
try {
URI uri = new URI(host);
var channelBuilder = isNull(creds) ? NettyChannelBuilder.forAddress(uri.getHost(), uri.getPort())
: NettyChannelBuilder.forAddress(uri.getHost(), uri.getPort(), creds);
return channelBuilder.usePlaintext().build();
} catch (URISyntaxException exp) {
var message = String.format("Host %s has invalid format. Error: %s", host, exp.getMessage());
throw new IllegalArgumentException(message);
}
}
}