blob: c7b2b84ca58ba2b11aba53574a665fc8e4599ab2 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision;
/**
* Environments in hosted Vespa.
*
* @author bratseth
* @since 5.11
*/
public enum Environment {
/** The environment in which any external or internal applications serve actual requests */
prod,
/** Production-like environment which runs staging tests before an app is deployed to production */
staging,
/** Environment for running system tests before an app is deployed to staging */
test,
/** Environment used by individual developers to experiment */
dev,
/** Environment used to run performance and stability experiments */
perf;
/** Returns whether deployments to this environment are done manually */
public boolean isManuallyDeployed() { return this == dev || this == perf; }
/** Returns the prod environment. This is useful for non-hosted properties where we just need any consistent value */
public static Environment defaultEnvironment() { return prod; }
/** Returns the environment name from the string value returned by value() */
public static Environment from(String value) {
switch(value) {
case "prod" : return prod;
case "staging" : return staging;
case "test" : return test;
case "dev" : return dev;
case "perf" : return perf;
default : throw new IllegalStateException("'" + value + "' is not a valid environment identifier");
}
}
/** Returns a name of this which is used in external API's and stored in persistent stores */
public String value() {
switch(this) {
case prod : return "prod";
case staging : return "staging";
case test : return "test";
case dev : return "dev";
case perf : return "perf";
default : throw new IllegalStateException();
}
}
}
|