jerryshao commented on code in PR #7944:
URL: https://github.com/apache/gravitino/pull/7944#discussion_r2261941328
##########
clients/client-java/src/main/java/org/apache/gravitino/client/GravitinoMetalake.java:
##########
@@ -1189,6 +1204,162 @@ public String[] listBindingRoleNames() {
return metadataObjectRoleOperations.listBindingRoleNames();
}
+ @Override
+ public List<JobTemplate> listJobTemplates() {
+ JobTemplateListResponse resp =
+ restClient.get(
+ String.format(API_METALAKES_JOB_TEMPLATES_PATH,
RESTUtils.encodeString(this.name())),
+ ImmutableMap.of("details", "true"),
+ JobTemplateListResponse.class,
+ Collections.emptyMap(),
+ ErrorHandlers.jobErrorHandler());
+ resp.validate();
+
+ return resp.getJobTemplates().stream()
+ .map(org.apache.gravitino.dto.util.DTOConverters::fromDTO)
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public void registerJobTemplate(JobTemplate jobTemplate)
+ throws JobTemplateAlreadyExistsException {
+ JobTemplateRegisterRequest req =
+ new
JobTemplateRegisterRequest(DTOConverters.toJobTemplateDTO(jobTemplate));
+ req.validate();
+
+ BaseResponse resp =
+ restClient.post(
+ String.format(API_METALAKES_JOB_TEMPLATES_PATH,
RESTUtils.encodeString(this.name())),
+ req,
+ BaseResponse.class,
+ Collections.emptyMap(),
+ ErrorHandlers.jobErrorHandler());
+ resp.validate();
+ }
+
+ @Override
+ public JobTemplate getJobTemplate(String jobTemplateName) throws
NoSuchJobTemplateException {
+ Preconditions.checkArgument(
+ StringUtils.isNotBlank(jobTemplateName), "job template name must not
be null or empty");
+
+ JobTemplateResponse resp =
+ restClient.get(
+ String.format(API_METALAKES_JOB_TEMPLATES_PATH,
RESTUtils.encodeString(this.name()))
+ + "/"
+ + RESTUtils.encodeString(jobTemplateName),
+ JobTemplateResponse.class,
+ Collections.emptyMap(),
+ ErrorHandlers.jobErrorHandler());
+ resp.validate();
+
+ return
org.apache.gravitino.dto.util.DTOConverters.fromDTO(resp.getJobTemplate());
Review Comment:
There's also another client DTOConverters in the same package, so adding a
full name to avoid the conflicts.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]