use of com.netflix.titus.api.relocation.model.event.TaskRelocationPlanRemovedEvent in project titus-control-plane by Netflix.
the class RelocationGrpcModelConverters method toGrpcRelocationEvent.
public static Optional<RelocationEvent> toGrpcRelocationEvent(TaskRelocationEvent coreEvent) {
RelocationEvent grpcEvent = null;
if (coreEvent.equals(TaskRelocationEvent.newSnapshotEndEvent())) {
grpcEvent = RelocationEvent.newBuilder().setSnapshotEnd(RelocationEvent.SnapshotEnd.getDefaultInstance()).build();
} else if (coreEvent instanceof TaskRelocationPlanUpdateEvent) {
TaskRelocationPlanUpdateEvent updateEvent = (TaskRelocationPlanUpdateEvent) coreEvent;
grpcEvent = RelocationEvent.newBuilder().setTaskRelocationPlanUpdateEvent(RelocationEvent.TaskRelocationPlanUpdateEvent.newBuilder().setPlan(toGrpcTaskRelocationPlan(updateEvent.getPlan()))).build();
} else if (coreEvent instanceof TaskRelocationPlanRemovedEvent) {
TaskRelocationPlanRemovedEvent removedEvent = (TaskRelocationPlanRemovedEvent) coreEvent;
grpcEvent = RelocationEvent.newBuilder().setTaskRelocationPlanRemoveEvent(RelocationEvent.TaskRelocationPlanRemoveEvent.newBuilder().setTaskId(removedEvent.getTaskId())).build();
}
return Optional.ofNullable(grpcEvent);
}
Aggregations