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

org.meridor.perspective.openstack.SuspendInstanceOperation 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.SUSPEND_INSTANCE;

@Component
public class SuspendInstanceOperation extends BaseInstanceOperation {

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy