예제 #1
0
 public ListenableFuture<CreateDeploymentGroupResponse> createDeploymentGroup(
     final DeploymentGroup descriptor) {
   return transform(
       request(uri("/deployment-group/"), "POST", descriptor),
       ConvertResponseToPojo.create(
           CreateDeploymentGroupResponse.class, ImmutableSet.of(HTTP_OK, HTTP_BAD_REQUEST)));
 }
예제 #2
0
 public ListenableFuture<JobDeleteResponse> deleteJob(final JobId id, final String token) {
   return transform(
       request(uri(path("/jobs/%s", id), ImmutableMap.of("token", token)), "DELETE"),
       ConvertResponseToPojo.create(
           JobDeleteResponse.class,
           ImmutableSet.of(HTTP_OK, HTTP_NOT_FOUND, HTTP_BAD_REQUEST, HTTP_FORBIDDEN)));
 }
예제 #3
0
  public ListenableFuture<Map<JobId, JobStatus>> jobStatuses(final Set<JobId> jobs) {
    final ConvertResponseToPojo<Map<JobId, JobStatus>> converter =
        ConvertResponseToPojo.create(
            TypeFactory.defaultInstance().constructMapType(Map.class, JobId.class, JobStatus.class),
            ImmutableSet.of(HTTP_OK));

    return transform(request(uri("/jobs/statuses"), "POST", jobs), converter);
  }
예제 #4
0
 public ListenableFuture<JobUndeployResponse> undeploy(
     final JobId jobId, final String host, final String token) {
   return transform(
       request(
           uri(path("/hosts/%s/jobs/%s", host, jobId), ImmutableMap.of("token", token)), "DELETE"),
       ConvertResponseToPojo.create(
           JobUndeployResponse.class,
           ImmutableSet.of(HTTP_OK, HTTP_NOT_FOUND, HTTP_BAD_REQUEST, HTTP_FORBIDDEN)));
 }
예제 #5
0
 public ListenableFuture<RollingUpdateResponse> rollingUpdate(
     final String deploymentGroupName, final JobId job, final RolloutOptions options) {
   return transform(
       request(
           uri(path("/deployment-group/%s/rolling-update", deploymentGroupName)),
           "POST",
           new RollingUpdateRequest(job, options)),
       ConvertResponseToPojo.create(
           RollingUpdateResponse.class, ImmutableSet.of(HTTP_OK, HTTP_BAD_REQUEST)));
 }
예제 #6
0
  public ListenableFuture<Map<String, HostStatus>> hostStatuses(
      final List<String> hosts, final Map<String, String> queryParams) {
    final ConvertResponseToPojo<Map<String, HostStatus>> converter =
        ConvertResponseToPojo.create(
            TypeFactory.defaultInstance()
                .constructMapType(Map.class, String.class, HostStatus.class),
            ImmutableSet.of(HTTP_OK));

    return transform(request(uri("/hosts/statuses", queryParams), "POST", hosts), converter);
  }
예제 #7
0
 public ListenableFuture<SetGoalResponse> setGoal(
     final Deployment job, final String host, final String token) {
   return transform(
       request(
           uri(path("/hosts/%s/jobs/%s", host, job.getJobId()), ImmutableMap.of("token", token)),
           "PATCH",
           job),
       ConvertResponseToPojo.create(
           SetGoalResponse.class, ImmutableSet.of(HTTP_OK, HTTP_NOT_FOUND, HTTP_FORBIDDEN)));
 }
예제 #8
0
 public ListenableFuture<JobDeployResponse> deploy(
     final Deployment job, final String host, final String token) {
   final Set<Integer> deserializeReturnCodes =
       ImmutableSet.of(HTTP_OK, HTTP_NOT_FOUND, HTTP_BAD_METHOD, HTTP_BAD_REQUEST, HTTP_FORBIDDEN);
   return transform(
       request(
           uri(path("/hosts/%s/jobs/%s", host, job.getJobId()), ImmutableMap.of("token", token)),
           "PUT",
           job),
       ConvertResponseToPojo.create(JobDeployResponse.class, deserializeReturnCodes));
 }
예제 #9
0
 public ListenableFuture<RemoveDeploymentGroupResponse> removeDeploymentGroup(final String name) {
   return transform(
       request(uri("/deployment-group/" + name), "DELETE"),
       ConvertResponseToPojo.create(
           RemoveDeploymentGroupResponse.class, ImmutableSet.of(HTTP_OK, HTTP_BAD_REQUEST)));
 }
예제 #10
0
 public ListenableFuture<TaskStatusEvents> jobHistory(final JobId jobId) {
   return transform(
       request(uri(path("/history/jobs/%s", jobId.toString())), "GET"),
       ConvertResponseToPojo.create(
           TaskStatusEvents.class, ImmutableSet.of(HTTP_OK, HTTP_NOT_FOUND)));
 }
예제 #11
0
 public ListenableFuture<CreateJobResponse> createJob(final Job descriptor) {
   return transform(
       request(uri("/jobs/"), "POST", descriptor),
       ConvertResponseToPojo.create(
           CreateJobResponse.class, ImmutableSet.of(HTTP_OK, HTTP_BAD_REQUEST)));
 }
예제 #12
0
 public ListenableFuture<HostDeregisterResponse> deregisterHost(final String host) {
   return transform(
       request(uri(path("/hosts/%s", host)), "DELETE"),
       ConvertResponseToPojo.create(
           HostDeregisterResponse.class, ImmutableSet.of(HTTP_OK, HTTP_NOT_FOUND)));
 }