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

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

View file

@ -35,10 +35,10 @@ import javax.inject.Inject;
* command.
*/
@Action(
path = CreatePremiumListAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN
)
service = Action.Service.TOOLS,
path = CreatePremiumListAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public class CreatePremiumListAction extends CreateOrUpdatePremiumListAction {
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.
*/
@Action(
path = DeleteEntityAction.PATH,
auth = Auth.AUTH_INTERNAL_OR_ADMIN
)
service = Action.Service.TOOLS,
path = DeleteEntityAction.PATH,
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public class DeleteEntityAction implements Runnable {
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.
*
* <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
* 29 days in the past, and must be at midnight UTC.
* with only a header. The export time must be at least two minutes in the past and no more than 29
* days in the past, and must be at midnight UTC.
*/
@Action(
path = GenerateZoneFilesAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN
)
service = Action.Service.TOOLS,
path = GenerateZoneFilesAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonAction {
public static final String PATH = "/_dr/task/generateZoneFiles";

View file

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

View file

@ -41,10 +41,10 @@ import javax.inject.Inject;
* the drastic consequences of accidental execution.
*/
@Action(
path = "/_dr/task/killAllEppResources",
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY
)
service = Action.Service.TOOLS,
path = "/_dr/task/killAllEppResources",
method = POST,
auth = Auth.AUTH_INTERNAL_ONLY)
public class KillAllEppResourcesAction implements Runnable {
@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. */
@Action(
service = Action.Service.TOOLS,
path = ListDomainsAction.PATH,
method = {GET, POST},
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. */
@Action(
path = ListHostsAction.PATH,
method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN
)
service = Action.Service.TOOLS,
path = ListHostsAction.PATH,
method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public final class ListHostsAction extends ListObjectsAction<HostResource> {
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.
*/
@Action(
path = ListPremiumListsAction.PATH,
method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN
)
service = Action.Service.TOOLS,
path = ListPremiumListsAction.PATH,
method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public final class ListPremiumListsAction extends ListObjectsAction<PremiumList> {
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. */
@Action(
path = ListRegistrarsAction.PATH,
method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN
)
service = Action.Service.TOOLS,
path = ListRegistrarsAction.PATH,
method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public final class ListRegistrarsAction extends ListObjectsAction<Registrar> {
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. */
@Action(
path = ListReservedListsAction.PATH,
method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN
)
service = Action.Service.TOOLS,
path = ListReservedListsAction.PATH,
method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public final class ListReservedListsAction extends ListObjectsAction<ReservedList> {
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. */
@Action(
path = ListTldsAction.PATH,
method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN
)
service = Action.Service.TOOLS,
path = ListTldsAction.PATH,
method = {GET, POST},
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public final class ListTldsAction extends ListObjectsAction<Registry> {
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;
/** 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 static final String PATH = "/_dr/task/pollMapreduce";

View file

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

View file

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

View file

@ -33,10 +33,10 @@ import javax.inject.Inject;
* command.
*/
@Action(
path = UpdatePremiumListAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN
)
service = Action.Service.TOOLS,
path = UpdatePremiumListAction.PATH,
method = POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
public class UpdatePremiumListAction extends CreateOrUpdatePremiumListAction {
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.
*/
@Action(
service = Action.Service.TOOLS,
path = VerifyOteAction.PATH,
method = Action.Method.POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN)