mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Add RDAP warning when domain searches by nameserver may be incomplete
When searching for domains by nameserver name or IP address, we fetch the matching nameserver keys, then search for domains by those keys. We limit the number of nameserver keys returned, to avoid arbitrarily large domain queries. This CL adds a warning to the RDAP response if we retrieved the maximum number of nameservers. This may indicate that we have not found all the domains. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=168885124
This commit is contained in:
parent
7dc1940cdb
commit
1bb655267c
7 changed files with 266 additions and 43 deletions
|
@ -14,31 +14,61 @@
|
|||
|
||||
package google.registry.rdap;
|
||||
|
||||
import static google.registry.rdap.RdapIcannStandardInformation.POSSIBLY_INCOMPLETE_NOTICES;
|
||||
import static google.registry.rdap.RdapIcannStandardInformation.TRUNCATION_NOTICES;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* Holds domain, nameserver and entity search results.
|
||||
*
|
||||
*
|
||||
* <p>We need to know not only the list of things we found, but also whether the result set was
|
||||
* truncated to the limit. If it is, we must add the ICANN-mandated notice to that effect.
|
||||
*/
|
||||
@AutoValue
|
||||
abstract class RdapSearchResults {
|
||||
|
||||
static RdapSearchResults create(ImmutableList<ImmutableMap<String, Object>> jsonList) {
|
||||
return create(jsonList, false);
|
||||
|
||||
enum IncompletenessWarningType {
|
||||
|
||||
/** Result set is complete. */
|
||||
NONE,
|
||||
|
||||
/** Result set has been limited to the maximum size. */
|
||||
TRUNCATED,
|
||||
|
||||
/**
|
||||
* Result set might be missing data because the first step of a two-step query returned a data
|
||||
* set that was limited in size.
|
||||
*/
|
||||
MIGHT_BE_INCOMPLETE
|
||||
}
|
||||
|
||||
|
||||
static RdapSearchResults create(ImmutableList<ImmutableMap<String, Object>> jsonList) {
|
||||
return create(jsonList, IncompletenessWarningType.NONE);
|
||||
}
|
||||
|
||||
static RdapSearchResults create(
|
||||
ImmutableList<ImmutableMap<String, Object>> jsonList, boolean isTruncated) {
|
||||
return new AutoValue_RdapSearchResults(jsonList, isTruncated);
|
||||
ImmutableList<ImmutableMap<String, Object>> jsonList,
|
||||
IncompletenessWarningType incompletenessWarningType) {
|
||||
return new AutoValue_RdapSearchResults(jsonList, incompletenessWarningType);
|
||||
}
|
||||
|
||||
/** List of JSON result object representations. */
|
||||
abstract ImmutableList<ImmutableMap<String, Object>> jsonList();
|
||||
|
||||
/** True if the result set was truncated to the maximum size limit. */
|
||||
abstract boolean isTruncated();
|
||||
|
||||
/** Type of warning to display regarding possible incomplete data. */
|
||||
abstract IncompletenessWarningType incompletenessWarningType();
|
||||
|
||||
/** Convenience method to get the appropriate warnings for the incompleteness warning type. */
|
||||
ImmutableList<ImmutableMap<String, Object>> getIncompletenessWarnings() {
|
||||
if (incompletenessWarningType() == IncompletenessWarningType.TRUNCATED) {
|
||||
return TRUNCATION_NOTICES;
|
||||
}
|
||||
if (incompletenessWarningType() == IncompletenessWarningType.MIGHT_BE_INCOMPLETE) {
|
||||
return POSSIBLY_INCOMPLETE_NOTICES;
|
||||
}
|
||||
return ImmutableList.<ImmutableMap<String, Object>>of();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue