From 273a6338474c18689d89da5784959abb935aae6a Mon Sep 17 00:00:00 2001 From: sarahcaseybot Date: Wed, 22 Mar 2023 13:56:11 -0400 Subject: [PATCH] Add TTL configs to Registry object (#1968) * Add TTL configs to Registry object * Change A and AAAA records TTL field name --- .../google/registry/model/tld/Registry.java | 50 +++++++++++++++++++ .../sql/schema/db-schema.sql.generated | 3 ++ 2 files changed, 53 insertions(+) diff --git a/core/src/main/java/google/registry/model/tld/Registry.java b/core/src/main/java/google/registry/model/tld/Registry.java index adf295ef6..6a66c2a27 100644 --- a/core/src/main/java/google/registry/model/tld/Registry.java +++ b/core/src/main/java/google/registry/model/tld/Registry.java @@ -275,6 +275,26 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial } } + /** + * The time to live for DNS A and AAAA records. + * + *

When this field is null, the "dnsDefaultATtl" value from the config file will be used. + */ + Duration dnsAPlusAaaaTtl; + + /** + * The time to live for DNS NS records. + * + *

When this field is null, the "dnsDefaultNsTtl" value from the config file will be used. + */ + Duration dnsNsTtl; + + /** + * The time to live for DNS DS records. + * + *

When this field is null, the "dnsDefaultDsTtl" value from the config file will be used. + */ + Duration dnsDsTtl; /** * The unicode-aware representation of the TLD associated with this {@link Registry}. * @@ -647,6 +667,21 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial return numDnsPublishLocks; } + /** Returns the time to live for A and AAAA records. */ + public Duration getDnsAPlusAaaaTtl() { + return dnsAPlusAaaaTtl; + } + + /** Returns the time to live for NS records. */ + public Duration getDnsNsTtl() { + return dnsNsTtl; + } + + /** Returns the time to live for DS records. */ + public Duration getDnsDsTtl() { + return dnsDsTtl; + } + public ImmutableSet getAllowedRegistrantContactIds() { return nullToEmptyImmutableCopy(allowedRegistrantContactIds); } @@ -737,6 +772,21 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial return this; } + public Builder setDnsAPlusAaaaTtl(Duration dnsAPlusAaaaTtl) { + getInstance().dnsAPlusAaaaTtl = dnsAPlusAaaaTtl; + return this; + } + + public Builder setDnsNsAtl(Duration dnsNsAtl) { + getInstance().dnsNsTtl = dnsNsAtl; + return this; + } + + public Builder setDnsDsAtl(Duration dnsDsAtl) { + getInstance().dnsDsTtl = dnsDsAtl; + return this; + } + public Builder setAddGracePeriodLength(Duration addGracePeriodLength) { checkArgument( addGracePeriodLength.isLongerThan(Duration.ZERO), diff --git a/db/src/main/resources/sql/schema/db-schema.sql.generated b/db/src/main/resources/sql/schema/db-schema.sql.generated index ba5924537..c1d5678dc 100644 --- a/db/src/main/resources/sql/schema/db-schema.sql.generated +++ b/db/src/main/resources/sql/schema/db-schema.sql.generated @@ -716,6 +716,9 @@ creation_time timestamptz not null, currency text not null, default_promo_tokens text[], + dns_a_plus_aaaa_ttl interval, + dns_ds_ttl interval, + dns_ns_ttl interval, dns_paused boolean not null, dns_writers text[] not null, drive_folder_id text,