Initial, easy changes to support later addition of RDAP metrics

I split this out to avoid having a giant CL that changes everything. The actual
metrics will follow later.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174356874
This commit is contained in:
mountford 2017-11-02 11:39:25 -07:00 committed by jianglai
parent c126c05810
commit 5b8ee87ecc
13 changed files with 127 additions and 46 deletions

View file

@ -29,6 +29,7 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.host.HostResource;
import google.registry.rdap.RdapJsonFormatter.BoilerplateType;
import google.registry.rdap.RdapJsonFormatter.OutputDataType;
import google.registry.rdap.RdapMetrics.EndpointType;
import google.registry.rdap.RdapSearchResults.IncompletenessWarningType;
import google.registry.request.Action;
import google.registry.request.HttpException.BadRequestException;
@ -75,6 +76,11 @@ public class RdapNameserverSearchAction extends RdapActionBase {
return "nameserver search";
}
@Override
public EndpointType getEndpointType() {
return EndpointType.NAMESERVERS;
}
@Override
public String getActionPath() {
return PATH;
@ -244,17 +250,9 @@ public class RdapNameserverSearchAction extends RdapActionBase {
return makeSearchResults(getMatchingResources(query, shouldIncludeDeleted(), now), now);
}
/**
* Output JSON for a lists of hosts contained in an {@link
* RdapResourcesAndIncompletenessWarningType}.
*/
private RdapSearchResults makeSearchResults(
RdapResourcesAndIncompletenessWarningType<HostResource> resourcesAndIncompletenessWarningType,
DateTime now) {
return makeSearchResults(
resourcesAndIncompletenessWarningType.resources(),
resourcesAndIncompletenessWarningType.incompletenessWarningType(),
now);
/** Output JSON for a lists of hosts contained in an {@link RdapResultSet}. */
private RdapSearchResults makeSearchResults(RdapResultSet<HostResource> resultSet, DateTime now) {
return makeSearchResults(resultSet.resources(), resultSet.incompletenessWarningType(), now);
}
/** Output JSON for a list of hosts. */