mirror of
https://github.com/google/nomulus.git
synced 2025-04-29 19:47:51 +02:00
Add tool commands to modify TTLs on a TLD (#1985)
* Add tool commands to modify TTLs on a TLD * Small changes * Add an example to the parameter description
This commit is contained in:
parent
d02b617e0f
commit
e18dba472b
4 changed files with 54 additions and 4 deletions
|
@ -785,13 +785,13 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setDnsNsAtl(Duration dnsNsAtl) {
|
||||
getInstance().dnsNsTtl = dnsNsAtl;
|
||||
public Builder setDnsNsTtl(Duration dnsNsTtl) {
|
||||
getInstance().dnsNsTtl = dnsNsTtl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDnsDsAtl(Duration dnsDsAtl) {
|
||||
getInstance().dnsDsTtl = dnsDsAtl;
|
||||
public Builder setDnsDsTtl(Duration dnsDsTtl) {
|
||||
getInstance().dnsDsTtl = dnsDsTtl;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -237,6 +237,24 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
|||
)
|
||||
Integer numDnsPublishShards;
|
||||
|
||||
@Nullable
|
||||
@Parameter(
|
||||
names = {"--dns_a_plus_aaaa_ttl"},
|
||||
description = "The time to live for DNS A and AAAA records (Ex: PT240S)")
|
||||
Duration dnsAPlusAaaaTtl;
|
||||
|
||||
@Nullable
|
||||
@Parameter(
|
||||
names = {"--dns_ns_ttl"},
|
||||
description = "The time to live for DNS NS records (Ex: PT240S)")
|
||||
Duration dnsNsTtl;
|
||||
|
||||
@Nullable
|
||||
@Parameter(
|
||||
names = {"--dns_ds_ttl"},
|
||||
description = "The time to live for DNS DS records (Ex: PT240S)")
|
||||
Duration dnsDsTtl;
|
||||
|
||||
@Nullable
|
||||
@Parameter(
|
||||
names = "--default_tokens",
|
||||
|
@ -364,6 +382,9 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
|||
Optional.ofNullable(lordnUsername).ifPresent(u -> builder.setLordnUsername(u.orElse(null)));
|
||||
Optional.ofNullable(claimsPeriodEnd).ifPresent(builder::setClaimsPeriodEnd);
|
||||
Optional.ofNullable(numDnsPublishShards).ifPresent(builder::setNumDnsPublishLocks);
|
||||
Optional.ofNullable(dnsAPlusAaaaTtl).ifPresent(builder::setDnsAPlusAaaaTtl);
|
||||
Optional.ofNullable(dnsNsTtl).ifPresent(builder::setDnsNsTtl);
|
||||
Optional.ofNullable(dnsDsTtl).ifPresent(builder::setDnsDsTtl);
|
||||
|
||||
if (premiumListName != null) {
|
||||
if (premiumListName.isPresent()) {
|
||||
|
|
|
@ -76,6 +76,22 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
.isEqualTo(Registry.DEFAULT_REGISTRY_LOCK_OR_UNLOCK_BILLING_COST);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_ttls() throws Exception {
|
||||
runCommandForced(
|
||||
"xn--q9jyb4c",
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=FooDnsWriter",
|
||||
"--dns_a_plus_aaaa_ttl=PT300S",
|
||||
"--dns_ds_ttl=PT240S",
|
||||
"--dns_ns_ttl=PT180S");
|
||||
Registry registry = Registry.get("xn--q9jyb4c");
|
||||
assertThat(registry).isNotNull();
|
||||
assertThat(registry.getDnsAPlusAaaaTtl()).isEqualTo(standardMinutes(5));
|
||||
assertThat(registry.getDnsDsTtl()).isEqualTo(standardMinutes(4));
|
||||
assertThat(registry.getDnsNsTtl()).isEqualTo(standardMinutes(3));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_multipleArguments() {
|
||||
IllegalArgumentException thrown =
|
||||
|
|
|
@ -1095,6 +1095,19 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
assertThat(thrown).hasMessageThat().contains("The premium list 'phonies' doesn't exist");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setTtls() throws Exception {
|
||||
runCommandForced(
|
||||
"--dns_a_plus_aaaa_ttl=PT300S",
|
||||
"--dns_ds_ttl=PT240S",
|
||||
"--dns_ns_ttl=PT180S",
|
||||
"xn--q9jyb4c");
|
||||
Registry registry = Registry.get("xn--q9jyb4c");
|
||||
assertThat(registry.getDnsAPlusAaaaTtl()).isEqualTo(standardMinutes(5));
|
||||
assertThat(registry.getDnsDsTtl()).isEqualTo(standardMinutes(4));
|
||||
assertThat(registry.getDnsNsTtl()).isEqualTo(standardMinutes(3));
|
||||
}
|
||||
|
||||
private void runSuccessfulReservedListsTest(String reservedLists) throws Exception {
|
||||
runCommandForced("--reserved_lists", reservedLists, "xn--q9jyb4c");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue