Add the App Engine service used in the Action definition

Our goal is to be able to address every Action by looking at the class itself, and to make it clearer at a glance what you need to access the Action's endpoint

Currently, we can know from the @Action annotation:
- the endpoint path
- the Method needed
- the authentication level needed

This CL adds the service where the Action is hosted, which also translates to the URL.

NOTE - currently we don't have any Action hosted on multiple services. I don't think we will ever need it (since they do the same thing no matter which service they are on, so why host it twice?), but if we do we'll have to update the code to allow it.

The next step after this is to make sure all the @Parameters are defined on the Action itself, and then we will be able to craft access to the endpoint programatically (or at least verify at run-time we crafted a correct URL)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=229375735
This commit is contained in:
guyben 2019-01-15 08:27:42 -08:00 committed by jianglai
parent 98f11decb9
commit a4f85c33c0
103 changed files with 555 additions and 385 deletions

View file

@ -34,19 +34,19 @@ import org.joda.time.DateTime;
/** /**
* Action that saves commit log checkpoints to Datastore and kicks off a diff export task. * Action that saves commit log checkpoints to Datastore and kicks off a diff export task.
* *
* <p>We separate computing and saving the checkpoint from exporting it because the export to GCS * <p>We separate computing and saving the checkpoint from exporting it because the export to GCS is
* is retryable but should not require the computation of a new checkpoint. Saving the checkpoint * retryable but should not require the computation of a new checkpoint. Saving the checkpoint and
* and enqueuing the export task are done transactionally, so any checkpoint that is saved will be * enqueuing the export task are done transactionally, so any checkpoint that is saved will be
* exported to GCS very soon. * exported to GCS very soon.
* *
* <p>This action's supported method is GET rather than POST because it gets invoked via cron. * <p>This action's supported method is GET rather than POST because it gets invoked via cron.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/cron/commitLogCheckpoint", path = "/_dr/cron/commitLogCheckpoint",
method = Action.Method.GET, method = Action.Method.GET,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class CommitLogCheckpointAction implements Runnable { public final class CommitLogCheckpointAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -53,20 +53,18 @@ import org.joda.time.Duration;
* except to reconstruct point-in-time snapshots of the database. To make that possible, {@link * except to reconstruct point-in-time snapshots of the database. To make that possible, {@link
* EppResource}s have a {@link EppResource#getRevisions} method that returns the commit logs for * EppResource}s have a {@link EppResource#getRevisions} method that returns the commit logs for
* older points in time. But that functionality is not useful after a certain amount of time, e.g. * older points in time. But that functionality is not useful after a certain amount of time, e.g.
* thirty days, so unneeded revisions are deleted * thirty days, so unneeded revisions are deleted (see {@link CommitLogRevisionsTranslatorFactory}).
* (see {@link CommitLogRevisionsTranslatorFactory}). This leaves commit logs in the system that are * This leaves commit logs in the system that are unneeded (have no revisions pointing to them). So
* unneeded (have no revisions pointing to them). So this task runs periodically to delete the * this task runs periodically to delete the "orphan" commit logs.
* "orphan" commit logs.
* *
* <p>This action runs a mapreduce that goes over all existing {@link EppResource} and all {@link * <p>This action runs a mapreduce that goes over all existing {@link EppResource} and all {@link
* CommitLogManifest} older than commitLogDatastreRetention, and erases the commit logs aren't in an * CommitLogManifest} older than commitLogDatastreRetention, and erases the commit logs aren't in an
* EppResource. * EppResource.
*
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/deleteOldCommitLogs", path = "/_dr/task/deleteOldCommitLogs",
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class DeleteOldCommitLogsAction implements Runnable { public final class DeleteOldCommitLogsAction implements Runnable {
private static final int NUM_MAP_SHARDS = 20; private static final int NUM_MAP_SHARDS = 20;

View file

@ -60,11 +60,11 @@ import org.joda.time.DateTime;
/** Action that exports the diff between two commit log checkpoints to GCS. */ /** Action that exports the diff between two commit log checkpoints to GCS. */
@Action( @Action(
service = Action.Service.BACKEND,
path = ExportCommitLogDiffAction.PATH, path = ExportCommitLogDiffAction.PATH,
method = Action.Method.POST, method = Action.Method.POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class ExportCommitLogDiffAction implements Runnable { public final class ExportCommitLogDiffAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -57,11 +57,11 @@ import org.joda.time.DateTime;
/** Restore Registry 2 commit logs from GCS to Datastore. */ /** Restore Registry 2 commit logs from GCS to Datastore. */
@Action( @Action(
service = Action.Service.TOOLS,
path = RestoreCommitLogsAction.PATH, path = RestoreCommitLogsAction.PATH,
method = Action.Method.POST, method = Action.Method.POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class RestoreCommitLogsAction implements Runnable { public class RestoreCommitLogsAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -107,7 +107,10 @@ import org.joda.time.Duration;
* A mapreduce that processes batch asynchronous deletions of contact and host resources by mapping * A mapreduce that processes batch asynchronous deletions of contact and host resources by mapping
* over all domains and checking for any references to the contacts/hosts in pending deletion. * over all domains and checking for any references to the contacts/hosts in pending deletion.
*/ */
@Action(path = "/_dr/task/deleteContactsAndHosts", auth = Auth.AUTH_INTERNAL_ONLY) @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/deleteContactsAndHosts",
auth = Auth.AUTH_INTERNAL_ONLY)
public class DeleteContactsAndHostsAction implements Runnable { public class DeleteContactsAndHostsAction implements Runnable {
static final String KIND_CONTACT = getKind(ContactResource.class); static final String KIND_CONTACT = getKind(ContactResource.class);

View file

@ -44,13 +44,17 @@ import javax.inject.Inject;
* Hard deletes load-test ContactResources, HostResources, their subordinate history entries, and * Hard deletes load-test ContactResources, HostResources, their subordinate history entries, and
* the associated ForeignKey and EppResourceIndex entities. * the associated ForeignKey and EppResourceIndex entities.
* *
* <p>This only deletes contacts and hosts, NOT domains. To delete domains, use * <p>This only deletes contacts and hosts, NOT domains. To delete domains, use {@link
* {@link DeleteLoadTestDataAction} and pass it the TLD(s) that the load test domains were created * DeleteLoadTestDataAction} and pass it the TLD(s) that the load test domains were created on. Note
* on. Note that DeleteLoadTestDataAction is safe enough to run in production whereas this mapreduce * that DeleteLoadTestDataAction is safe enough to run in production whereas this mapreduce is not,
* is not, but this one does not need to be runnable in production because load testing isn't run * but this one does not need to be runnable in production because load testing isn't run against
* against production. * production.
*/ */
@Action(path = "/_dr/task/deleteLoadTestData", method = POST, auth = Auth.AUTH_INTERNAL_ONLY) @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/deleteLoadTestData",
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY)
public class DeleteLoadTestDataAction implements Runnable { public class DeleteLoadTestDataAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -64,10 +64,10 @@ import org.joda.time.Duration;
* <p>See: https://www.youtube.com/watch?v=xuuv0syoHnM * <p>See: https://www.youtube.com/watch?v=xuuv0syoHnM
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/deleteProberData", path = "/_dr/task/deleteProberData",
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class DeleteProberDataAction implements Runnable { public class DeleteProberDataAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -67,15 +67,14 @@ import org.joda.time.DateTime;
/** /**
* A mapreduce that expands {@link Recurring} billing events into synthetic {@link OneTime} events. * A mapreduce that expands {@link Recurring} billing events into synthetic {@link OneTime} events.
* *
* <p>The cursor used throughout this mapreduce (overridden if necessary using the parameter * <p>The cursor used throughout this mapreduce (overridden if necessary using the parameter {@code
* {@code cursorTime}) represents the inclusive lower bound on the range of billing times that will * cursorTime}) represents the inclusive lower bound on the range of billing times that will be
* be expanded as a result of the job (the exclusive upper bound being the execution time of the * expanded as a result of the job (the exclusive upper bound being the execution time of the job).
* job).
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/expandRecurringBillingEvents", path = "/_dr/task/expandRecurringBillingEvents",
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class ExpandRecurringBillingEventsAction implements Runnable { public class ExpandRecurringBillingEventsAction implements Runnable {
public static final String PARAM_CURSOR_TIME = "cursorTime"; public static final String PARAM_CURSOR_TIME = "cursorTime";

View file

@ -73,9 +73,9 @@ import org.joda.time.Duration;
/** Performs batched DNS refreshes for applicable domains following a host rename. */ /** Performs batched DNS refreshes for applicable domains following a host rename. */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/refreshDnsOnHostRename", path = "/_dr/task/refreshDnsOnHostRename",
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class RefreshDnsOnHostRenameAction implements Runnable { public class RefreshDnsOnHostRenameAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -40,9 +40,9 @@ import javax.inject.Inject;
* which only admin users can do. * which only admin users can do.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/resaveAllEppResources", path = "/_dr/task/resaveAllEppResources",
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class ResaveAllEppResourcesAction implements Runnable { public class ResaveAllEppResourcesAction implements Runnable {
@Inject MapreduceRunner mrRunner; @Inject MapreduceRunner mrRunner;

View file

@ -38,7 +38,11 @@ import org.joda.time.DateTime;
* *
* <p>{@link EppResource}s will be projected forward to the current time. * <p>{@link EppResource}s will be projected forward to the current time.
*/ */
@Action(path = ResaveEntityAction.PATH, auth = Auth.AUTH_INTERNAL_OR_ADMIN, method = Method.POST) @Action(
service = Action.Service.BACKEND,
path = ResaveEntityAction.PATH,
auth = Auth.AUTH_INTERNAL_OR_ADMIN,
method = Method.POST)
public class ResaveEntityAction implements Runnable { public class ResaveEntityAction implements Runnable {
public static final String PATH = "/_dr/task/resaveEntity"; public static final String PATH = "/_dr/task/resaveEntity";

View file

@ -30,10 +30,10 @@ import javax.inject.Inject;
/** Action for fanning out cron tasks for each commit log bucket. */ /** Action for fanning out cron tasks for each commit log bucket. */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/cron/commitLogFanout", path = "/_dr/cron/commitLogFanout",
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class CommitLogFanoutAction implements Runnable { public final class CommitLogFanoutAction implements Runnable {
public static final String BUCKET_PARAM = "bucket"; public static final String BUCKET_PARAM = "bucket";

View file

@ -63,28 +63,31 @@ import javax.inject.Inject;
* *
* <ul> * <ul>
* <li>{@code endpoint} (Required) URL path of servlet to launch. This may contain pathargs. * <li>{@code endpoint} (Required) URL path of servlet to launch. This may contain pathargs.
* <li>{@code queue} (Required) Name of the App Engine push queue to which this task should be sent. * <li>{@code queue} (Required) Name of the App Engine push queue to which this task should be
* sent.
* <li>{@code forEachRealTld} Launch the task in each real TLD namespace. * <li>{@code forEachRealTld} Launch the task in each real TLD namespace.
* <li>{@code forEachTestTld} Launch the task in each test TLD namespace. * <li>{@code forEachTestTld} Launch the task in each test TLD namespace.
* <li>{@code runInEmpty} Launch the task once, without the TLD argument. * <li>{@code runInEmpty} Launch the task once, without the TLD argument.
* <li>{@code exclude} TLDs to exclude. * <li>{@code exclude} TLDs to exclude.
* <li>{@code jitterSeconds} Randomly delay each task by up to this many seconds. * <li>{@code jitterSeconds} Randomly delay each task by up to this many seconds.
* <li>Any other parameters specified will be passed through as POST parameters to the called task. * <li>Any other parameters specified will be passed through as POST parameters to the called
* task.
* </ul> * </ul>
* *
* <h3>Patharg Reference</h3> * <h3>Patharg Reference</h3>
* *
* <p>The following values may be specified inside the "endpoint" param. * <p>The following values may be specified inside the "endpoint" param.
*
* <ul> * <ul>
* <li>{@code :tld} Substituted with an ASCII tld, if tld fanout is enabled. * <li>{@code :tld} Substituted with an ASCII tld, if tld fanout is enabled. This patharg is
* This patharg is mostly useful for aesthetic purposes, since tasks are already namespaced. * mostly useful for aesthetic purposes, since tasks are already namespaced.
* </ul> * </ul>
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/cron/fanout", path = "/_dr/cron/fanout",
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class TldFanoutAction implements Runnable { public final class TldFanoutAction implements Runnable {
/** A set of control params to TldFanoutAction that aren't passed down to the executing action. */ /** A set of control params to TldFanoutAction that aren't passed down to the executing action. */

View file

@ -48,11 +48,11 @@ import org.joda.time.Duration;
/** Task that sends domain and host updates to the DNS server. */ /** Task that sends domain and host updates to the DNS server. */
@Action( @Action(
service = Action.Service.BACKEND,
path = PublishDnsUpdatesAction.PATH, path = PublishDnsUpdatesAction.PATH,
method = POST, method = POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> { public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
public static final String PATH = "/_dr/task/publishDnsUpdates"; public static final String PATH = "/_dr/task/publishDnsUpdates";

View file

@ -77,10 +77,10 @@ import org.joda.time.Duration;
* </ul> * </ul>
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/cron/readDnsQueue", path = "/_dr/cron/readDnsQueue",
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class ReadDnsQueueAction implements Runnable { public final class ReadDnsQueueAction implements Runnable {
private static final String PARAM_JITTER_SECONDS = "jitterSeconds"; private static final String PARAM_JITTER_SECONDS = "jitterSeconds";

View file

@ -32,10 +32,10 @@ import javax.inject.Inject;
/** Action that manually triggers refresh of DNS information. */ /** Action that manually triggers refresh of DNS information. */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/dnsRefresh", path = "/_dr/dnsRefresh",
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class RefreshDnsAction implements Runnable { public final class RefreshDnsAction implements Runnable {
@Inject Clock clock; @Inject Clock clock;

View file

@ -43,6 +43,7 @@ import javax.inject.Inject;
* </ol> * </ol>
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = BackupDatastoreAction.PATH, path = BackupDatastoreAction.PATH,
method = POST, method = POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,

View file

@ -47,11 +47,11 @@ import org.joda.time.Duration;
* completion state; otherwise it will return a failure code so that the task will be retried. * completion state; otherwise it will return a failure code so that the task will be retried.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = BigqueryPollJobAction.PATH, path = BigqueryPollJobAction.PATH,
method = {Action.Method.GET, Action.Method.POST}, method = {Action.Method.GET, Action.Method.POST},
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class BigqueryPollJobAction implements Runnable { public class BigqueryPollJobAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -55,6 +55,7 @@ import org.joda.time.format.PeriodFormat;
* Action that checks the status of a snapshot, and if complete, trigger loading it into BigQuery. * Action that checks the status of a snapshot, and if complete, trigger loading it into BigQuery.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = CheckBackupAction.PATH, path = CheckBackupAction.PATH,
method = {POST, GET}, method = {POST, GET},
automaticallyPrintOk = true, automaticallyPrintOk = true,

View file

@ -47,11 +47,11 @@ import org.joda.time.format.PeriodFormat;
* Action that checks the status of a snapshot, and if complete, trigger loading it into BigQuery. * Action that checks the status of a snapshot, and if complete, trigger loading it into BigQuery.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = CheckSnapshotAction.PATH, path = CheckSnapshotAction.PATH,
method = {POST, GET}, method = {POST, GET},
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class CheckSnapshotAction implements Runnable { public class CheckSnapshotAction implements Runnable {
/** Parameter names for passing parameters into this action. */ /** Parameter names for passing parameters into this action. */

View file

@ -61,7 +61,11 @@ import org.joda.time.DateTime;
* <p>Each TLD's active domain names are exported as a newline-delimited flat text file with the * <p>Each TLD's active domain names are exported as a newline-delimited flat text file with the
* name TLD.txt into the domain-lists bucket. Note that this overwrites the files in place. * name TLD.txt into the domain-lists bucket. Note that this overwrites the files in place.
*/ */
@Action(path = "/_dr/task/exportDomainLists", method = POST, auth = Auth.AUTH_INTERNAL_ONLY) @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/exportDomainLists",
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY)
public class ExportDomainListsAction implements Runnable { public class ExportDomainListsAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -45,7 +45,11 @@ import java.util.SortedSet;
import javax.inject.Inject; import javax.inject.Inject;
/** Action that exports the premium terms list for a TLD to Google Drive. */ /** Action that exports the premium terms list for a TLD to Google Drive. */
@Action(path = "/_dr/task/exportPremiumTerms", method = POST, auth = Auth.AUTH_INTERNAL_ONLY) @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/exportPremiumTerms",
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY)
public class ExportPremiumTermsAction implements Runnable { public class ExportPremiumTermsAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -34,10 +34,10 @@ import javax.inject.Inject;
/** Action that exports the publicly viewable reserved terms list for a TLD to Google Drive. */ /** Action that exports the publicly viewable reserved terms list for a TLD to Google Drive. */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/exportReservedTerms", path = "/_dr/task/exportReservedTerms",
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class ExportReservedTermsAction implements Runnable { public class ExportReservedTermsAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -39,11 +39,11 @@ import javax.inject.Inject;
* </ol> * </ol>
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = ExportSnapshotAction.PATH, path = ExportSnapshotAction.PATH,
method = POST, method = POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class ExportSnapshotAction implements Runnable { public class ExportSnapshotAction implements Runnable {
/** Queue to use for enqueuing the task that will actually launch the backup. */ /** Queue to use for enqueuing the task that will actually launch the backup. */

View file

@ -51,10 +51,10 @@ import org.joda.time.DateTime;
/** Action to load a Datastore snapshot from Google Cloud Storage into BigQuery. */ /** Action to load a Datastore snapshot from Google Cloud Storage into BigQuery. */
@Action( @Action(
service = Action.Service.BACKEND,
path = LoadSnapshotAction.PATH, path = LoadSnapshotAction.PATH,
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class LoadSnapshotAction implements Runnable { public class LoadSnapshotAction implements Runnable {
/** Parameter names for passing parameters into the servlet. */ /** Parameter names for passing parameters into the servlet. */

View file

@ -52,10 +52,10 @@ import javax.inject.Inject;
* <p>This uses the <a href="https://developers.google.com/admin-sdk/directory/">Directory API</a>. * <p>This uses the <a href="https://developers.google.com/admin-sdk/directory/">Directory API</a>.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/syncGroupMembers", path = "/_dr/task/syncGroupMembers",
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class SyncGroupMembersAction implements Runnable { public final class SyncGroupMembersAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -35,7 +35,11 @@ import java.io.IOException;
import javax.inject.Inject; import javax.inject.Inject;
/** Update a well-known view to point at a certain Datastore snapshot table in BigQuery. */ /** Update a well-known view to point at a certain Datastore snapshot table in BigQuery. */
@Action(path = UpdateSnapshotViewAction.PATH, method = POST, auth = Auth.AUTH_INTERNAL_ONLY) @Action(
service = Action.Service.BACKEND,
path = UpdateSnapshotViewAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY)
public class UpdateSnapshotViewAction implements Runnable { public class UpdateSnapshotViewAction implements Runnable {
/** Headers for passing parameters into the servlet. */ /** Headers for passing parameters into the servlet. */

View file

@ -48,7 +48,11 @@ import java.io.IOException;
import javax.inject.Inject; import javax.inject.Inject;
/** Action to load a Datastore backup from Google Cloud Storage into BigQuery. */ /** Action to load a Datastore backup from Google Cloud Storage into BigQuery. */
@Action(path = UploadDatastoreBackupAction.PATH, method = POST, auth = Auth.AUTH_INTERNAL_ONLY) @Action(
service = Action.Service.BACKEND,
path = UploadDatastoreBackupAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY)
public class UploadDatastoreBackupAction implements Runnable { public class UploadDatastoreBackupAction implements Runnable {
/** Parameter names for passing parameters into the servlet. */ /** Parameter names for passing parameters into the servlet. */

View file

@ -57,10 +57,10 @@ import org.joda.time.Duration;
* @see SyncRegistrarsSheet * @see SyncRegistrarsSheet
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = SyncRegistrarsSheetAction.PATH, path = SyncRegistrarsSheetAction.PATH,
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class SyncRegistrarsSheetAction implements Runnable { public class SyncRegistrarsSheetAction implements Runnable {
private enum Result { private enum Result {

View file

@ -69,7 +69,7 @@ import org.joda.time.DateTime;
* user controlled, lest it open an XSS vector. Do not modify this to return the domain name in the * user controlled, lest it open an XSS vector. Do not modify this to return the domain name in the
* response. * response.
*/ */
@Action(path = "/check", auth = Auth.AUTH_PUBLIC_ANONYMOUS) @Action(service = Action.Service.PUBAPI, path = "/check", auth = Auth.AUTH_PUBLIC_ANONYMOUS)
public class CheckApiAction implements Runnable { public class CheckApiAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -27,10 +27,10 @@ import javax.servlet.http.HttpSession;
/** Runs EPP from the console and requires GAE user authentication. */ /** Runs EPP from the console and requires GAE user authentication. */
@Action( @Action(
service = Action.Service.DEFAULT,
path = "/registrar-xhr", path = "/registrar-xhr",
method = Method.POST, method = Method.POST,
auth = Auth.AUTH_PUBLIC_LOGGED_IN auth = Auth.AUTH_PUBLIC_LOGGED_IN)
)
public class EppConsoleAction implements Runnable { public class EppConsoleAction implements Runnable {
@Inject @Payload byte[] inputXmlBytes; @Inject @Payload byte[] inputXmlBytes;

View file

@ -27,10 +27,10 @@ import javax.servlet.http.HttpSession;
* to RFC 5730. Commands must be requested via POST. * to RFC 5730. Commands must be requested via POST.
*/ */
@Action( @Action(
service = Action.Service.DEFAULT,
path = "/_dr/epp", path = "/_dr/epp",
method = Method.POST, method = Method.POST,
auth = Auth.AUTH_PUBLIC_OR_INTERNAL auth = Auth.AUTH_PUBLIC_OR_INTERNAL)
)
public class EppTlsAction implements Runnable { public class EppTlsAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -30,10 +30,10 @@ import javax.servlet.http.HttpServletRequest;
/** Runs EPP commands directly without logging in, verifying an XSRF token from the tool. */ /** Runs EPP commands directly without logging in, verifying an XSRF token from the tool. */
@Action( @Action(
service = Action.Service.TOOLS,
path = EppToolAction.PATH, path = EppToolAction.PATH,
method = Method.POST, method = Method.POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class EppToolAction implements Runnable { public class EppToolAction implements Runnable {
public static final String PATH = "/_dr/epptool"; public static final String PATH = "/_dr/epptool";

View file

@ -52,11 +52,11 @@ import org.joda.time.DateTime;
* least one must be specified in order for load testing to do anything. * least one must be specified in order for load testing to do anything.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = LoadTestAction.PATH, path = LoadTestAction.PATH,
method = Action.Method.POST, method = Action.Method.POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class LoadTestAction implements Runnable { public class LoadTestAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -31,11 +31,11 @@ import javax.inject.Inject;
* ARIN, not domain registries. * ARIN, not domain registries.
*/ */
@Action( @Action(
service = Action.Service.PUBAPI,
path = RdapAutnumAction.PATH, path = RdapAutnumAction.PATH,
method = {GET, HEAD}, method = {GET, HEAD},
isPrefix = true, isPrefix = true,
auth = Auth.AUTH_PUBLIC_ANONYMOUS auth = Auth.AUTH_PUBLIC_ANONYMOUS)
)
public class RdapAutnumAction extends RdapActionBase { public class RdapAutnumAction extends RdapActionBase {
public static final String PATH = "/rdap/autnum/"; public static final String PATH = "/rdap/autnum/";

View file

@ -35,11 +35,11 @@ import org.joda.time.DateTime;
/** RDAP (new WHOIS) action for domain requests. */ /** RDAP (new WHOIS) action for domain requests. */
@Action( @Action(
service = Action.Service.PUBAPI,
path = RdapDomainAction.PATH, path = RdapDomainAction.PATH,
method = {GET, HEAD}, method = {GET, HEAD},
isPrefix = true, isPrefix = true,
auth = Auth.AUTH_PUBLIC auth = Auth.AUTH_PUBLIC)
)
public class RdapDomainAction extends RdapActionBase { public class RdapDomainAction extends RdapActionBase {
public static final String PATH = "/rdap/domain/"; public static final String PATH = "/rdap/domain/";

View file

@ -67,10 +67,10 @@ import org.joda.time.DateTime;
* Data Access Protocol (RDAP)</a> * Data Access Protocol (RDAP)</a>
*/ */
@Action( @Action(
service = Action.Service.PUBAPI,
path = RdapDomainSearchAction.PATH, path = RdapDomainSearchAction.PATH,
method = {GET, HEAD}, method = {GET, HEAD},
auth = Auth.AUTH_PUBLIC auth = Auth.AUTH_PUBLIC)
)
public class RdapDomainSearchAction extends RdapSearchActionBase { public class RdapDomainSearchAction extends RdapSearchActionBase {
static final String PATH = "/rdap/domains"; static final String PATH = "/rdap/domains";

View file

@ -46,11 +46,11 @@ import org.joda.time.DateTime;
* Registrar ID registry. The type value of the publicID object MUST be equal to IANA Registrar ID. * Registrar ID registry. The type value of the publicID object MUST be equal to IANA Registrar ID.
*/ */
@Action( @Action(
service = Action.Service.PUBAPI,
path = RdapEntityAction.PATH, path = RdapEntityAction.PATH,
method = {GET, HEAD}, method = {GET, HEAD},
isPrefix = true, isPrefix = true,
auth = Auth.AUTH_PUBLIC auth = Auth.AUTH_PUBLIC)
)
public class RdapEntityAction extends RdapActionBase { public class RdapEntityAction extends RdapActionBase {
public static final String PATH = "/rdap/entity/"; public static final String PATH = "/rdap/entity/";

View file

@ -75,10 +75,10 @@ import org.joda.time.DateTime;
* Data Access Protocol (RDAP)</a> * Data Access Protocol (RDAP)</a>
*/ */
@Action( @Action(
service = Action.Service.PUBAPI,
path = RdapEntitySearchAction.PATH, path = RdapEntitySearchAction.PATH,
method = {GET, HEAD}, method = {GET, HEAD},
auth = Auth.AUTH_PUBLIC auth = Auth.AUTH_PUBLIC)
)
public class RdapEntitySearchAction extends RdapSearchActionBase { public class RdapEntitySearchAction extends RdapSearchActionBase {
public static final String PATH = "/rdap/entities"; public static final String PATH = "/rdap/entities";

View file

@ -27,11 +27,11 @@ import javax.inject.Inject;
/** RDAP (new WHOIS) action for help requests. */ /** RDAP (new WHOIS) action for help requests. */
@Action( @Action(
service = Action.Service.PUBAPI,
path = RdapHelpAction.PATH, path = RdapHelpAction.PATH,
method = {GET, HEAD}, method = {GET, HEAD},
isPrefix = true, isPrefix = true,
auth = Auth.AUTH_PUBLIC_ANONYMOUS auth = Auth.AUTH_PUBLIC_ANONYMOUS)
)
public class RdapHelpAction extends RdapActionBase { public class RdapHelpAction extends RdapActionBase {
public static final String PATH = "/rdap/help"; public static final String PATH = "/rdap/help";

View file

@ -31,11 +31,11 @@ import javax.inject.Inject;
* ARIN, not domain registries. * ARIN, not domain registries.
*/ */
@Action( @Action(
service = Action.Service.PUBAPI,
path = RdapIpAction.PATH, path = RdapIpAction.PATH,
method = {GET, HEAD}, method = {GET, HEAD},
isPrefix = true, isPrefix = true,
auth = Auth.AUTH_PUBLIC_ANONYMOUS auth = Auth.AUTH_PUBLIC_ANONYMOUS)
)
public class RdapIpAction extends RdapActionBase { public class RdapIpAction extends RdapActionBase {
public static final String PATH = "/rdap/ip/"; public static final String PATH = "/rdap/ip/";

View file

@ -35,11 +35,11 @@ import org.joda.time.DateTime;
/** RDAP (new WHOIS) action for nameserver requests. */ /** RDAP (new WHOIS) action for nameserver requests. */
@Action( @Action(
service = Action.Service.PUBAPI,
path = RdapNameserverAction.PATH, path = RdapNameserverAction.PATH,
method = {GET, HEAD}, method = {GET, HEAD},
isPrefix = true, isPrefix = true,
auth = Auth.AUTH_PUBLIC_ANONYMOUS auth = Auth.AUTH_PUBLIC_ANONYMOUS)
)
public class RdapNameserverAction extends RdapActionBase { public class RdapNameserverAction extends RdapActionBase {
public static final String PATH = "/rdap/nameserver/"; public static final String PATH = "/rdap/nameserver/";

View file

@ -57,10 +57,10 @@ import org.joda.time.DateTime;
* Data Access Protocol (RDAP)</a> * Data Access Protocol (RDAP)</a>
*/ */
@Action( @Action(
service = Action.Service.PUBAPI,
path = RdapNameserverSearchAction.PATH, path = RdapNameserverSearchAction.PATH,
method = {GET, HEAD}, method = {GET, HEAD},
auth = Auth.AUTH_PUBLIC_ANONYMOUS auth = Auth.AUTH_PUBLIC_ANONYMOUS)
)
public class RdapNameserverSearchAction extends RdapSearchActionBase { public class RdapNameserverSearchAction extends RdapSearchActionBase {
public static final String PATH = "/rdap/nameservers"; public static final String PATH = "/rdap/nameservers";

View file

@ -49,14 +49,16 @@ import org.joda.time.DateTime;
* This bucket is special because a separate script will rsync it to the third party escrow provider * This bucket is special because a separate script will rsync it to the third party escrow provider
* SFTP server. This is why the internal staging files are stored in the separate RDE bucket. * SFTP server. This is why the internal staging files are stored in the separate RDE bucket.
* *
* @see <a href="http://newgtlds.icann.org/en/applicants/agb/agreement-approved-09jan14-en.htm">Registry Agreement</a> * @see <a
* href="http://newgtlds.icann.org/en/applicants/agb/agreement-approved-09jan14-en.htm">Registry
* Agreement</a>
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = BrdaCopyAction.PATH, path = BrdaCopyAction.PATH,
method = POST, method = POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class BrdaCopyAction implements Runnable { public final class BrdaCopyAction implements Runnable {
static final String PATH = "/_dr/task/brdaCopy"; static final String PATH = "/_dr/task/brdaCopy";

View file

@ -50,10 +50,10 @@ import org.joda.time.Duration;
* Action that uploads a small XML RDE report to ICANN after {@link RdeUploadAction} has finished. * Action that uploads a small XML RDE report to ICANN after {@link RdeUploadAction} has finished.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = RdeReportAction.PATH, path = RdeReportAction.PATH,
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class RdeReportAction implements Runnable, EscrowTask { public final class RdeReportAction implements Runnable, EscrowTask {
static final String PATH = "/_dr/task/rdeReport"; static final String PATH = "/_dr/task/rdeReport";

View file

@ -78,8 +78,8 @@ import org.joda.time.Duration;
* <p>Once a deposit is successfully generated, an {@link RdeUploadAction} is enqueued which will * <p>Once a deposit is successfully generated, an {@link RdeUploadAction} is enqueued which will
* upload it via SFTP to the third-party escrow provider. * upload it via SFTP to the third-party escrow provider.
* *
* <p>To generate escrow deposits manually and locally, use the {@code nomulus} tool command * <p>To generate escrow deposits manually and locally, use the {@code nomulus} tool command {@code
* {@code GenerateEscrowDepositCommand}. * GenerateEscrowDepositCommand}.
* *
* <h3>Logging</h3> * <h3>Logging</h3>
* *
@ -95,9 +95,9 @@ import org.joda.time.Duration;
* <p>If a deposit fails, an error is emitted to the logs for each broken entity. It tells you the * <p>If a deposit fails, an error is emitted to the logs for each broken entity. It tells you the
* key and shows you its representation in lenient XML. * key and shows you its representation in lenient XML.
* *
* <p>Failed deposits will be retried indefinitely. This is because RDE and BRDA each have a * <p>Failed deposits will be retried indefinitely. This is because RDE and BRDA each have a {@link
* {@link Cursor} for each TLD. Even if the cursor lags for days, it'll catch up gradually on its * Cursor} for each TLD. Even if the cursor lags for days, it'll catch up gradually on its own, once
* own, once the data becomes valid. * the data becomes valid.
* *
* <p>The third-party escrow provider will validate each deposit we send them. They do both schema * <p>The third-party escrow provider will validate each deposit we send them. They do both schema
* validation and reference checking. * validation and reference checking.
@ -143,21 +143,24 @@ import org.joda.time.Duration;
* *
* <h3>Determinism</h3> * <h3>Determinism</h3>
* *
* <p>The filename of an escrow deposit is determistic for a given (TLD, watermark, * <p>The filename of an escrow deposit is determistic for a given (TLD, watermark, {@linkplain
* {@linkplain RdeMode mode}) triplet. Its generated contents is deterministic in all the ways that * RdeMode mode}) triplet. Its generated contents is deterministic in all the ways that we care
* we care about. Its view of the database is strongly consistent. * about. Its view of the database is strongly consistent.
* *
* <p>This is because: * <p>This is because:
*
* <ol> * <ol>
* <li>{@code EppResource} queries are strongly consistent thanks to {@link EppResourceIndex} * <li>{@code EppResource} queries are strongly consistent thanks to {@link EppResourceIndex}
* <li>{@code EppResource} entities are rewinded to the point-in-time of the watermark * <li>{@code EppResource} entities are rewinded to the point-in-time of the watermark
* </ol> * </ol>
* *
* <p>Here's what's not deterministic: * <p>Here's what's not deterministic:
*
* <ul> * <ul>
* <li>Ordering of XML fragments. We don't care about this. * <li>Ordering of XML fragments. We don't care about this.
* <li>Information about registrars. There's no point-in-time for these objects. So in order to * <li>Information about registrars. There's no point-in-time for these objects. So in order to
* guarantee referential correctness of your deposits, you must never delete a registrar entity. * guarantee referential correctness of your deposits, you must never delete a registrar
* entity.
* </ul> * </ul>
* *
* <h3>Manual Operation</h3> * <h3>Manual Operation</h3>
@ -167,6 +170,7 @@ import org.joda.time.Duration;
* will be stored in a subdirectory of the "manual" directory, to avoid overwriting regular deposit * will be stored in a subdirectory of the "manual" directory, to avoid overwriting regular deposit
* files. Cursors and revision numbers will not be updated, and the upload task will not be kicked * files. Cursors and revision numbers will not be updated, and the upload task will not be kicked
* off. The parameters are: * off. The parameters are:
*
* <ul> * <ul>
* <li>manual: if present and true, manual operation is indicated * <li>manual: if present and true, manual operation is indicated
* <li>directory: the subdirectory of "manual" into which the files should be placed * <li>directory: the subdirectory of "manual" into which the files should be placed
@ -181,14 +185,16 @@ import org.joda.time.Duration;
* set to false). The revision parameter is optional in manual operation, and must be absent for * set to false). The revision parameter is optional in manual operation, and must be absent for
* standard operation. * standard operation.
* *
* @see <a href="https://tools.ietf.org/html/draft-arias-noguchi-registry-data-escrow-06">Registry Data Escrow Specification</a> * @see <a href="https://tools.ietf.org/html/draft-arias-noguchi-registry-data-escrow-06">Registry
* @see <a href="https://tools.ietf.org/html/draft-arias-noguchi-dnrd-objects-mapping-05">Domain Name Registration Data Objects Mapping</a> * Data Escrow Specification</a>
* @see <a href="https://tools.ietf.org/html/draft-arias-noguchi-dnrd-objects-mapping-05">Domain
* Name Registration Data Objects Mapping</a>
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = RdeStagingAction.PATH, path = RdeStagingAction.PATH,
method = {GET, POST}, method = {GET, POST},
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class RdeStagingAction implements Runnable { public final class RdeStagingAction implements Runnable {
public static final String PATH = "/_dr/task/rdeStaging"; public static final String PATH = "/_dr/task/rdeStaging";

View file

@ -76,14 +76,14 @@ import org.joda.time.Duration;
* <p>This action is invoked by {@link RdeStagingAction} once it's created the files we need. The * <p>This action is invoked by {@link RdeStagingAction} once it's created the files we need. The
* date is calculated from {@link CursorType#RDE_UPLOAD}. * date is calculated from {@link CursorType#RDE_UPLOAD}.
* *
* <p>Once this action completes, it rolls the cursor forward a day and triggers * <p>Once this action completes, it rolls the cursor forward a day and triggers {@link
* {@link RdeReportAction}. * RdeReportAction}.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = RdeUploadAction.PATH, path = RdeUploadAction.PATH,
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class RdeUploadAction implements Runnable, EscrowTask { public final class RdeUploadAction implements Runnable, EscrowTask {
static final String PATH = "/_dr/task/rdeUpload"; static final String PATH = "/_dr/task/rdeUpload";

View file

@ -45,9 +45,9 @@ import javax.inject.Inject;
* <p>Specify the escrow file to import with the "path" parameter. * <p>Specify the escrow file to import with the "path" parameter.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/importRdeContacts", path = "/_dr/task/importRdeContacts",
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class RdeContactImportAction implements Runnable { public class RdeContactImportAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -69,9 +69,9 @@ import org.joda.time.DateTime;
* <p>Specify the escrow file to import with the "path" parameter. * <p>Specify the escrow file to import with the "path" parameter.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/importRdeDomains", path = "/_dr/task/importRdeDomains",
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class RdeDomainImportAction implements Runnable { public class RdeDomainImportAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -45,9 +45,9 @@ import javax.inject.Inject;
* <p>Specify the escrow file to import with the "path" parameter. * <p>Specify the escrow file to import with the "path" parameter.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/importRdeHosts", path = "/_dr/task/importRdeHosts",
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class RdeHostImportAction implements Runnable { public class RdeHostImportAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -56,9 +56,9 @@ import org.joda.time.DateTime;
* <p>Specify the escrow file to import with the "path" parameter. * <p>Specify the escrow file to import with the "path" parameter.
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/linkRdeHosts", path = "/_dr/task/linkRdeHosts",
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class RdeHostLinkAction implements Runnable { public class RdeHostLinkAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -39,7 +39,11 @@ import java.util.Optional;
import javax.inject.Inject; import javax.inject.Inject;
/** Copy all registrar detail reports in a given bucket's subdirectory from GCS to Drive. */ /** Copy all registrar detail reports in a given bucket's subdirectory from GCS to Drive. */
@Action(path = CopyDetailReportsAction.PATH, method = POST, auth = Auth.AUTH_INTERNAL_OR_ADMIN) @Action(
service = Action.Service.BACKEND,
path = CopyDetailReportsAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public final class CopyDetailReportsAction implements Runnable { public final class CopyDetailReportsAction implements Runnable {
public static final String PATH = "/_dr/task/copyDetailReports"; public static final String PATH = "/_dr/task/copyDetailReports";

View file

@ -46,7 +46,11 @@ import org.joda.time.YearMonth;
* staged at gs://<projectId>-beam/templates/invoicing. The pipeline then generates invoices for the * staged at gs://<projectId>-beam/templates/invoicing. The pipeline then generates invoices for the
* month and stores them on GCS. * month and stores them on GCS.
*/ */
@Action(path = GenerateInvoicesAction.PATH, method = POST, auth = Auth.AUTH_INTERNAL_ONLY) @Action(
service = Action.Service.BACKEND,
path = GenerateInvoicesAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY)
public class GenerateInvoicesAction implements Runnable { public class GenerateInvoicesAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -43,10 +43,15 @@ import org.joda.time.YearMonth;
* <p>This relies on the retry semantics in {@code queue.xml} to ensure proper upload, in spite of * <p>This relies on the retry semantics in {@code queue.xml} to ensure proper upload, in spite of
* fluctuations in generation timing. * fluctuations in generation timing.
* *
* @see <a href=https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobState> * @see <a
* href=https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobState>
* Job States</a> * Job States</a>
*/ */
@Action(path = PublishInvoicesAction.PATH, method = POST, auth = Auth.AUTH_INTERNAL_OR_ADMIN) @Action(
service = Action.Service.BACKEND,
path = PublishInvoicesAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public class PublishInvoicesAction implements Runnable { public class PublishInvoicesAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -55,7 +55,11 @@ import org.joda.time.YearMonth;
* <p>reportTypes: the type of reports to generate. You can specify either 'activity' or * <p>reportTypes: the type of reports to generate. You can specify either 'activity' or
* 'transactions'. Defaults to generating both. * 'transactions'. Defaults to generating both.
*/ */
@Action(path = IcannReportingStagingAction.PATH, method = POST, auth = Auth.AUTH_INTERNAL_ONLY) @Action(
service = Action.Service.BACKEND,
path = IcannReportingStagingAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY)
public final class IcannReportingStagingAction implements Runnable { public final class IcannReportingStagingAction implements Runnable {
static final String PATH = "/_dr/task/icannReportingStaging"; static final String PATH = "/_dr/task/icannReportingStaging";

View file

@ -52,7 +52,11 @@ import javax.inject.Inject;
* example: "manual/dir" means reports will be stored under gs://[project-id]-reporting/manual/dir. * example: "manual/dir" means reports will be stored under gs://[project-id]-reporting/manual/dir.
* Defaults to "icann/monthly/[last month in yyyy-MM format]". * Defaults to "icann/monthly/[last month in yyyy-MM format]".
*/ */
@Action(path = IcannReportingUploadAction.PATH, method = POST, auth = Auth.AUTH_INTERNAL_OR_ADMIN) @Action(
service = Action.Service.BACKEND,
path = IcannReportingUploadAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public final class IcannReportingUploadAction implements Runnable { public final class IcannReportingUploadAction implements Runnable {
static final String PATH = "/_dr/task/icannReportingUpload"; static final String PATH = "/_dr/task/icannReportingUpload";

View file

@ -43,7 +43,11 @@ import org.joda.time.LocalDate;
* <p>This action runs the {@link google.registry.beam.spec11.Spec11Pipeline} template, which * <p>This action runs the {@link google.registry.beam.spec11.Spec11Pipeline} template, which
* generates the specified month's Spec11 report and stores it on GCS. * generates the specified month's Spec11 report and stores it on GCS.
*/ */
@Action(path = GenerateSpec11ReportAction.PATH, method = POST, auth = Auth.AUTH_INTERNAL_ONLY) @Action(
service = Action.Service.BACKEND,
path = GenerateSpec11ReportAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY)
public class GenerateSpec11ReportAction implements Runnable { public class GenerateSpec11ReportAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -52,7 +52,11 @@ import org.json.JSONException;
* <p>This calls {@link Spec11EmailUtils#emailSpec11Reports(SoyTemplateInfo, String, Set)} on * <p>This calls {@link Spec11EmailUtils#emailSpec11Reports(SoyTemplateInfo, String, Set)} on
* success or {@link Spec11EmailUtils#sendAlertEmail(String, String)} on failure. * success or {@link Spec11EmailUtils#sendAlertEmail(String, String)} on failure.
*/ */
@Action(path = PublishSpec11ReportAction.PATH, method = POST, auth = Auth.AUTH_INTERNAL_OR_ADMIN) @Action(
service = Action.Service.BACKEND,
path = PublishSpec11ReportAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public class PublishSpec11ReportAction implements Runnable { public class PublishSpec11ReportAction implements Runnable {
static final String PATH = "/_dr/task/publishSpec11"; static final String PATH = "/_dr/task/publishSpec11";

View file

@ -28,6 +28,28 @@ public @interface Action {
/** HTTP methods recognized by the request processor. */ /** HTTP methods recognized by the request processor. */
enum Method { GET, HEAD, POST } enum Method { GET, HEAD, POST }
/** App Engine services supported by the request processor. */
enum Service {
DEFAULT("default"),
TOOLS("tools"),
BACKEND("backend"),
PUBAPI("pubapi");
private final String serviceId;
Service(String serviceId) {
this.serviceId = serviceId;
}
/** Returns the actual service id in App Engine. */
public String getServiceId() {
return serviceId;
}
}
/** Which App Engine service this action lives on. */
Service service();
/** HTTP path to serve the action from. The path components must be percent-escaped. */ /** HTTP path to serve the action from. The path components must be percent-escaped. */
String path(); String path();

View file

@ -14,9 +14,11 @@
package google.registry.request; package google.registry.request;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.joining;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Streams; import com.google.common.collect.Streams;
import java.util.Map; import java.util.Map;
@ -62,6 +64,18 @@ public class RouterDisplayHelper {
return formatRoutes(Router.extractRoutesFromComponent(componentClass).values()); return formatRoutes(Router.extractRoutesFromComponent(componentClass).values());
} }
public static ImmutableList<String> extractHumanReadableRoutesWithWrongService(
Class<?> componentClass, Action.Service expectedService) {
return Router.extractRoutesFromComponent(componentClass).values().stream()
.filter(route -> route.action().service() != expectedService)
.map(
route ->
String.format(
"%s (%s%s)",
route.actionClass(), route.action().service(), route.action().path()))
.collect(toImmutableList());
}
private static String getFormatString(Map<String, Integer> columnWidths) { private static String getFormatString(Map<String, Integer> columnWidths) {
return String.format( return String.format(
FORMAT, FORMAT,

View file

@ -68,6 +68,7 @@ import org.joda.time.Duration;
* @see NordnVerifyAction * @see NordnVerifyAction
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = NordnUploadAction.PATH, path = NordnUploadAction.PATH,
method = Action.Method.POST, method = Action.Method.POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,

View file

@ -42,21 +42,21 @@ import javax.inject.Inject;
/** /**
* NORDN CSV uploading system, verify operation. * NORDN CSV uploading system, verify operation.
* *
* <p>Every three hours (max twenty-six hours) we generate CSV files for each TLD which we need * <p>Every three hours (max twenty-six hours) we generate CSV files for each TLD which we need to
* to upload to MarksDB. The upload is a two-phase process. We send the CSV data as a POST request * upload to MarksDB. The upload is a two-phase process. We send the CSV data as a POST request and
* and get back a 202 Accepted. This response will give us a URL in the Location header, where * get back a 202 Accepted. This response will give us a URL in the Location header, where we'll
* we'll check back later for the actual result. * check back later for the actual result.
* *
* @see NordnUploadAction * @see NordnUploadAction
* @see <a href="http://tools.ietf.org/html/draft-lozano-tmch-func-spec-08#section-5.2.3.3"> * @see <a href="http://tools.ietf.org/html/draft-lozano-tmch-func-spec-08#section-5.2.3.3">
* http://tools.ietf.org/html/draft-lozano-tmch-func-spec-08#section-5.2.3.3</a> * http://tools.ietf.org/html/draft-lozano-tmch-func-spec-08#section-5.2.3.3</a>
*/ */
@Action( @Action(
service = Action.Service.BACKEND,
path = NordnVerifyAction.PATH, path = NordnVerifyAction.PATH,
method = Action.Method.POST, method = Action.Method.POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class NordnVerifyAction implements Runnable { public final class NordnVerifyAction implements Runnable {
static final String PATH = "/_dr/task/nordnVerify"; static final String PATH = "/_dr/task/nordnVerify";

View file

@ -28,11 +28,11 @@ import javax.inject.Inject;
/** Action to download the latest ICANN TMCH CRL from MarksDB. */ /** Action to download the latest ICANN TMCH CRL from MarksDB. */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/tmchCrl", path = "/_dr/task/tmchCrl",
method = POST, method = POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class TmchCrlAction implements Runnable { public final class TmchCrlAction implements Runnable {
@Inject Marksdb marksdb; @Inject Marksdb marksdb;

View file

@ -30,11 +30,11 @@ import org.bouncycastle.openpgp.PGPException;
/** Action to download the latest domain name list (aka claims list) from MarksDB. */ /** Action to download the latest domain name list (aka claims list) from MarksDB. */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/tmchDnl", path = "/_dr/task/tmchDnl",
method = POST, method = POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class TmchDnlAction implements Runnable { public final class TmchDnlAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -30,11 +30,11 @@ import org.bouncycastle.openpgp.PGPException;
/** Action to download the latest signed mark revocation list from MarksDB. */ /** Action to download the latest signed mark revocation list from MarksDB. */
@Action( @Action(
service = Action.Service.BACKEND,
path = "/_dr/task/tmchSmdrl", path = "/_dr/task/tmchSmdrl",
method = POST, method = POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public final class TmchSmdrlAction implements Runnable { public final class TmchSmdrlAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -33,6 +33,7 @@ import com.google.common.net.MediaType;
import com.google.re2j.Matcher; import com.google.re2j.Matcher;
import com.google.re2j.Pattern; import com.google.re2j.Pattern;
import google.registry.config.RegistryConfig; import google.registry.config.RegistryConfig;
import google.registry.request.Action.Service;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.URL; import java.net.URL;
@ -65,24 +66,6 @@ class AppEngineConnection {
this.requestFactory = requestFactory; this.requestFactory = requestFactory;
} }
enum Service {
DEFAULT("default"),
TOOLS("tools"),
BACKEND("backend"),
PUBAPI("pubapi");
private final String serviceId;
Service(String serviceId) {
this.serviceId = serviceId;
}
/** Returns the actual service id in App Engine. */
String getServiceId() {
return serviceId;
}
}
/** Returns a copy of this connection that talks to a different service. */ /** Returns a copy of this connection that talks to a different service. */
public AppEngineConnection withService(Service service) { public AppEngineConnection withService(Service service) {
return new AppEngineConnection(service, requestFactory); return new AppEngineConnection(service, requestFactory);

View file

@ -26,7 +26,7 @@ import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.net.MediaType; import com.google.common.net.MediaType;
import google.registry.tools.AppEngineConnection.Service; import google.registry.request.Action.Service;
import java.util.List; import java.util.List;
@Parameters(separators = " =", commandDescription = "Send an HTTP command to the nomulus server.") @Parameters(separators = " =", commandDescription = "Send an HTTP command to the nomulus server.")

View file

@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSetMultimap; import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.flogger.FluentLogger; import com.google.common.flogger.FluentLogger;
import google.registry.config.RegistryConfig.Config; import google.registry.config.RegistryConfig.Config;
import google.registry.tools.AppEngineConnection.Service; import google.registry.request.Action.Service;
import google.registry.util.AppEngineServiceUtils; import google.registry.util.AppEngineServiceUtils;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;

View file

@ -41,10 +41,10 @@ import javax.inject.Inject;
/** Action that creates Google Groups for a registrar's mailing lists. */ /** Action that creates Google Groups for a registrar's mailing lists. */
@Action( @Action(
service = Action.Service.TOOLS,
path = CreateGroupsAction.PATH, path = CreateGroupsAction.PATH,
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class CreateGroupsAction implements Runnable { public class CreateGroupsAction implements Runnable {
public static final String PATH = "/_dr/admin/createGroups"; public static final String PATH = "/_dr/admin/createGroups";

View file

@ -35,10 +35,10 @@ import javax.inject.Inject;
* command. * command.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = CreatePremiumListAction.PATH, path = CreatePremiumListAction.PATH,
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class CreatePremiumListAction extends CreateOrUpdatePremiumListAction { public class CreatePremiumListAction extends CreateOrUpdatePremiumListAction {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -48,9 +48,9 @@ import javax.inject.Inject;
* exists an entity-specific deletion command, then use that one instead. * exists an entity-specific deletion command, then use that one instead.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = DeleteEntityAction.PATH, path = DeleteEntityAction.PATH,
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class DeleteEntityAction implements Runnable { public class DeleteEntityAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -65,14 +65,14 @@ import org.joda.time.Duration;
* MapReduce that requests generation of BIND zone files for a set of TLDs at a given time. * MapReduce that requests generation of BIND zone files for a set of TLDs at a given time.
* *
* <p>Zone files for each requested TLD are written to GCS. TLDs without entries produce zone files * <p>Zone files for each requested TLD are written to GCS. TLDs without entries produce zone files
* with only a header. The export time must be at least two minutes in the past and no more than * with only a header. The export time must be at least two minutes in the past and no more than 29
* 29 days in the past, and must be at midnight UTC. * days in the past, and must be at midnight UTC.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = GenerateZoneFilesAction.PATH, path = GenerateZoneFilesAction.PATH,
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonAction { public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonAction {
public static final String PATH = "/_dr/task/generateZoneFiles"; public static final String PATH = "/_dr/task/generateZoneFiles";

View file

@ -45,10 +45,10 @@ import javax.inject.Inject;
* the drastic consequences of accidental execution. * the drastic consequences of accidental execution.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = "/_dr/task/killAllCommitLogs", path = "/_dr/task/killAllCommitLogs",
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class KillAllCommitLogsAction implements Runnable { public class KillAllCommitLogsAction implements Runnable {
@Inject MapreduceRunner mrRunner; @Inject MapreduceRunner mrRunner;

View file

@ -41,10 +41,10 @@ import javax.inject.Inject;
* the drastic consequences of accidental execution. * the drastic consequences of accidental execution.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = "/_dr/task/killAllEppResources", path = "/_dr/task/killAllEppResources",
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_ONLY auth = Auth.AUTH_INTERNAL_ONLY)
)
public class KillAllEppResourcesAction implements Runnable { public class KillAllEppResourcesAction implements Runnable {
@Inject MapreduceRunner mrRunner; @Inject MapreduceRunner mrRunner;

View file

@ -41,6 +41,7 @@ import org.joda.time.DateTime;
/** An action that lists domains, for use by the {@code nomulus list_domains} command. */ /** An action that lists domains, for use by the {@code nomulus list_domains} command. */
@Action( @Action(
service = Action.Service.TOOLS,
path = ListDomainsAction.PATH, path = ListDomainsAction.PATH,
method = {GET, POST}, method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN) auth = Auth.AUTH_INTERNAL_OR_ADMIN)

View file

@ -32,10 +32,10 @@ import org.joda.time.DateTime;
/** An action that lists hosts, for use by the {@code nomulus list_hosts} command. */ /** An action that lists hosts, for use by the {@code nomulus list_hosts} command. */
@Action( @Action(
service = Action.Service.TOOLS,
path = ListHostsAction.PATH, path = ListHostsAction.PATH,
method = {GET, POST}, method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public final class ListHostsAction extends ListObjectsAction<HostResource> { public final class ListHostsAction extends ListObjectsAction<HostResource> {
public static final String PATH = "/_dr/admin/list/hosts"; public static final String PATH = "/_dr/admin/list/hosts";

View file

@ -29,10 +29,10 @@ import javax.inject.Inject;
* An action that lists premium lists, for use by the {@code nomulus list_premium_lists} command. * An action that lists premium lists, for use by the {@code nomulus list_premium_lists} command.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = ListPremiumListsAction.PATH, path = ListPremiumListsAction.PATH,
method = {GET, POST}, method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public final class ListPremiumListsAction extends ListObjectsAction<PremiumList> { public final class ListPremiumListsAction extends ListObjectsAction<PremiumList> {
public static final String PATH = "/_dr/admin/list/premiumLists"; public static final String PATH = "/_dr/admin/list/premiumLists";

View file

@ -27,10 +27,10 @@ import javax.inject.Inject;
/** An action that lists registrars, for use by the {@code nomulus list_registrars} command. */ /** An action that lists registrars, for use by the {@code nomulus list_registrars} command. */
@Action( @Action(
service = Action.Service.TOOLS,
path = ListRegistrarsAction.PATH, path = ListRegistrarsAction.PATH,
method = {GET, POST}, method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public final class ListRegistrarsAction extends ListObjectsAction<Registrar> { public final class ListRegistrarsAction extends ListObjectsAction<Registrar> {
public static final String PATH = "/_dr/admin/list/registrars"; public static final String PATH = "/_dr/admin/list/registrars";

View file

@ -27,10 +27,10 @@ import javax.inject.Inject;
/** A that lists reserved lists, for use by the {@code nomulus list_reserved_lists} command. */ /** A that lists reserved lists, for use by the {@code nomulus list_reserved_lists} command. */
@Action( @Action(
service = Action.Service.TOOLS,
path = ListReservedListsAction.PATH, path = ListReservedListsAction.PATH,
method = {GET, POST}, method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public final class ListReservedListsAction extends ListObjectsAction<ReservedList> { public final class ListReservedListsAction extends ListObjectsAction<ReservedList> {
public static final String PATH = "/_dr/admin/list/reservedLists"; public static final String PATH = "/_dr/admin/list/reservedLists";

View file

@ -31,10 +31,10 @@ import org.joda.time.DateTime;
/** An action that lists top-level domains, for use by the {@code nomulus list_tlds} command. */ /** An action that lists top-level domains, for use by the {@code nomulus list_tlds} command. */
@Action( @Action(
service = Action.Service.TOOLS,
path = ListTldsAction.PATH, path = ListTldsAction.PATH,
method = {GET, POST}, method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public final class ListTldsAction extends ListObjectsAction<Registry> { public final class ListTldsAction extends ListObjectsAction<Registry> {
public static final String PATH = "/_dr/admin/list/tlds"; public static final String PATH = "/_dr/admin/list/tlds";

View file

@ -30,7 +30,11 @@ import google.registry.request.auth.Auth;
import javax.inject.Inject; import javax.inject.Inject;
/** Action to poll the status of a mapreduce job. */ /** Action to poll the status of a mapreduce job. */
@Action(path = PollMapreduceAction.PATH, method = POST, auth = Auth.AUTH_INTERNAL_ONLY) @Action(
service = Action.Service.TOOLS,
path = PollMapreduceAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY)
public class PollMapreduceAction implements Runnable { public class PollMapreduceAction implements Runnable {
public static final String PATH = "/_dr/task/pollMapreduce"; public static final String PATH = "/_dr/task/pollMapreduce";

View file

@ -48,9 +48,9 @@ import org.joda.time.DateTimeZone;
* which only admin users can do. * which only admin users can do.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = "/_dr/task/refreshDnsForAllDomains", path = "/_dr/task/refreshDnsForAllDomains",
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class RefreshDnsForAllDomainsAction implements Runnable { public class RefreshDnsForAllDomainsAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -38,9 +38,9 @@ import javax.inject.Inject;
* which only admin users can do. * which only admin users can do.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = "/_dr/task/resaveAllHistoryEntries", path = "/_dr/task/resaveAllHistoryEntries",
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class ResaveAllHistoryEntriesAction implements Runnable { public class ResaveAllHistoryEntriesAction implements Runnable {
@Inject MapreduceRunner mrRunner; @Inject MapreduceRunner mrRunner;

View file

@ -33,10 +33,10 @@ import javax.inject.Inject;
* command. * command.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = UpdatePremiumListAction.PATH, path = UpdatePremiumListAction.PATH,
method = POST, method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_INTERNAL_OR_ADMIN)
)
public class UpdatePremiumListAction extends CreateOrUpdatePremiumListAction { public class UpdatePremiumListAction extends CreateOrUpdatePremiumListAction {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -34,6 +34,7 @@ import javax.inject.Inject;
* OT&amp;E commands that have been run just previously to verification may not be picked up yet. * OT&amp;E commands that have been run just previously to verification may not be picked up yet.
*/ */
@Action( @Action(
service = Action.Service.TOOLS,
path = VerifyOteAction.PATH, path = VerifyOteAction.PATH,
method = Action.Method.POST, method = Action.Method.POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN) auth = Auth.AUTH_INTERNAL_OR_ADMIN)

View file

@ -61,6 +61,7 @@ import javax.servlet.http.HttpServletRequest;
* Methods), separate this class to 2 Actions. * Methods), separate this class to 2 Actions.
*/ */
@Action( @Action(
service = Action.Service.DEFAULT,
path = ConsoleOteSetupAction.PATH, path = ConsoleOteSetupAction.PATH,
method = {Method.POST, Method.GET}, method = {Method.POST, Method.GET},
auth = Auth.AUTH_PUBLIC) auth = Auth.AUTH_PUBLIC)

View file

@ -52,10 +52,7 @@ import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** Action that serves Registrar Console single HTML page (SPA). */ /** Action that serves Registrar Console single HTML page (SPA). */
@Action( @Action(service = Action.Service.DEFAULT, path = ConsoleUiAction.PATH, auth = Auth.AUTH_PUBLIC)
path = ConsoleUiAction.PATH,
auth = Auth.AUTH_PUBLIC
)
public final class ConsoleUiAction implements Runnable { public final class ConsoleUiAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -41,7 +41,11 @@ import javax.inject.Inject;
* Admin servlet that allows creating or updating a registrar. Deletes are not allowed so as to * Admin servlet that allows creating or updating a registrar. Deletes are not allowed so as to
* preserve history. * preserve history.
*/ */
@Action(path = OteStatusAction.PATH, method = Action.Method.POST, auth = Auth.AUTH_PUBLIC_LOGGED_IN) @Action(
service = Action.Service.DEFAULT,
path = OteStatusAction.PATH,
method = Action.Method.POST,
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
public final class OteStatusAction implements Runnable, JsonActionRunner.JsonAction { public final class OteStatusAction implements Runnable, JsonActionRunner.JsonAction {
public static final String PATH = "/registrar-ote-status"; public static final String PATH = "/registrar-ote-status";

View file

@ -70,10 +70,10 @@ import org.joda.time.DateTime;
* preserve history. * preserve history.
*/ */
@Action( @Action(
service = Action.Service.DEFAULT,
path = RegistrarSettingsAction.PATH, path = RegistrarSettingsAction.PATH,
method = Action.Method.POST, method = Action.Method.POST,
auth = Auth.AUTH_PUBLIC_LOGGED_IN auth = Auth.AUTH_PUBLIC_LOGGED_IN)
)
public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonAction { public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonAction {
public static final String PATH = "/registrar-settings"; public static final String PATH = "/registrar-settings";

View file

@ -49,7 +49,11 @@ import org.joda.time.DateTime;
* @see WhoisHttpAction * @see WhoisHttpAction
* @see <a href="http://www.ietf.org/rfc/rfc3912.txt">RFC 3912: WHOIS Protocol Specification</a> * @see <a href="http://www.ietf.org/rfc/rfc3912.txt">RFC 3912: WHOIS Protocol Specification</a>
*/ */
@Action(path = "/_dr/whois", method = POST, auth = Auth.AUTH_PUBLIC_OR_INTERNAL) @Action(
service = Action.Service.PUBAPI,
path = "/_dr/whois",
method = POST,
auth = Auth.AUTH_PUBLIC_OR_INTERNAL)
public class WhoisAction implements Runnable { public class WhoisAction implements Runnable {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -95,7 +95,11 @@ import org.joda.time.Duration;
* *
* @see WhoisAction * @see WhoisAction
*/ */
@Action(path = WhoisHttpAction.PATH, isPrefix = true, auth = Auth.AUTH_PUBLIC_ANONYMOUS) @Action(
service = Action.Service.PUBAPI,
path = WhoisHttpAction.PATH,
isPrefix = true,
auth = Auth.AUTH_PUBLIC_ANONYMOUS)
public final class WhoisHttpAction implements Runnable { public final class WhoisHttpAction implements Runnable {
public static final String PATH = "/whois/"; public static final String PATH = "/whois/";

View file

@ -15,7 +15,9 @@ java_library(
], ],
deps = [ deps = [
"//java/google/registry/module/backend", "//java/google/registry/module/backend",
"//java/google/registry/request",
"//javatests/google/registry/testing", "//javatests/google/registry/testing",
"//third_party/java/truth",
"@javax_servlet_api", "@javax_servlet_api",
"@junit", "@junit",
"@org_mockito_all", "@org_mockito_all",

View file

@ -14,6 +14,10 @@
package google.registry.module.backend; package google.registry.module.backend;
import static com.google.common.truth.Truth.assertThat;
import google.registry.request.Action;
import google.registry.request.RouterDisplayHelper;
import google.registry.testing.GoldenFileTestHelper; import google.registry.testing.GoldenFileTestHelper;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -29,4 +33,12 @@ public class BackendRequestComponentTest {
.describedAs("backend routing map") .describedAs("backend routing map")
.isEqualToGolden(BackendRequestComponentTest.class, "backend_routing.txt"); .isEqualToGolden(BackendRequestComponentTest.class, "backend_routing.txt");
} }
@Test
public void testRoutingService() {
assertThat(
RouterDisplayHelper.extractHumanReadableRoutesWithWrongService(
BackendRequestComponent.class, Action.Service.BACKEND))
.isEmpty();
}
} }

View file

@ -15,7 +15,9 @@ java_library(
], ],
deps = [ deps = [
"//java/google/registry/module/frontend", "//java/google/registry/module/frontend",
"//java/google/registry/request",
"//javatests/google/registry/testing", "//javatests/google/registry/testing",
"//third_party/java/truth",
"@javax_servlet_api", "@javax_servlet_api",
"@junit", "@junit",
"@org_mockito_all", "@org_mockito_all",

View file

@ -14,7 +14,10 @@
package google.registry.module.frontend; package google.registry.module.frontend;
import static com.google.common.truth.Truth.assertThat;
import google.registry.request.Action;
import google.registry.request.RouterDisplayHelper;
import google.registry.testing.GoldenFileTestHelper; import google.registry.testing.GoldenFileTestHelper;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -30,4 +33,12 @@ public class FrontendRequestComponentTest {
.describedAs("frontend routing map") .describedAs("frontend routing map")
.isEqualToGolden(FrontendRequestComponentTest.class, "frontend_routing.txt"); .isEqualToGolden(FrontendRequestComponentTest.class, "frontend_routing.txt");
} }
@Test
public void testRoutingService() {
assertThat(
RouterDisplayHelper.extractHumanReadableRoutesWithWrongService(
FrontendRequestComponent.class, Action.Service.DEFAULT))
.isEmpty();
}
} }

View file

@ -15,7 +15,9 @@ java_library(
], ],
deps = [ deps = [
"//java/google/registry/module/pubapi", "//java/google/registry/module/pubapi",
"//java/google/registry/request",
"//javatests/google/registry/testing", "//javatests/google/registry/testing",
"//third_party/java/truth",
"@javax_servlet_api", "@javax_servlet_api",
"@junit", "@junit",
"@org_mockito_all", "@org_mockito_all",

View file

@ -14,7 +14,10 @@
package google.registry.module.pubapi; package google.registry.module.pubapi;
import static com.google.common.truth.Truth.assertThat;
import google.registry.request.Action;
import google.registry.request.RouterDisplayHelper;
import google.registry.testing.GoldenFileTestHelper; import google.registry.testing.GoldenFileTestHelper;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -30,4 +33,12 @@ public class PubApiRequestComponentTest {
.describedAs("pubapi routing map") .describedAs("pubapi routing map")
.isEqualToGolden(PubApiRequestComponentTest.class, "pubapi_routing.txt"); .isEqualToGolden(PubApiRequestComponentTest.class, "pubapi_routing.txt");
} }
@Test
public void testRoutingService() {
assertThat(
RouterDisplayHelper.extractHumanReadableRoutesWithWrongService(
PubApiRequestComponent.class, Action.Service.PUBAPI))
.isEmpty();
}
} }

View file

@ -15,7 +15,9 @@ java_library(
], ],
deps = [ deps = [
"//java/google/registry/module/tools", "//java/google/registry/module/tools",
"//java/google/registry/request",
"//javatests/google/registry/testing", "//javatests/google/registry/testing",
"//third_party/java/truth",
"@javax_servlet_api", "@javax_servlet_api",
"@junit", "@junit",
"@org_mockito_all", "@org_mockito_all",

View file

@ -14,6 +14,10 @@
package google.registry.module.tools; package google.registry.module.tools;
import static com.google.common.truth.Truth.assertThat;
import google.registry.request.Action;
import google.registry.request.RouterDisplayHelper;
import google.registry.testing.GoldenFileTestHelper; import google.registry.testing.GoldenFileTestHelper;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -29,4 +33,12 @@ public class ToolsRequestComponentTest {
.describedAs("tools routing map") .describedAs("tools routing map")
.isEqualToGolden(ToolsRequestComponentTest.class, "tools_routing.txt"); .isEqualToGolden(ToolsRequestComponentTest.class, "tools_routing.txt");
} }
@Test
public void testRoutingService() {
assertThat(
RouterDisplayHelper.extractHumanReadableRoutesWithWrongService(
ToolsRequestComponent.class, Action.Service.TOOLS))
.isEmpty();
}
} }

View file

@ -61,38 +61,38 @@ public final class RequestHandlerTest {
.build(); .build();
@Action( @Action(
service = Action.Service.DEFAULT,
path = "/bumblebee", path = "/bumblebee",
method = {GET, POST}, method = {GET, POST},
isPrefix = true, isPrefix = true,
auth = AUTH_PUBLIC auth = AUTH_PUBLIC)
)
public static class BumblebeeTask implements Runnable { public static class BumblebeeTask implements Runnable {
@Override @Override
public void run() {} public void run() {}
} }
@Action( @Action(
service = Action.Service.DEFAULT,
path = "/sloth", path = "/sloth",
method = POST, method = POST,
automaticallyPrintOk = true, automaticallyPrintOk = true,
auth = AUTH_PUBLIC auth = AUTH_PUBLIC)
)
public static class SlothTask implements Runnable { public static class SlothTask implements Runnable {
@Override @Override
public void run() {} public void run() {}
} }
@Action( @Action(
service = Action.Service.DEFAULT,
path = "/safe-sloth", path = "/safe-sloth",
method = {GET, POST}, method = {GET, POST},
auth = AUTH_PUBLIC auth = AUTH_PUBLIC)
)
public static class SafeSlothTask implements Runnable { public static class SafeSlothTask implements Runnable {
@Override @Override
public void run() {} public void run() {}
} }
@Action(path = "/fail", auth = AUTH_PUBLIC) @Action(service = Action.Service.DEFAULT, path = "/fail", auth = AUTH_PUBLIC)
public static final class FailTask implements Runnable { public static final class FailTask implements Runnable {
@Override @Override
public void run() { public void run() {
@ -100,7 +100,7 @@ public final class RequestHandlerTest {
} }
} }
@Action(path = "/failAtConstruction", auth = AUTH_PUBLIC) @Action(service = Action.Service.DEFAULT, path = "/failAtConstruction", auth = AUTH_PUBLIC)
public static final class FailAtConstructionTask implements Runnable { public static final class FailAtConstructionTask implements Runnable {
public FailAtConstructionTask() { public FailAtConstructionTask() {
throw new ServiceUnavailableException("Fail at construction"); throw new ServiceUnavailableException("Fail at construction");
@ -125,11 +125,7 @@ public final class RequestHandlerTest {
} }
} }
@Action( @Action(service = Action.Service.DEFAULT, path = "/auth/none", auth = AUTH_PUBLIC, method = GET)
path = "/auth/none",
auth = AUTH_PUBLIC,
method = GET
)
public class AuthNoneAction extends AuthBase { public class AuthNoneAction extends AuthBase {
AuthNoneAction(AuthResult authResult) { AuthNoneAction(AuthResult authResult) {
super(authResult); super(authResult);
@ -137,6 +133,7 @@ public final class RequestHandlerTest {
} }
@Action( @Action(
service = Action.Service.DEFAULT,
path = "/auth/adminUser", path = "/auth/adminUser",
auth = AUTH_INTERNAL_OR_ADMIN, auth = AUTH_INTERNAL_OR_ADMIN,
method = GET) method = GET)

Some files were not shown because too many files have changed in this diff Show more