Skip to content

Commit 3f86690

Browse files
committed
Add getClusterName endpoint, add currentStreams DTO for reloadLocalSchema (#346)
* Add currentStreams DTO * add cluster name into endpoints response
1 parent a80428f commit 3f86690

File tree

14 files changed

+332
-228
lines changed

14 files changed

+332
-228
lines changed

management-api-agent-3.x/src/main/java/com/datastax/mgmtapi/shim/CassandraAPI3x.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ public List<Map<String, String>> getEndpointStates() {
221221
states.put("ENDPOINT_IP", entry.getKey().getHostAddress());
222222
states.put("IS_ALIVE", Boolean.toString(entry.getValue().isAlive()));
223223
states.put("PARTITIONER", partitioner.getClass().getName());
224+
states.put("CLUSTER_NAME", getStorageService().getClusterName());
224225

225226
result.add(states);
226227
}

management-api-agent-4.1.x/src/main/java/com/datastax/mgmtapi/shim/CassandraAPI41x.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ public List<Map<String, String>> getEndpointStates() {
255255
states.put("ENDPOINT_IP", endpoint.getHostAddress(false));
256256
states.put("IS_ALIVE", Boolean.toString(state.isAlive()));
257257
states.put("PARTITIONER", partitioner.getClass().getName());
258+
states.put("CLUSTER_NAME", getStorageService().getClusterName());
258259
result.add(states);
259260
}
260261

management-api-agent-4.x/src/main/java/com/datastax/mgmtapi/shim/CassandraAPI4x.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ public List<Map<String, String>> getEndpointStates() {
255255
states.put("ENDPOINT_IP", endpoint.address.getHostAddress());
256256
states.put("IS_ALIVE", Boolean.toString(state.isAlive()));
257257
states.put("PARTITIONER", partitioner.getClass().getName());
258+
states.put("CLUSTER_NAME", getStorageService().getClusterName());
258259
result.add(states);
259260
}
260261

management-api-agent-5.0.x/src/main/java/com/datastax/mgmtapi/shim/CassandraAPI50x.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ public List<Map<String, String>> getEndpointStates() {
255255
states.put("ENDPOINT_IP", endpoint.getHostAddress(false));
256256
states.put("IS_ALIVE", Boolean.toString(state.isAlive()));
257257
states.put("PARTITIONER", partitioner.getClass().getName());
258+
states.put("CLUSTER_NAME", getStorageService().getClusterName());
258259
result.add(states);
259260
}
260261

management-api-agent-dse-6.8/src/main/java/com/datastax/mgmtapi/shim/DseAPI68.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ public List<Map<String, String>> getEndpointStates() {
229229
states.put("ENDPOINT_IP", endpoint.getHostAddress());
230230
states.put("IS_ALIVE", Boolean.toString(state.isAlive()));
231231
states.put("PARTITIONER", partitioner.getClass().getName());
232+
states.put("CLUSTER_NAME", getStorageService().getClusterName());
232233
result.add(states);
233234
}
234235

management-api-agent-dse7/src/main/java/com/datastax/mgmtapi/shim/CassandraAPIDse7.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ public List<Map<String, String>> getEndpointStates() {
255255
states.put("ENDPOINT_IP", endpoint.address.getHostAddress());
256256
states.put("IS_ALIVE", Boolean.toString(state.isAlive()));
257257
states.put("PARTITIONER", partitioner.getClass().getName());
258+
states.put("CLUSTER_NAME", getStorageService().getClusterName());
258259
result.add(states);
259260
}
260261

management-api-server/doc/openapi.json

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274
}
275275
}
276276
},
277-
"description" : "Cassandra version'"
277+
"description" : "Cassandra version"
278278
}
279279
},
280280
"summary" : "Returns the Cassandra release version"
@@ -1103,33 +1103,8 @@
11031103
"200" : {
11041104
"content" : {
11051105
"application/json" : {
1106-
"example" : {
1107-
"entity" : [ ],
1108-
"variant" : {
1109-
"language" : null,
1110-
"mediaType" : {
1111-
"type" : "application",
1112-
"subtype" : "json",
1113-
"parameters" : { },
1114-
"wildcardType" : false,
1115-
"wildcardSubtype" : false
1116-
},
1117-
"encoding" : null,
1118-
"languageString" : null
1119-
},
1120-
"annotations" : [ ],
1121-
"mediaType" : {
1122-
"type" : "application",
1123-
"subtype" : "json",
1124-
"parameters" : { },
1125-
"wildcardType" : false,
1126-
"wildcardSubtype" : false
1127-
},
1128-
"language" : null,
1129-
"encoding" : null
1130-
},
11311106
"schema" : {
1132-
"type" : "string"
1107+
"$ref" : "#/components/schemas/StreamingInfo"
11331108
}
11341109
}
11351110
},
@@ -1980,6 +1955,45 @@
19801955
},
19811956
"required" : [ "check_data", "disable_snapshot", "jobs", "keyspace_name", "reinsert_overflowed_ttl", "skip_corrupted", "tables" ]
19821957
},
1958+
"StreamingInfo" : {
1959+
"type" : "object",
1960+
"properties" : {
1961+
"annotations" : {
1962+
"type" : "array",
1963+
"items" : {
1964+
"type" : "string"
1965+
}
1966+
},
1967+
"encoding" : {
1968+
"type" : "string"
1969+
},
1970+
"entity" : {
1971+
"type" : "array",
1972+
"items" : {
1973+
"type" : "object",
1974+
"additionalProperties" : {
1975+
"type" : "array",
1976+
"items" : {
1977+
"type" : "object",
1978+
"additionalProperties" : {
1979+
"type" : "string"
1980+
}
1981+
}
1982+
}
1983+
}
1984+
},
1985+
"language" : {
1986+
"type" : "string"
1987+
},
1988+
"mediaType" : {
1989+
"$ref" : "#/components/schemas/MediaType"
1990+
},
1991+
"variant" : {
1992+
"$ref" : "#/components/schemas/Variant"
1993+
}
1994+
},
1995+
"required" : [ "entity" ]
1996+
},
19831997
"TakeSnapshotRequest" : {
19841998
"type" : "object",
19851999
"properties" : {

management-api-server/src/main/java/com/datastax/mgmtapi/resources/MetadataResources.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public MetadataResources(ManagementApplication application) {
3535
@Produces(MediaType.TEXT_PLAIN)
3636
@ApiResponse(
3737
responseCode = "200",
38-
description = "Cassandra version'",
38+
description = "Cassandra version",
3939
content =
4040
@Content(
4141
mediaType = MediaType.TEXT_PLAIN,

management-api-server/src/main/java/com/datastax/mgmtapi/resources/NodeOpsResources.java

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.datastax.mgmtapi.resources.common.BaseResources;
1212
import com.datastax.mgmtapi.resources.helpers.ResponseTools;
1313
import com.datastax.mgmtapi.resources.models.RepairRequest;
14+
import com.datastax.mgmtapi.resources.models.StreamingInfo;
1415
import com.datastax.mgmtapi.resources.models.TakeSnapshotRequest;
1516
import com.datastax.oss.driver.api.core.cql.Row;
1617
import com.google.common.collect.ImmutableList;
@@ -329,8 +330,7 @@ public Response reloadLocalSchema() {
329330
content =
330331
@Content(
331332
mediaType = MediaType.APPLICATION_JSON,
332-
schema = @Schema(implementation = String.class),
333-
examples = @ExampleObject(value = STREAMING_INFO_RESPONSE_EXAMPLE)))
333+
schema = @Schema(implementation = StreamingInfo.class)))
334334
@Operation(summary = "Retrieve Streaming status information", operationId = "getStreamInfo")
335335
public Response getStreamInfo() {
336336
return handle(
@@ -609,33 +609,6 @@ public Response move(@QueryParam(value = "newToken") String newToken) {
609609
});
610610
}
611611

612-
private static final String STREAMING_INFO_RESPONSE_EXAMPLE =
613-
"{\n"
614-
+ " \"entity\": [],\n"
615-
+ " \"variant\": {\n"
616-
+ " \"language\": null,\n"
617-
+ " \"mediaType\": {\n"
618-
+ " \"type\": \"application\",\n"
619-
+ " \"subtype\": \"json\",\n"
620-
+ " \"parameters\": {},\n"
621-
+ " \"wildcardType\": false,\n"
622-
+ " \"wildcardSubtype\": false\n"
623-
+ " },\n"
624-
+ " \"encoding\": null,\n"
625-
+ " \"languageString\": null\n"
626-
+ " },\n"
627-
+ " \"annotations\": [],\n"
628-
+ " \"mediaType\": {\n"
629-
+ " \"type\": \"application\",\n"
630-
+ " \"subtype\": \"json\",\n"
631-
+ " \"parameters\": {},\n"
632-
+ " \"wildcardType\": false,\n"
633-
+ " \"wildcardSubtype\": false\n"
634-
+ " },\n"
635-
+ " \"language\": null,\n"
636-
+ " \"encoding\": null\n"
637-
+ "}";
638-
639612
private static final String SNAPSHOT_DETAILS_RESPONSE_EXAMPLE =
640613
"{\n"
641614
+ " \"entity\": [\n"

0 commit comments

Comments
 (0)