From 1ffe9f75f55b3fbcc822fedd17f14c9248789efa Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Mon, 7 Dec 2020 06:41:16 -0800 Subject: [PATCH] Use a : character followed by the custom verb in HTTP URL Following the recommendation from google.aip.dev/136 --- main.go | 7 ++++--- ui/src/api.ts | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index d5272cb..ed29ab3 100644 --- a/main.go +++ b/main.go @@ -71,15 +71,16 @@ func main() { api.HandleFunc("/queues", newListQueuesHandlerFunc(inspector)).Methods("GET") api.HandleFunc("/queues/{qname}", newGetQueueHandlerFunc(inspector)).Methods("GET") api.HandleFunc("/queues/{qname}", newDeleteQueueHandlerFunc(inspector)).Methods("DELETE") - api.HandleFunc("/queues/{qname}/pause", newPauseQueueHandlerFunc(inspector)).Methods("POST") - api.HandleFunc("/queues/{qname}/resume", newResumeQueueHandlerFunc(inspector)).Methods("POST") + api.HandleFunc("/queues/{qname}:pause", newPauseQueueHandlerFunc(inspector)).Methods("POST") + api.HandleFunc("/queues/{qname}:resume", newResumeQueueHandlerFunc(inspector)).Methods("POST") // Task endpoints. api.HandleFunc("/queues/{qname}/active_tasks", newListActiveTasksHandlerFunc(inspector)).Methods("GET") - api.HandleFunc("/queues/{qname}/active_tasks/{task_id}/cancel", newCancelActiveTaskHandlerFunc(inspector)).Methods("POST") + api.HandleFunc("/queues/{qname}/active_tasks/{task_id}:cancel", newCancelActiveTaskHandlerFunc(inspector)).Methods("POST") api.HandleFunc("/queues/{qname}/pending_tasks", newListPendingTasksHandlerFunc(inspector)).Methods("GET") api.HandleFunc("/queues/{qname}/scheduled_tasks", newListScheduledTasksHandlerFunc(inspector)).Methods("GET") api.HandleFunc("/queues/{qname}/scheduled_tasks/{task_key}", newDeleteTaskHandlerFunc(inspector)).Methods("DELETE") + // api.HandleFunc("/queues/{qname}/scheduled_tasks:delete_all", newDeleteAllScheduledTasksTaskHandlerFunc(inspector)).Methods("DELETE") api.HandleFunc("/queues/{qname}/retry_tasks", newListRetryTasksHandlerFunc(inspector)).Methods("GET") api.HandleFunc("/queues/{qname}/retry_tasks/{task_key}", newDeleteTaskHandlerFunc(inspector)).Methods("DELETE") api.HandleFunc("/queues/{qname}/dead_tasks", newListDeadTasksHandlerFunc(inspector)).Methods("GET") diff --git a/ui/src/api.ts b/ui/src/api.ts index 4e31479..e91a52a 100644 --- a/ui/src/api.ts +++ b/ui/src/api.ts @@ -144,14 +144,14 @@ export async function deleteQueue(qname: string): Promise { export async function pauseQueue(qname: string): Promise { await axios({ method: "post", - url: `${BASE_URL}/queues/${qname}/pause`, + url: `${BASE_URL}/queues/${qname}:pause`, }); } export async function resumeQueue(qname: string): Promise { await axios({ method: "post", - url: `${BASE_URL}/queues/${qname}/resume`, + url: `${BASE_URL}/queues/${qname}:resume`, }); } @@ -176,7 +176,7 @@ export async function cancelActiveTask( ): Promise { await axios({ method: "post", - url: `${BASE_URL}/queues/${qname}/active_tasks/${taskId}/cancel`, + url: `${BASE_URL}/queues/${qname}/active_tasks/${taskId}:cancel`, }); }