Add REMOVING router status and update transitions
This commit is contained in:
@@ -74,7 +74,7 @@ public class RouterController {
|
||||
result.stdout()
|
||||
);
|
||||
|
||||
service.forceStatus(id, RouterStatus.PROVISIONED);
|
||||
service.forceStatus(id, RouterStatus.REMOVING);
|
||||
|
||||
return DeploymentResponse.from(finishedDeployment);
|
||||
} catch (Exception exception) {
|
||||
|
||||
@@ -69,9 +69,18 @@ public class RouterService {
|
||||
|
||||
private boolean isValidTransition(RouterStatus current, RouterStatus next) {
|
||||
return switch (current) {
|
||||
case PENDING, FAILED -> next == RouterStatus.PROVISIONING || next == RouterStatus.REMOVED;
|
||||
case PROVISIONING -> next == RouterStatus.PROVISIONED || next == RouterStatus.FAILED;
|
||||
case PROVISIONED -> next == RouterStatus.REMOVED;
|
||||
case PENDING, FAILED ->
|
||||
next == RouterStatus.PROVISIONING || next == RouterStatus.REMOVING;
|
||||
|
||||
case PROVISIONING ->
|
||||
next == RouterStatus.PROVISIONED || next == RouterStatus.FAILED;
|
||||
|
||||
case PROVISIONED ->
|
||||
next == RouterStatus.REMOVING;
|
||||
|
||||
case REMOVING ->
|
||||
next == RouterStatus.REMOVED || next == RouterStatus.FAILED;
|
||||
|
||||
case REMOVED -> false;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@ public enum RouterStatus {
|
||||
PROVISIONING,
|
||||
PROVISIONED,
|
||||
FAILED,
|
||||
REMOVING,
|
||||
REMOVED
|
||||
}
|
||||
Reference in New Issue
Block a user