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

io.pivotal.services.plugin.tasks.CfAppStartTask Maven / Gradle / Ivy

There is a newer version: 2.3.0-rc.6
Show newest version
package io.pivotal.services.plugin.tasks;

import io.pivotal.services.plugin.CfProperties;
import org.cloudfoundry.operations.CloudFoundryOperations;
import org.cloudfoundry.operations.applications.StartApplicationRequest;
import org.gradle.api.tasks.TaskAction;
import reactor.core.publisher.Mono;

import java.time.Duration;

/**
 * Responsible for starting an app
 *
 * @author Biju Kunjummen
 */
public class CfAppStartTask extends AbstractCfTask {

    @TaskAction
    public void startApp() {

        CloudFoundryOperations cfOperations = getCfOperations();
        CfProperties cfProperties = getCfProperties();

        Mono resp = cfOperations.applications()
            .start(StartApplicationRequest.builder().name(cfProperties.name()).build());

        resp.block(Duration.ofMillis(defaultWaitTimeout));
    }

    @Override
    public String getDescription() {
        return "Start an Application";
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy