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

import ai.vespa.validation.PatternedStringWrapper;

import java.util.regex.Pattern;

/**
 * A token id to be used in dataplane tokens
 */
public class TokenId extends PatternedStringWrapper<TokenId> {

    static final Pattern namePattern = Pattern.compile("[A-Za-z][A-Za-z0-9_-]{0,59}");

    private TokenId(String name) {
        super(name, namePattern, "tokenId");
    }

    public static TokenId of(String value) {
        return new TokenId(value);
    }

}