Commit Graph

50 Commits (bbc37b4c6814d428d2e423fbac777a9139640be5)

Author SHA1 Message Date
Alirie Gray c04f3a2b30 chore(tasks): remove old auth code and allow only token auth 2019-07-26 09:51:32 -07:00
Jorge Landivar 47cd6df834 fix(http): task runs and logs no longer use task token (#14416)
* fix(http): task runs and logs no longer use task token

* test(http): skip session tests

These tests are not using checking authorization correctly.
2019-07-23 10:31:39 -05:00
Alirie Gray c7f09d6a56
chore(tasks): use pointers for task errors (#14343) 2019-07-15 13:57:51 -07:00
Kelvin Wang 9ecada4dce feat(http): convert errorEncode to use interface 2019-06-26 21:41:01 -04:00
Alirie Gray 66157c9d44 chore(tasks): consolidate task errors into task_errors.go 2019-06-17 16:03:18 -07:00
Alirie Gray 576da8f9d2 fix(swagger): add log property to task runs endpoint docs 2019-05-17 14:08:10 -07:00
Alirie Gray 77934b01c6 feat(tasks): add description field to tasks 2019-05-08 13:39:09 -07:00
Jade McGough c27a96da9a
chore(http): surface unmarshaling failures in tests (#13855) 2019-05-08 12:51:03 -07:00
Kelvin Wang 7a72c363f2 remove org from bucket 2019-04-22 18:39:05 -04:00
Todd Persen cd64ec8718 Fix typos in miscellaneous packages 2019-04-17 13:30:22 -07:00
kelwang be674622c6
Revert "fix(inmem): remove the old inmem implementation" 2019-04-09 14:24:40 -04:00
zhulongcheng cacd6a8223 fix(inmem): replace inmem.Service with kv.Service 2019-04-08 15:18:38 +08:00
Mark Rushakoff 3092faace8 test(task): ensure task can be created over HTTP using org name
Closes #12089.
2019-03-14 21:23:14 -07:00
zhulongcheng b8a9c9595d feat(http): add task paging links 2019-03-06 15:06:35 +08:00
Lyon Hill 17026c2053
change task logs from a string to a struct (#12363)
* change task logs from a string to a struct
2019-03-05 15:58:33 -07:00
Jorge Landivar 9e6a2247c0
Merge pull request #12134 from zhulongcheng/validate-task-status
fix(http): validate status for creating and updating a task
2019-02-27 13:08:06 -06:00
docmerlin (j. Emrys Landivar) 669c464335 feat(tasks): look up tasks by orgname 2019-02-25 15:57:01 -06:00
zhulongcheng efadd43886 fix(http): validate status for creating and updating a task 2019-02-24 15:34:32 +08:00
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
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
Lyon Hill c7f60271fd
remove task owner from task struct (#11968)
* remove task owner from the payload

* clean user references in store and tests
2019-02-19 11:19:06 -07: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
Mark Rushakoff caf08b5078 feat(task): store authorization ID with task
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.
2019-02-14 08:53:40 -08: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 f271d0a580 test(http): add tests to ensure labels can be added to resources
Co-authored-by: Iris Scholten <ischolten.is@gmail.com>
2019-02-07 19:08:59 -05:00
Leonardo Di Donato b60ac48f6c fix(http): task service should use new task backend also when testing user resource mappings
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
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
Lyon Hill bdf65f5dfe
Remove owner from task json responses (#11504)
* Remove owner from task json responses

* allow for crud to run in parallel with other tests

To be parallel we just cant assume we only have 1 task.
2019-01-24 16:05:24 -07: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
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 7c1372cdfc fix(influxdb): rename organizationID to orgID in json struct tags
Note. This may require that users blow away thier existing boltdb
databases to avoid errors.
2019-01-14 18:12:46 -08: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 7562c9a6d2
chore(http): make test diffs more readable (#2203)
* chore(http): make test diffs more readable

* fixes

* add back telegraf output spacing

* whitespace hell

* jsonEqual2 -> jsonEqual
2019-01-03 14:29:22 -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
Chris Goller edfb323472 fix(http): update task test to use :id
Fixes merge issue from #1562
2018-12-21 09:11:57 -06:00
zhulongcheng dcac51377e pass user service to handler New function 2018-12-17 23:59:30 +08:00
Jade McGough 46257f7ef1
fix(test): pass label service to task handler in tests (#1706) 2018-12-04 15:20:46 -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
Jade McGough 70a430c599
feat(http): add label service (#1346) 2018-11-30 21:08:35 -08:00
zhulongcheng 07874d6246 add tests for /tasks endpoint 2018-11-21 10:08:20 -08:00