Skip to content

Commit

Permalink
Add name property to ClusterStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
Bj0rnen committed Mar 17, 2015
1 parent 6072838 commit 7e852ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Response getCluster(
private Response viewCluster(String clusterName, Optional<Integer> limit,
Optional<URI> createdURI) {
ClusterStatus view =
new ClusterStatus(context.storage.getClusterRunStatuses(clusterName, limit.or(10)));
new ClusterStatus(clusterName, context.storage.getClusterRunStatuses(clusterName, limit.or(10)));

if (view.repairRuns == null) {
return Response.status(Response.Status.NOT_FOUND)
Expand Down Expand Up @@ -180,7 +180,8 @@ public Response deleteCluster(
}
Optional<Cluster> deletedCluster = context.storage.deleteCluster(clusterName);
if (deletedCluster.isPresent()) {
return Response.ok(new ClusterStatus(Collections.<RepairRunStatus>emptyList())).build();
return Response.ok(new ClusterStatus(clusterName, Collections.<RepairRunStatus>emptyList()))
.build();
}
return Response.serverError().entity("delete failed for schedule with name \""
+ clusterName + "\"").build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@

public class ClusterStatus {

@JsonProperty
public final String name;
@JsonProperty("repair_runs")
public final Collection<RepairRunStatus> repairRuns;

public ClusterStatus(Collection<RepairRunStatus> repairRuns) {
public ClusterStatus(String name, Collection<RepairRunStatus> repairRuns) {
this.name = name;
this.repairRuns = repairRuns;
}
}

0 comments on commit 7e852ea

Please sign in to comment.