Skip to content

Commit

Permalink
Update openapi.json, make special case for return id 0 to the Rpc cal…
Browse files Browse the repository at this point in the history
…l - should fix the test also which can not be run otherwise on single node cluster
  • Loading branch information
burmanm committed Aug 17, 2023
1 parent 95cc966 commit 4abdd0b
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
60 changes: 60 additions & 0 deletions management-api-server/doc/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,45 @@
"summary" : "Rebuild data by streaming data from other nodes. This operation returns immediately with a job id."
}
},
"/api/v1/ops/node/repair" : {
"post" : {
"operationId" : "repair_1",
"requestBody" : {
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/RepairRequest"
}
}
}
},
"responses" : {
"202" : {
"content" : {
"text/plain" : {
"example" : "repair-1234567",
"schema" : {
"type" : "string"
}
}
},
"description" : "Job ID for successfully scheduled Cassandra repair request"
},
"400" : {
"content" : {
"text/plain" : {
"example" : "keyspaceName must be specified",
"schema" : {
"type" : "string"
}
}
},
"description" : "Repair request missing Keyspace name"
}
},
"summary" : "Execute a nodetool repair operation"
}
},
"/api/v1/ops/node/schema/versions" : {
"get" : {
"operationId" : "getSchemaVersions",
Expand Down Expand Up @@ -1877,6 +1916,12 @@
"type" : "string",
"enum" : [ "ERROR", "COMPLETED", "WAITING" ]
},
"status_changes" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/StatusChange"
}
},
"submit_time" : {
"type" : "integer",
"format" : "int64"
Expand Down Expand Up @@ -1967,6 +2012,21 @@
},
"required" : [ "check_data", "disable_snapshot", "jobs", "keyspace_name", "reinsert_overflowed_ttl", "skip_corrupted", "tables" ]
},
"StatusChange" : {
"type" : "object",
"properties" : {
"change_time" : {
"type" : "integer",
"format" : "int64"
},
"message" : {
"type" : "string"
},
"status" : {
"type" : "string"
}
}
},
"TakeSnapshotRequest" : {
"type" : "object",
"properties" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.List;

public class Job implements Serializable {
public enum JobStatus {
Expand All @@ -34,20 +35,54 @@ public enum JobStatus {
@JsonProperty(value = "error")
private String error;

public class StatusChange {
@JsonProperty(value = "status")
String status;

@JsonProperty(value = "change_time")
long changeTime;

@JsonProperty(value = "message")
String message;

public StatusChange(String type, String message) {
changeTime = System.currentTimeMillis();
status = type;
this.message = message;
}

public String getStatus() {
return status;
}

public long getChangeTime() {
return changeTime;
}

public String getMessage() {
return message;
}
}

@JsonProperty(value = "status_changes")
private List<StatusChange> statusChanges;

@JsonCreator
public Job(
@JsonProperty(value = "id") String jobId,
@JsonProperty(value = "type") String jobType,
@JsonProperty(value = "status") String status,
@JsonProperty(value = "submit_time") long submitTime,
@JsonProperty(value = "end_time") long finishedTime,
@JsonProperty(value = "error") String error) {
@JsonProperty(value = "error") String error,
@JsonProperty(value = "status_changes") List<StatusChange> changes) {
this.jobId = jobId;
this.jobType = jobType;
this.status = JobStatus.valueOf(status);
this.submitTime = submitTime;
this.finishedTime = finishedTime;
this.error = error;
this.statusChanges = changes;
}

public String getJobId() {
Expand All @@ -70,6 +105,10 @@ public long getFinishedTime() {
return finishedTime;
}

public List<StatusChange> getStatusChanges() {
return statusChanges;
}

public String getError() {
return error;
}
Expand Down

0 comments on commit 4abdd0b

Please sign in to comment.