use of io.seldon.clustermanager.pb.JsonFormat.Printer in project seldon-core by SeldonIO.
the class ProtoBufUtils method convertProtoToModel.
public static V1PodTemplateSpec convertProtoToModel(PodTemplateSpec protoTemplateSpec) throws InvalidProtocolBufferException, SeldonDeploymentException {
Printer jsonPrinter = JsonFormat.printer().preservingProtoFieldNames();
String ptsJson = jsonPrinter.print(protoTemplateSpec);
JSON json = new JSON();
Type returnType = new TypeToken<V1PodTemplateSpec>() {
}.getType();
V1PodTemplateSpec podTemplateSpec = (V1PodTemplateSpec) json.deserialize(ptsJson, returnType);
// return fixProbes(protoTemplateSpec, podTemplateSpec);
return podTemplateSpec;
}
Aggregations