mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Add --set_current_tld_state to UpdateTldCommand
This feature would have been useful earlier when I was changing the TLD state on a sandbox TLD on-the-fly for testing purposes. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=128088578
This commit is contained in:
parent
e82a40a2fb
commit
a3cade3e20
8 changed files with 147 additions and 7 deletions
|
@ -22,14 +22,18 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
|||
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.registry.Registry.TldState;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Command to create a TLD. */
|
||||
@Parameters(separators = " =", commandDescription = "Create new TLD(s)")
|
||||
|
@ -52,9 +56,6 @@ class CreateTldCommand extends CreateOrUpdateTldCommand {
|
|||
protected void initTldCommand() throws Exception {
|
||||
checkArgument(initialTldState == null || tldStateTransitions.isEmpty(),
|
||||
"Don't pass both --initial_tld_state and --tld_state_transitions");
|
||||
if (initialTldState != null) {
|
||||
tldStateTransitions = ImmutableSortedMap.of(START_OF_TIME, initialTldState);
|
||||
}
|
||||
checkArgument(initialRenewBillingCost == null || renewBillingCostTransitions.isEmpty(),
|
||||
"Don't pass both --initial_renew_billing_cost and --renew_billing_cost_transitions");
|
||||
if (initialRenewBillingCost != null) {
|
||||
|
@ -78,7 +79,7 @@ class CreateTldCommand extends CreateOrUpdateTldCommand {
|
|||
|
||||
// If this is a non-default currency and the user hasn't specified an EAP fee schedule, set the
|
||||
// EAP fee schedule to a matching currency.
|
||||
if (currency != Registry.DEFAULT_CURRENCY && eapFeeSchedule.isEmpty()) {
|
||||
if (!currency.equals(Registry.DEFAULT_CURRENCY) && eapFeeSchedule.isEmpty()) {
|
||||
builder.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(currency)));
|
||||
}
|
||||
}
|
||||
|
@ -103,4 +104,11 @@ class CreateTldCommand extends CreateOrUpdateTldCommand {
|
|||
ImmutableSet<String> getReservedLists(Registry oldRegistry) {
|
||||
return ImmutableSet.copyOf(nullToEmpty(reservedListNames));
|
||||
}
|
||||
|
||||
@Override
|
||||
Optional<Map.Entry<DateTime, TldState>> getTldStateTransitionToAdd() {
|
||||
return initialTldState != null
|
||||
? Optional.of(Maps.immutableEntry(START_OF_TIME, initialTldState))
|
||||
: Optional.<Map.Entry<DateTime, TldState>>absent();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue