Search in sources :

Example 1 with ScheduleNotFoundException

use of io.cdap.cdap.internal.app.runtime.schedule.ScheduleNotFoundException in project cdap by caskdata.

the class RemoteScheduleFetcher method get.

/**
 * Get the schedule identified by the given schedule id
 */
@Override
public ScheduleDetail get(ScheduleId scheduleId) throws IOException, ScheduleNotFoundException, UnauthorizedException {
    String url = String.format("namespaces/%s/apps/%s/versions/%s/schedules/%s", scheduleId.getNamespace(), scheduleId.getApplication(), scheduleId.getVersion(), scheduleId.getSchedule());
    HttpRequest.Builder requestBuilder = remoteClient.requestBuilder(HttpMethod.GET, url);
    HttpResponse httpResponse;
    try {
        httpResponse = execute(requestBuilder.build());
    } catch (NotFoundException e) {
        throw new ScheduleNotFoundException(scheduleId);
    }
    return GSON.fromJson(httpResponse.getResponseBodyAsString(), ScheduleDetail.class);
}
Also used : HttpRequest(io.cdap.common.http.HttpRequest) ScheduleNotFoundException(io.cdap.cdap.internal.app.runtime.schedule.ScheduleNotFoundException) HttpResponse(io.cdap.common.http.HttpResponse) ScheduleNotFoundException(io.cdap.cdap.internal.app.runtime.schedule.ScheduleNotFoundException) ProgramNotFoundException(io.cdap.cdap.common.ProgramNotFoundException) NotFoundException(io.cdap.cdap.common.NotFoundException)

Aggregations

NotFoundException (io.cdap.cdap.common.NotFoundException)1 ProgramNotFoundException (io.cdap.cdap.common.ProgramNotFoundException)1 ScheduleNotFoundException (io.cdap.cdap.internal.app.runtime.schedule.ScheduleNotFoundException)1 HttpRequest (io.cdap.common.http.HttpRequest)1 HttpResponse (io.cdap.common.http.HttpResponse)1