All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.meridor.perspective.openstack.UnpauseInstanceOperation Maven / Gradle / Ivy

There is a newer version: 1.3.4.1
Show newest version
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.UNPAUSE_INSTANCE;

@Component
public class UnpauseInstanceOperation extends BaseInstanceOperation {

    @Override
    protected BiFunction getAction() {
        return (api, instance) -> api.unpauseInstance(instance.getRealId());
    }

    @Override
    protected String getSuccessMessage(Instance instance) {
        return String.format("Unpaused instance %s (%s)", instance.getName(), instance.getId());
    }

    @Override
    protected String getErrorMessage(Instance instance) {
        return String.format("Failed to unpause instance %s (%s)", instance.getName(), instance.getId());
    }

    @Override
    public OperationType[] getTypes() {
        return new OperationType[]{UNPAUSE_INSTANCE};
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy