Add necessary fields to the AllocationToken schema

See https://docs.google.com/document/d/1SSWrILRpx0Mtr4sdvlYwz9I8wJp5Gu_o4qlml3iJDKI

This is just the base for now--we don't actually do anything with it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=243265164
This commit is contained in:
gbrodman 2019-04-12 08:05:56 -07:00 committed by Ben McIlwain
parent 3b87d4de64
commit 63807aa9be
11 changed files with 356 additions and 31 deletions

View file

@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.collect.Queues.newArrayDeque;
import static com.google.common.collect.Sets.difference;
import static google.registry.model.domain.token.AllocationToken.TokenType.SINGLE_USE;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.StringGenerator.DEFAULT_PASSWORD_LENGTH;
import static java.nio.charset.StandardCharsets.UTF_8;
@ -117,6 +118,8 @@ class GenerateAllocationTokensCommand implements CommandWithRemoteApi {
.map(
t -> {
AllocationToken.Builder token = new AllocationToken.Builder().setToken(t);
// TODO(b/129471448): allow this to be unlimited-use as well
token.setTokenType(SINGLE_USE);
if (domainNames != null) {
token.setDomainName(domainNames.removeFirst());
}