blob: 125a54e6fd9b851e0eb2a3e82f2f1a61b7e23b5a (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.security.tls;
import java.util.Arrays;
/**
* @author bjorncs
*/
public enum CapabilityMode {
DISABLE("disable"), LOG_ONLY("log_only"), ENFORCE("enforce");
private final String configValue;
CapabilityMode(String configValue) { this.configValue = configValue; }
public String configValue() { return configValue; }
/** @return Default value when mode is not explicitly specified */
public static CapabilityMode defaultValue() { return DISABLE; }
public static CapabilityMode fromConfigValue(String configValue) {
return Arrays.stream(values())
.filter(c -> c.configValue.equals(configValue))
.findFirst().orElseThrow(() -> new IllegalArgumentException("Unknown value: " + configValue));
}
}
|