The query system specifically expects an Authorization. When a request
comes in using a Session, use the target task's Authorization, if we are
allowed to read it, when executing a query against the system bucket.
Also set the generated token's description while we're here.
This enables us to use task's Authorization when we need to query the
system bucket to get run logs, etc. but we only have a Session.
Task ID is now a required value on run and log filters. It was
effectively required by all implementations before anyway, so now those
types reflect that requirement.
Organization ID was removed from those same fields. The TaskService
looks up the organization ID via the task in cases where we need it at a
lower layer.
Accept token when creating or updating a task, but only report back the
authorization ID.
This means the executor and the platform adapter are now both aware of
an Authorization Service.
With the ongoing authorization work, creation arguments will differ from
what's returned on reads. More specifically, creation will accept a
token, but reads will report back a token ID.
This refactor facilitates that authorization work, and also brings the
code closer to the swagger definition, for the TaskCreateRequest type in
particular.
For an operation that looks up a task or a run, when that operation
fails, only set the status to 404 if that operation explicitly returns
ErrTaskNotFound or ErrRunNotFound.
It's possible that the operation could fail for a reason other than the
ID being invalid: for example, if there was an IO error preventing the
lookup from succeeding.
Harden that behavior with tests for the task handler.
Closes#11589.
I did this with a dumb editor macro, so some comments changed too.
Also rename root package from platform to influxdb.
In interest of minimizing risk, anyone importing the root package has
now aliased it to "platform" so that no changes beyond imports were
necessary in those files.
Lastly, replace the old platform module to local path /dev/null so that
nobody can accidentally reintroduce a platform dependency while
migrating platform code to influxdb.
* add labels to task links
* add labels to task responses
* add failing test
* fix label POST
* make fmt
* fix dashboard tests
* update swagger
* fix task service test labels
* add labels test for dashboards http service
* pull params out of newTaskResponse
* pull params out of newDashboardResponse
* make fmt
* add labels to dashboard response in swagger
* make context first argument
* fix test formatting
* feat(platform): add label struct
* feat(platform): add label service interface
* WIP label service
* chore(http): simplify URMapping validation
* WIP label service skeleton
* add new GET labels handler
* feat(http): add POST handler for label service
* feat(http): add label delete handler
* fix json tag
* add happy path testing
* feat(http): add label endpoints to dashboard service
* make fmt
* add label delete handler
* make fmt again :(
* feat(bolt): add label implementation
* wire boltdb implementation of labels
* feat(mock): add mock for label service
* fix tests, add delete test
* add remaining tests, flesh out GET params
* unused code
* remove comments
* add labels endpoints
* clean up labels after deleting a dashboard
* fix issues from code review
* WIP remove type from labels
* feat(http): add label cli functions
* fixes
* make fmt
* feat(http): add labels to tasks and buckets
* feat(bolt): remove labels if their resources are deleted
* remove bolt cleanup for now
* make fmt
* type conversion magic
* feat(inmem): implement label service
* prevent race conditions
* remove labels from inmem if their resources are deleted
* fix race condition
* fix formatting