use of org.apache.inlong.manager.common.pojo.group.InlongGroupRequest in project incubator-inlong by apache.
the class InnerInlongManagerClient method updateGroup.
/**
* Update inlong group info
*
* @return groupId && errMsg
*/
public Pair<String, String> updateGroup(InlongGroupRequest groupRequest) {
String path = HTTP_PATH + "/group/update";
final String group = GsonUtil.toJson(groupRequest);
final RequestBody groupBody = RequestBody.create(MediaType.parse("application/json"), group);
final String url = formatUrl(path);
Request request = new Request.Builder().url(url).method("POST", groupBody).build();
Call call = httpClient.newCall(request);
try {
Response response = call.execute();
assert response.body() != null;
String body = response.body().string();
AssertUtil.isTrue(response.isSuccessful(), String.format("Inlong request failed: %s", body));
org.apache.inlong.manager.common.beans.Response responseBody = InlongParser.parseResponse(body);
return Pair.of(responseBody.getData().toString(), responseBody.getErrMsg());
} catch (Exception e) {
throw new RuntimeException(String.format("Inlong group update failed: %s", e.getMessage()), e);
}
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupRequest in project incubator-inlong by apache.
the class InnerInlongManagerClient method initInlongGroup.
public WorkflowResult initInlongGroup(InlongGroupRequest groupInfo) {
final String groupId = groupInfo.getInlongGroupId();
String path = HTTP_PATH + "/group/startProcess/" + groupId;
final String url = formatUrl(path);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), "");
Request request = new Request.Builder().url(url).method("POST", requestBody).build();
Call call = httpClient.newCall(request);
try {
Response response = call.execute();
assert response.body() != null;
String body = response.body().string();
AssertUtil.isTrue(response.isSuccessful(), String.format("Inlong request failed: %s", body));
org.apache.inlong.manager.common.beans.Response responseBody = InlongParser.parseResponse(body);
AssertUtil.isTrue(responseBody.getErrMsg() == null, String.format("Inlong request failed: %s", responseBody.getErrMsg()));
return InlongParser.parseWorkflowResult(responseBody);
} catch (Exception e) {
throw new RuntimeException(String.format("Inlong group init failed: %s", e.getMessage()), e);
}
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupRequest in project incubator-inlong by apache.
the class InnerInlongManagerClient method createGroup.
/**
* Create inlong group
*/
public String createGroup(InlongGroupRequest groupInfo) {
String path = HTTP_PATH + "/group/save";
final String biz = GsonUtil.toJson(groupInfo);
final RequestBody bizBody = RequestBody.create(MediaType.parse("application/json"), biz);
final String url = formatUrl(path);
Request request = new Request.Builder().url(url).method("POST", bizBody).build();
Call call = httpClient.newCall(request);
try {
Response response = call.execute();
assert response.body() != null;
String body = response.body().string();
AssertUtil.isTrue(response.isSuccessful(), String.format("Inlong request failed: %s", body));
org.apache.inlong.manager.common.beans.Response responseBody = InlongParser.parseResponse(body);
AssertUtil.isTrue(responseBody.getErrMsg() == null, String.format("Inlong request failed: %s", responseBody.getErrMsg()));
return responseBody.getData().toString();
} catch (Exception e) {
throw new RuntimeException(String.format("inlong group save failed: %s", e.getMessage()), e);
}
}
Aggregations