aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/configserver/Environment.java
blob: f1c721a07753574a10fdf50b2509ff2b420ba5dc (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.configserver;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Environment representation using the same definition as configserver. And allowing
 * serialization/deserialization to/from JSON.
 *
 * @author Ulf Lilleengen
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class Environment {
    private final com.yahoo.config.provision.Environment environment;

    public Environment(com.yahoo.config.provision.Environment environment) {
        this.environment = environment;
    }

    @JsonValue
    public String value() {
        return environment.value();
    }

    @Override
    public String toString() {
        return value();
    }

    public com.yahoo.config.provision.Environment getEnvironment() {
        return environment;
    }

    public Environment(String environment) {
        this.environment = com.yahoo.config.provision.Environment.from(environment);
    }
}