mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Add nomulus tool setter for sunrush add grace period on TLDs
This also cleans up a few miscellaneous code quality issues encountered while adding the new setter: using a cleaner way to conditionally set field values, documenting the format of the add grace period parameters, and improves some code comments and formatting. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=178387731
This commit is contained in:
parent
6bd0fc58de
commit
68a26f5b6e
4 changed files with 69 additions and 73 deletions
|
@ -73,25 +73,31 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
|||
@Nullable
|
||||
@Parameter(
|
||||
names = "--add_grace_period",
|
||||
description = "Length of the add grace period")
|
||||
description = "Length of the add grace period (in ISO 8601 duration format)")
|
||||
Duration addGracePeriod;
|
||||
|
||||
@Nullable
|
||||
@Parameter(
|
||||
names = "--sunrush_add_grace_period",
|
||||
description = "Length of the add grace period during sunrush (in ISO 8601 duration format)")
|
||||
Duration sunrushAddGracePeriod;
|
||||
|
||||
@Nullable
|
||||
@Parameter(
|
||||
names = "--redemption_grace_period",
|
||||
description = "Length of the redemption grace period")
|
||||
description = "Length of the redemption grace period (in ISO 8601 duration format)")
|
||||
Duration redemptionGracePeriod;
|
||||
|
||||
@Nullable
|
||||
@Parameter(
|
||||
names = "--pending_delete_length",
|
||||
description = "Length of the pending delete period")
|
||||
description = "Length of the pending delete period (in ISO 8601 duration format)")
|
||||
Duration pendingDeleteLength;
|
||||
|
||||
@Nullable
|
||||
@Parameter(
|
||||
names = "--automatic_transfer_length",
|
||||
description = "Length of the automatic transfer period")
|
||||
description = "Length of the automatic transfer period (in ISO 8601 duration format)")
|
||||
private Duration automaticTransferLength;
|
||||
|
||||
@Nullable
|
||||
|
@ -321,61 +327,23 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
|||
builder.setEapFeeSchedule(eapFeeSchedule);
|
||||
}
|
||||
|
||||
if (addGracePeriod != null) {
|
||||
builder.setAddGracePeriodLength(addGracePeriod);
|
||||
}
|
||||
|
||||
if (redemptionGracePeriod != null) {
|
||||
builder.setRedemptionGracePeriodLength(redemptionGracePeriod);
|
||||
}
|
||||
|
||||
if (pendingDeleteLength != null) {
|
||||
builder.setPendingDeleteLength(pendingDeleteLength);
|
||||
}
|
||||
|
||||
if (automaticTransferLength != null) {
|
||||
builder.setAutomaticTransferLength(automaticTransferLength);
|
||||
}
|
||||
|
||||
if (driveFolderId != null) {
|
||||
builder.setDriveFolderId(driveFolderId.orElse(null));
|
||||
}
|
||||
|
||||
if (createBillingCost != null) {
|
||||
builder.setCreateBillingCost(createBillingCost);
|
||||
}
|
||||
|
||||
if (restoreBillingCost != null) {
|
||||
builder.setRestoreBillingCost(restoreBillingCost);
|
||||
}
|
||||
|
||||
if (roidSuffix != null) {
|
||||
builder.setRoidSuffix(roidSuffix);
|
||||
}
|
||||
|
||||
if (serverStatusChangeCost != null) {
|
||||
builder.setServerStatusChangeBillingCost(serverStatusChangeCost);
|
||||
}
|
||||
|
||||
if (tldType != null) {
|
||||
builder.setTldType(tldType);
|
||||
}
|
||||
|
||||
if (premiumPriceAckRequired != null) {
|
||||
builder.setPremiumPriceAckRequired(premiumPriceAckRequired);
|
||||
}
|
||||
|
||||
if (lordnUsername != null) {
|
||||
builder.setLordnUsername(lordnUsername.orElse(null));
|
||||
}
|
||||
|
||||
if (claimsPeriodEnd != null) {
|
||||
builder.setClaimsPeriodEnd(claimsPeriodEnd);
|
||||
}
|
||||
|
||||
if (domainCreateRestricted != null) {
|
||||
builder.setDomainCreateRestricted(domainCreateRestricted);
|
||||
}
|
||||
Optional.ofNullable(addGracePeriod).ifPresent(builder::setAddGracePeriodLength);
|
||||
Optional.ofNullable(sunrushAddGracePeriod).ifPresent(builder::setSunrushAddGracePeriodLength);
|
||||
Optional.ofNullable(redemptionGracePeriod).ifPresent(builder::setRedemptionGracePeriodLength);
|
||||
Optional.ofNullable(pendingDeleteLength).ifPresent(builder::setPendingDeleteLength);
|
||||
Optional.ofNullable(automaticTransferLength).ifPresent(builder::setAutomaticTransferLength);
|
||||
Optional.ofNullable(driveFolderId).ifPresent(id -> builder.setDriveFolderId(id.orElse(null)));
|
||||
Optional.ofNullable(createBillingCost).ifPresent(builder::setCreateBillingCost);
|
||||
Optional.ofNullable(restoreBillingCost).ifPresent(builder::setRestoreBillingCost);
|
||||
Optional.ofNullable(roidSuffix).ifPresent(builder::setRoidSuffix);
|
||||
Optional.ofNullable(serverStatusChangeCost)
|
||||
.ifPresent(builder::setServerStatusChangeBillingCost);
|
||||
Optional.ofNullable(tldType).ifPresent(builder::setTldType);
|
||||
Optional.ofNullable(premiumPriceAckRequired).ifPresent(builder::setPremiumPriceAckRequired);
|
||||
Optional.ofNullable(lordnUsername).ifPresent(u -> builder.setLordnUsername(u.orElse(null)));
|
||||
Optional.ofNullable(claimsPeriodEnd).ifPresent(builder::setClaimsPeriodEnd);
|
||||
Optional.ofNullable(domainCreateRestricted).ifPresent(builder::setDomainCreateRestricted);
|
||||
Optional.ofNullable(lrpPeriod).ifPresent(p -> builder.setLrpPeriod(p.orElse(null)));
|
||||
|
||||
if (premiumListName != null) {
|
||||
if (premiumListName.isPresent()) {
|
||||
|
@ -399,10 +367,6 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
|||
builder.setDnsWriters(dnsWritersSet);
|
||||
}
|
||||
|
||||
if (lrpPeriod != null) {
|
||||
builder.setLrpPeriod(lrpPeriod.orElse(null));
|
||||
}
|
||||
|
||||
ImmutableSet<String> newReservedListNames = getReservedLists(oldRegistry);
|
||||
checkReservedListValidityForTld(tld, newReservedListNames);
|
||||
builder.setReservedListsByName(newReservedListNames);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue