2024-07-23 19:24:17 +00:00
|
|
|
package info.frostfs.sdk.jdo;
|
2024-07-16 12:00:17 +00:00
|
|
|
|
|
|
|
import io.grpc.ChannelCredentials;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
public class ClientSettings {
|
|
|
|
private static final String ERROR_TEMPLATE = "%s is required parameter.";
|
|
|
|
|
|
|
|
public String key;
|
|
|
|
public String host;
|
|
|
|
public ChannelCredentials creds;
|
|
|
|
|
|
|
|
public ClientSettings(String key, String host) {
|
|
|
|
this.key = key;
|
|
|
|
this.host = host;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ChannelCredentials getCreds() {
|
|
|
|
return creds;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCreds(ChannelCredentials creds) {
|
|
|
|
this.creds = creds;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getHost() {
|
|
|
|
return host;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setHost(String host) {
|
|
|
|
this.host = host;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getKey() {
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setKey(String key) {
|
|
|
|
this.key = key;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void validate() {
|
|
|
|
StringBuilder errorMessage = new StringBuilder();
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(key)) {
|
|
|
|
errorMessage.append(String.format(ERROR_TEMPLATE, "Key")).append(System.lineSeparator());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(host)) {
|
|
|
|
errorMessage.append(String.format(ERROR_TEMPLATE, "Host")).append(System.lineSeparator());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (errorMessage.length() != 0) {
|
|
|
|
throw new IllegalArgumentException(errorMessage.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|