blob: be431a5fd680ef2657943a39f9d66e383ee2d531 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision;
import ai.vespa.validation.PatternedStringWrapper;
import java.util.regex.Pattern;
/**
* A region in a hosted Vespa system.
* A region name must be all lowercase, start with a letter, and contain letters and digits, separated by dashes.
*
* @author jonmv
*/
public class RegionName extends PatternedStringWrapper<RegionName> {
private static final Pattern pattern = Pattern.compile("[a-z]([a-z0-9-]*[a-z0-9])*");
private static final RegionName defaultName = from("default");
private RegionName(String region) {
super(region, pattern, "region name");
}
public static RegionName from(String region) {
return new RegionName(region);
}
public static RegionName defaultName() {
return defaultName;
}
public boolean isDefault() {
return equals(defaultName());
}
}
|