Commit Graph

92 Commits (29a4ab0d27df40b0d4c1634291de35b0e30621fc)

Author SHA1 Message Date
Mark Rushakoff f79d9cba4f fix(task): pass task's authorization to query system, if using sessions
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.
2019-02-22 12:50:55 -08:00
Mark Rushakoff 12a604172f fix(task): create authorizations for tasks, which can read their task
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.
2019-02-22 09:15:25 -08:00
Mark Rushakoff ecb37d7cc4 fix(task): restore functionality for creating task with org name
This is a partial rollback of changes #12004. Issue to track adding a
test: #12089.
2019-02-21 16:30:52 -08:00
Lyon Hill 3665feef38
Populate organization name on task create action (#12004)
* Populate organization name on task create action

* Move the responsiblity of organization lookup to the platform adaptor
2019-02-20 13:36:35 -07:00
Mark Rushakoff abd6fee757 fix(task): use HTTP 404 for no results when listing runs, logs 2019-02-19 11:00:43 -08:00
Mark Rushakoff cbef811c63 refactor(task): remove explicit org from run/log lookup
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.
2019-02-16 14:34:49 -08:00
Lyon Hill 48cc643992
Clean out user from the task store's (#11882)
* Clean out user from the task store's
2019-02-15 15:50:09 -07:00
Mark Rushakoff 0977a651df fix(task): create authorization when using token to create task 2019-02-15 12:11:55 -08:00
Michael Desa c5b9376c0b
feat(http): add method to create authz for task when using session 2019-02-15 13:04:47 -05:00
Mark Rushakoff 007f5059c7 refactor(task): extract TaskCreate struct
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.
2019-02-12 15:10:03 -08:00
Lyon Hill 6db627b76c
Update task http handler to use user resource mapping. (#11827)
* Update task http handler to use user resource mapping.
2019-02-12 15:37:46 -07:00
Michael Desa 23f6c4b3fe fix(http): pass resource type through to label handlers
Co-authored-by: Iris Scholten <ischolten.is@gmail.com>
2019-02-07 19:08:56 -05:00
Michael Desa dbc241b728 fix(http): use urm without authz where appropriate 2019-02-06 14:24:21 -05:00
zhulongcheng 2d48b85f0a feat(http): construct label handler by LabelBackend 2019-02-06 19:18:23 +01:00
zhulongcheng be37e07bea feat(http): construct member handler by MemberBackend 2019-02-06 19:18:23 +01:00
zhulongcheng 18f4825e4f feat(http): construct task handler by TaskBackend 2019-02-06 19:18:23 +01:00
Lyon Hill ab2a7265a4
Add user resource management to the task API (#11664)
* Add user resource management to the task API
step 1 and 2 of #11427
2019-02-05 08:26:26 -08:00
Mark Rushakoff 3f0e40812e fix(http): return 404 when task or run is not found
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.
2019-01-25 15:44:09 -08:00
Kelvin Wang f99f4759fa fix(http): fix task errors 2019-01-25 10:31:24 -08:00
Kelvin Wang 875162abd3 update(http): remove check error true 2019-01-25 10:29:27 -08:00
Kelvin Wang 79ce30691e update(http): remove kerrors, change the default to be influxdb error 2019-01-25 10:29:26 -08:00
Mark Rushakoff 4df856c229 chore(task): add messages to all HTTP errors from tasks
Closes #11544.
2019-01-25 09:22:34 -08:00
Mark Rushakoff a0ff60c075 fix(task): respect limit when finding runs 2019-01-24 15:32:16 -08:00
Mark Rushakoff 04a86c92af fix(http): consistently use influxdb errors in task handlers
And ensure that the task HTTP client consistently expects influxdb
errors, so that they're properly extracted and returned to the caller.

Closes #11426.
2019-01-24 11:25:02 -08:00
Mark Rushakoff 6bda17c673 fix(task): use formal errors during task creation
The client expects influxdb.Error, so use them on the server.

Also clarify the message when the task option is missing.
2019-01-22 09:40:51 -08:00
Jade McGough 8a1d7ba1ba
Labels v2 (#11198)
* WIP first-class endpoint for labels

* WIP

* WIP

* add all the boilerplate

* fix boltdb

* fix http label test

* fix test

* WIP

* fix test failures

* reenable all tests

* add failing test for label mappings

* add label mapping bolt bucket

* implement resource -> label mapping fn

* add inmem label mapping

* delete label mappings

* remove unused stuff

* add missing functions

* add POST endpoint for labels

* add GET route for label

* delete label endpoint

* add label patch endpoint

* remove commented code

* add label service to api handler

* update comment

* add FindLabelByID test

* use platform.Error

* change path name

* formatting

* remove label patch from swagger

* avoid potential orphaned mapping bug

* guard against creating label mappings from nonexistent labels

* update swagger

* update swagger

* update swagger

* fix swagger indentation

* update swagger
2019-01-18 11:03:36 -08:00
Mark Rushakoff 27d854d771 fix(http): display platform error from task client 2019-01-18 10:25:06 -08:00
Lyon Hill 523e52d662
Show organization names in task api actions (#11223)
* Show organization names on task actions.

closes #10876
2019-01-18 09:10:14 -07:00
Michael Desa c60031a6b7 fix(influxdb): change resource to resource type 2019-01-15 12:57:57 -05:00
j. Emrys Landivar (docmerlin) a2674fa03d feat(tasks): update task options from api 2019-01-11 11:55:46 -06:00
Mark Rushakoff d73d73c0d4 chore: rename imports from platform to influxdb
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.
2019-01-09 20:51:47 -08:00
Jade McGough 0ddf6b3588
Label responses (#2165)
* 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
2019-01-02 11:17:28 -08:00
Andrew Watkins 3429e8d0c6
feat(auth): rewrite authorization service (#2157)
* feat(view-token-overlay): add view token overlay

* test(tokens): update tests

* chore(auths): rename mock data file

* feat(token-view): clicking on description opens token view modal

* feat(token-view): add ability to close overlay

* feat(token-view): display token permissions with updated permissions shape

* feat(token-view): wip update authorization and permission shapes

* feat(auth): wip refactor auth permissions

* fix(auth): generate permissions via functions

* fix(auth): make Id ID

* chore(types): update generated client

* feat(auth): wip add user and org names to auth

* fix(user): didnt save rebase

* feat(auth): WIP refactor auth

* feat(auth): check for user existence during auth creation

* feat(auth): org must exist during auth creation

* fix(auth): pluralize telegrafs resource type

* docs(http): update swagger definition for the Authorization

* test(auth): fix broken tests

* docs(swagger): update cur_swagger Authrorizations

* fix(api): remove trace from cur_swag

* test(ui/token): update components with new generated type definitions

* feat(http): add lookup service adding names for permissions

* fix(http): remove debugging panics

* chore: go tidy

* fix: unsaved rebase

* test(idpe): add ids to Authorizations for log tests
2018-12-28 15:02:19 -08:00
Mark Rushakoff 0e41f240f2 feat(task): support forcing a run with arbitrary timestamp
Also rename RetryAlreadyQueuedError by running:

gorename -from '"github.com/influxdata/platform/task/backend".RetryAlreadyQueuedError' -to RequestStillQueuedError

and some further manual cleanup for comments.
2018-12-21 14:37:53 -05:00
Chris Goller 31518b7022
Merge pull request #1562 from bednar/task_service
Fixed the task id path, Added RunController instance to pAdapter
2018-12-21 08:48:01 -06:00
Michael Desa 158be4b599
Merge pull request #1993 from zhulongcheng/fix-user-service
fix(http): pass user service to handler New function
2018-12-21 09:37:42 -05:00
Michael Desa 32bd37de9a fix(http): remove second potention call to w.WriteHeader
Multiple calls to w.WriteHeader were possible if there was an error that
was encountered while encoding the response. To resolve this, we simply
log any error that is encountered instead.
2018-12-20 11:11:09 -05:00
Jade McGough 786af8154e add patch label endpoints 2018-12-18 01:45:49 -08:00
zhulongcheng dcac51377e pass user service to handler New function 2018-12-17 23:59:30 +08:00
zhulongcheng 5f40883342 add custom-404 handler 2018-12-16 22:55:39 +08:00
zhulongcheng 7cd1994cd4 add ResourceType param to filter resource members 2018-12-15 00:18:50 +08:00
zhulongcheng 3b43d83da0 add UserService to members/owners endpoint handlers 2018-12-15 00:18:50 +08:00
zhulongcheng 851404fb06 fix(http/task): flatten runs response and links 2018-12-04 15:10:03 -08:00
Jade McGough 8c961e12bb
Labels (#1668)
* 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
2018-12-03 08:07:08 -08:00
Jade McGough 873aae3fad
Revert "feat(http): add label service" (#1667)
This reverts commit 70a430c599.
2018-12-03 04:27:27 -08:00
Jakub Bednar 3d99af0c78 Fixed the task id path, Added RunController instance to pAdapter 2018-12-03 08:23:10 +01:00
Jade McGough 70a430c599
feat(http): add label service (#1346) 2018-11-30 21:08:35 -08:00
j. Emrys Landivar (docmerlin) 7ffd18c7b8 remove requestedAt param from retry call and refactor TaskService interface 2018-11-30 13:14:21 -06:00
zhulongcheng d8c80fa50c add limit param to task service 2018-11-30 10:02:41 +08:00
Mark Rushakoff 45ec2265ac
Fix typo 2018-11-29 06:30:37 -08:00