feat(http): move run id to path for logs

pull/10616/head
Jade McGough 2018-06-13 10:11:08 -07:00
parent 44df62891c
commit c0018b31f0
2 changed files with 5 additions and 18 deletions

View File

@ -727,7 +727,6 @@ components:
]
owner:
$ref: "#/components/schemas/User"
<<<<<<< HEAD
flux:
description: The Flux script to run for this task.
type: string
@ -738,18 +737,6 @@ components:
cron:
readOnly: true
description: A task repetition schedule in the form '* * * * * *'; parsed from Flux.
=======
query:
description: The ifql query to run for this task.
type: string
every:
readOnly: true
description: A simple task repetition schedule; parsed from query.
type: string
cron:
readOnly: true
description: A task repetition schedule in the form '* * * * * *'; parsed from query.
>>>>>>> update swagger
type: string
last:
$ref: "#/components/schemas/Run"

View File

@ -31,6 +31,8 @@ func NewTaskHandler() *TaskHandler {
h.HandlerFunc("DELETE", "/v1/tasks/:tid", h.handleDeleteTask)
h.HandlerFunc("GET", "/v1/tasks/:tid/logs", h.handleGetLogs)
h.HandlerFunc("GET", "/v1/tasks/:tid/runs/:rid/logs", h.handleGetLogs)
h.HandlerFunc("GET", "/v1/tasks/:tid/runs", h.handleGetRuns)
h.HandlerFunc("GET", "/v1/tasks/:tid/runs/:rid", h.handleGetRun)
h.HandlerFunc("POST", "/v1/tasks/:tid/runs/:rid/retry", h.handleRetryRun)
@ -294,9 +296,7 @@ func decodeGetLogsRequest(ctx context.Context, r *http.Request) (*getLogsRequest
return nil, err
}
qp := r.URL.Query()
if id := qp.Get("run"); id != "" {
if id := params.ByName("rid"); id != "" {
req.filter.Run = &platform.ID{}
if err := req.filter.Run.DecodeFromString(id); err != nil {
return nil, err
@ -367,12 +367,12 @@ func decodeGetRunsRequest(ctx context.Context, r *http.Request) (*getRunsRequest
}
if time := qp.Get("afterTime"); time != "" {
// TODO (jm): verify format is correct, once we've decided on a format
// TODO (jm): verify valid RFC3339
req.filter.AfterTime = time
}
if time := qp.Get("beforeTime"); time != "" {
// TODO (jm): verify format is correct, once we've decided on a format
// TODO (jm): verify valid RFC3339
req.filter.BeforeTime = time
}