org.meridor.perspective.openstack.PauseInstanceOperation Maven / Gradle / Ivy
package org.meridor.perspective.openstack;
import org.meridor.perspective.beans.Instance;
import org.meridor.perspective.config.OperationType;
import org.springframework.stereotype.Component;
import java.util.function.BiFunction;
import static org.meridor.perspective.config.OperationType.PAUSE_INSTANCE;
@Component
public class PauseInstanceOperation extends BaseInstanceOperation {
@Override
protected BiFunction getAction() {
return (api, instance) -> api.pauseInstance(instance.getRealId());
}
@Override
protected String getSuccessMessage(Instance instance) {
return String.format("Paused instance %s (%s)", instance.getName(), instance.getId());
}
@Override
protected String getErrorMessage(Instance instance) {
return String.format("Failed to pause instance %s (%s)", instance.getName(), instance.getId());
}
@Override
public OperationType[] getTypes() {
return new OperationType[]{PAUSE_INSTANCE};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy