Search in sources :

Example 1 with PodResource

use of com.mesosphere.sdk.http.endpoints.PodResource in project dcos-commons by mesosphere.

the class Send method replacePod.

/**
 * Initiates the replacement of a pod through a call to {@link PodResource#replacePod(String)}.
 */
public static Send replacePod(String podName) {
    return new Send() {

        @Override
        public void send(ClusterState state, SchedulerDriver mockDriver, Scheduler scheduler) {
            PodResource r = (PodResource) state.getResources().stream().filter(resource -> resource instanceof PodResource).findAny().get();
            r.replace(podName);
        }

        @Override
        public String getDescription() {
            return String.format("Replace pod: %s", podName);
        }
    };
}
Also used : Protos(org.apache.mesos.Protos) SchedulerDriver(org.apache.mesos.SchedulerDriver) Arrays(java.util.Arrays) Scheduler(org.apache.mesos.Scheduler) PodResource(com.mesosphere.sdk.http.endpoints.PodResource) PodResource(com.mesosphere.sdk.http.endpoints.PodResource) Scheduler(org.apache.mesos.Scheduler) SchedulerDriver(org.apache.mesos.SchedulerDriver)

Aggregations

PodResource (com.mesosphere.sdk.http.endpoints.PodResource)1 Arrays (java.util.Arrays)1 Protos (org.apache.mesos.Protos)1 Scheduler (org.apache.mesos.Scheduler)1 SchedulerDriver (org.apache.mesos.SchedulerDriver)1