Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c3708f9faacfa8592026e76f63014ed0c8b1033f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*******************************************************************************
 * Copyright (c) 2015, 2018 Red Hat.
 * 
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     Red Hat - Initial Contribution
 *******************************************************************************/
package org.eclipse.linuxtools.vagrant.core;

public enum EnumVMStatus {

	SHUTOFF, RUNNING, PAUSED, UNKNOWN;

	public static EnumVMStatus fromStatusMessage(final String status) {
		if (status.equals("shutoff") //$NON-NLS-1$
				|| status.equals("poweroff")) { //$NON-NLS-1$
			return SHUTOFF;
		} else if (status.startsWith("pause")) { //$NON-NLS-1$
			return PAUSED;
		} else if (status.startsWith("running")) { //$NON-NLS-1$
			return RUNNING;
		}
		return UNKNOWN;
	}
}

Back to the top