use of com.sequenceiq.it.spark.spi.CloudVmInstanceStatuses in project cloudbreak by hortonworks.
the class ScalingMock method addSPIEndpoints.
public void addSPIEndpoints() {
Service sparkService = getSparkService();
Map<String, CloudVmMetaDataStatus> instanceMap = getInstanceMap();
sparkService.post(MOCK_ROOT + "/cloud_metadata_statuses", new CloudMetaDataStatuses(instanceMap), gson()::toJson);
sparkService.post(MOCK_ROOT + "/cloud_instance_statuses", new CloudVmInstanceStatuses(instanceMap), gson()::toJson);
sparkService.post(MOCK_ROOT + "/terminate_instances", (request, response) -> {
List<CloudInstance> cloudInstances = new Gson().fromJson(request.body(), new TypeToken<List<CloudInstance>>() {
}.getType());
cloudInstances.forEach(cloudInstance -> terminateInstance(instanceMap, cloudInstance.getInstanceId()));
return null;
}, gson()::toJson);
}
Aggregations