diff --git a/perspective-aws/src/main/java/org/meridor/perspective/aws/Api.java b/perspective-aws/src/main/java/org/meridor/perspective/aws/Api.java index 8d80fc1f..4a25f823 100644 --- a/perspective-aws/src/main/java/org/meridor/perspective/aws/Api.java +++ b/perspective-aws/src/main/java/org/meridor/perspective/aws/Api.java @@ -4,8 +4,6 @@ public interface Api { boolean rebootInstance(String instanceId); - boolean hardRebootInstance(String instanceId); - boolean startInstance(String instanceId); boolean shutdownInstance(String instanceId); diff --git a/perspective-aws/src/main/java/org/meridor/perspective/aws/ApiProviderImpl.java b/perspective-aws/src/main/java/org/meridor/perspective/aws/ApiProviderImpl.java index 48b7469a..43e911f2 100644 --- a/perspective-aws/src/main/java/org/meridor/perspective/aws/ApiProviderImpl.java +++ b/perspective-aws/src/main/java/org/meridor/perspective/aws/ApiProviderImpl.java @@ -71,12 +71,6 @@ public boolean rebootInstance(String instanceId) { return isResponseSuccessful(client.rebootInstances(request)); } - @Override - public boolean hardRebootInstance(String instanceId) { - //TODO: to be implemented!!! - throw new UnsupportedOperationException(); - } - @Override public boolean startInstance(String instanceId) { StartInstancesRequest request = new StartInstancesRequest(Collections.singletonList(instanceId)); diff --git a/perspective-aws/src/main/java/org/meridor/perspective/aws/RebootInstanceOperation.java b/perspective-aws/src/main/java/org/meridor/perspective/aws/RebootInstanceOperation.java index a2f6a730..6ed80864 100644 --- a/perspective-aws/src/main/java/org/meridor/perspective/aws/RebootInstanceOperation.java +++ b/perspective-aws/src/main/java/org/meridor/perspective/aws/RebootInstanceOperation.java @@ -6,6 +6,7 @@ import java.util.function.BiFunction; +import static org.meridor.perspective.config.OperationType.HARD_REBOOT_INSTANCE; import static org.meridor.perspective.config.OperationType.REBOOT_INSTANCE; @Component @@ -34,6 +35,7 @@ protected String getErrorMessage(Instance instance) { @Override public OperationType[] getTypes() { - return new OperationType[]{REBOOT_INSTANCE}; + //AWS tries to reboot instance then in 4 minutes hard-reboots automatically + return new OperationType[]{REBOOT_INSTANCE, HARD_REBOOT_INSTANCE}; } }