Search in sources :

Example 1 with Unknown

use of io.kubernetes.client.proto.Runtime.Unknown in project java by kubernetes-client.

the class ProtoClient method getObjectOrStatusFromServer.

private <T extends Message> ObjectOrStatus<T> getObjectOrStatusFromServer(Builder builder, Request request) throws IOException, ApiException {
    Response resp = apiClient.getHttpClient().newCall(request).execute();
    Unknown u = parse(resp.body().byteStream());
    resp.body().close();
    if (u.getTypeMeta().getApiVersion().equals("v1") && u.getTypeMeta().getKind().equals("Status")) {
        Status status = Status.newBuilder().mergeFrom(u.getRaw()).build();
        return new ObjectOrStatus(null, status);
    }
    return new ObjectOrStatus((T) builder.mergeFrom(u.getRaw()).build(), null);
}
Also used : Response(okhttp3.Response) Status(io.kubernetes.client.proto.Meta.Status) Unknown(io.kubernetes.client.proto.Runtime.Unknown)

Aggregations

Status (io.kubernetes.client.proto.Meta.Status)1 Unknown (io.kubernetes.client.proto.Runtime.Unknown)1 Response (okhttp3.Response)1