use of com.cloud.api.response.SnapshotResponse in project cosmic by MissionCriticalCloud.
the class ListSnapshotsCmd method execute.
@Override
public void execute() {
final Pair<List<? extends Snapshot>, Integer> result = _snapshotService.listSnapshots(this);
final ListResponse<SnapshotResponse> response = new ListResponse<>();
final List<SnapshotResponse> snapshotResponses = new ArrayList<>();
for (final Snapshot snapshot : result.first()) {
final SnapshotResponse snapshotResponse = _responseGenerator.createSnapshotResponse(snapshot);
snapshotResponse.setObjectName("snapshot");
snapshotResponses.add(snapshotResponse);
}
response.setResponses(snapshotResponses, result.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of com.cloud.api.response.SnapshotResponse in project cosmic by MissionCriticalCloud.
the class RevertSnapshotCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("Snapshot Id: " + getId());
final Snapshot snapshot = _snapshotService.revertSnapshot(getId());
if (snapshot != null) {
final SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revert snapshot");
}
}
Aggregations