Commit Graph
38 Commits
Author SHA1 Message Date
Lingxian KongandSoam Vasani a3f8016442 Set correct Content-Type in the http response (#147)
When the request is handled successfully, json data is returned, this
patch changes the response Content-Type header from text/plain to
application/json

Fixes: #144
2017-03-21 13:51:54 -07:00
Robert HerholdandSoam Vasani e1cb5f6e09 Return HTTP status 201 for created resources (#148)
Have the controller return status 201 for created resources, and have the client check for 201 response on created resources.

#143
2017-03-12 20:05:19 -07:00
yang qfandSoam Vasani a6869ab746 Fix function delete with uid (#142)
If no uid is provided, all versions of function files and function metadata will be deleted.  If a uid is provided, only that specific version is deleted, and the "latest" version of the function moves back to the previous one.

Fixes #152
2017-03-12 13:04:56 -07:00
Soam VasaniandGitHub 8cf382c2b3 Handle errors in filestore init (#127)
Fixes issue #108
2017-02-17 15:21:36 -08:00
Toby CrawleyandSoam Vasani ab6e2e8021 Improve command-line client error output (#122)
Motivation: The output when an error occurs shows an integer error code,
which isn't very helpful. And in the case of an error when creating a
resource, you also get a redundant log message from the controller
client.

Modifications:
* the controller client no longer logs errors
* the generated String() allows for the enum name to be displayed in the
  error output
* each errorCode enum member has a hand-generated description
* the format of the error message from the CLI client was modified to
  display the error description with the error message

Related to #112
2017-02-16 13:58:59 -08:00
Kaustubh PhatakandSoam Vasani 9e5db82cc9 Check for unique HTTP route & method (#102) (#111)
Check for uniqueness in HTTP routes, returning error 409 when a route + method combination is duplicated.
2017-02-13 15:58:19 -08:00
Toby CrawleyandSoam Vasani 430639a1cf Report KeyNotFound from etcd as a 404 (#121)
This allows for proper classification of the error on the client side.
2017-02-13 13:16:12 -08:00
Toby CrawleyandSoam Vasani c8b5bb2972 Better convey duplicate name errors to client (#116)
Motivation: Creating duplicate resources currently results in a 500
error being displayed by the client, with no information about the true
nature of the failure.

Modifications:
* ResourceStore now converts any errors from the etcd client into
  fission errors, capturing the reason for the error in the case of a
  duplicate key (as ErrorNameExists)
* ErrorNameExists errors are signaled to the client with a
  409 (Conflict) HTTP status
* MakeErrorFromHTTP() now reads the body of the error response to
  retrieve the actual error message instead of using the HTTP status
  message
* the controller client now uses MakeErrorFromHTTP() to centralize
  status code -> error code mapping
* tests for all of the resources now check that duplicate resources are
  reported properly

Result: The client can now provide more context when a duplicate name is
given

related to #112
2017-02-13 08:58:52 -08:00
Ta-Ching ChenandSoam Vasani 14c55912f5 Fix failure to delete function when function's file doesn't exist (#118) 2017-02-10 23:38:13 -08:00
J. Gavin Ray 943d430870 # This is a combination of 2 commits.
# This is the 1st commit message:

Changed package names to match the new organization

# This is the commit message #2:

Forgot Cache
2016-12-24 08:11:35 -08:00
Soam Vasani 8704761fd0 watch.Url renamed to watch.Target 2016-12-20 12:11:54 -08:00
Soam Vasani 0fb4cc1536 Use latest version of function for watches 2016-12-11 00:07:25 -08:00
Soam Vasani 188280488c Fix bug in populating watch url 2016-12-10 19:53:13 -08:00
Soam Vasani a69834157f Controller crud for Watch type
Controller and client crud, API routes, and a unit test for the Watch
type.
2016-12-09 23:42:03 -08:00
Soam Vasani 2a9f229c17 Fix incorrect JSON in version message 2016-11-15 14:33:31 -08:00
Soam Vasani 3533c158d6 Add version to controller API 2016-11-07 14:33:00 -08:00
Soam Vasani a5ae7688ce Make *Update functions consistently return fission.Metadata 2016-11-04 22:57:11 -07:00
Soam Vasani b1587551d5 Filestore - create path if it doesn't exist 2016-11-02 16:06:27 -07:00
Soam Vasani f8a1fdf4c6 Improve logging in controller, fetcher, poolmgr
TODO: most of these should be in a debug loglevel.
2016-11-02 15:06:55 -07:00
Soam Vasani 49acdc49eb Fix resource store errors on empty db 2016-11-02 00:23:06 -07:00
Soam Vasani 8b8e8c6539 Trim server url in client init 2016-11-01 18:11:21 -07:00
Soam Vasani 01bfa8b082 Minor changes; remove noisy test logs 2016-11-01 01:32:02 -07:00
Soam Vasani a93c17548c Add exports that make controller usable 2016-10-29 20:38:50 -07:00
Soam Vasani 012a8de1ec Add API version to URLs 2016-09-29 21:41:52 -07:00
Soam Vasani 9a65c8a6fb Undo changes to client function obj 2016-09-22 01:11:17 -07:00
Soam Vasani 79fb54820e Base64 encode the code in json objects.
This will make the API easier for clients.  Also add a ?raw=1 flag to
the function GET API, to get just the code of the function.
2016-09-22 01:07:34 -07:00
Soam Vasani 6b67bc0a61 API for environments
Environments for functions. For now this is just the image URL for the
function run container. In the future, Environments will also have
build container image URLs, and perhaps parameters to those
containers.

Create/read/update/delete/list. Versioning will be added later. For
now, only the latest update is stored.
2016-09-21 22:29:51 -07:00
Soam Vasani f7757bdcc1 Add HTTP trigger API and client
This implemenents create/read/update/delete/list for http triggers.
This isn't quite the final implementation: you can't look up old
versions by UUID since it only stores the latest update.  I'll get to
that later.
2016-09-21 15:56:29 -07:00
Soam Vasani fee2fb1d70 Helper func to connect to etcd 2016-09-20 21:58:53 -07:00
Soam Vasani 16a75c8887 Remove call to the validator function
(This will be better handled in a higher layer.)
2016-09-20 10:51:44 -07:00
Soam Vasani f02f58cd12 Controller API unit tests 2016-09-20 00:54:26 -07:00
Soam Vasani 72ff031624 Controller API client.
Just Functions so far.
2016-09-20 00:53:57 -07:00
Soam Vasani 14734f6435 HTTP API for Functions
So far, just Function create/read/update/delete/list.  FunctionApi
glues HTTP request/response to functionStore.
2016-09-20 00:45:13 -07:00
Soam Vasani be16c6a2aa Minor stuff: debug logs, unit test update 2016-09-20 00:44:19 -07:00
Soam Vasani a0cfadbd73 Fix deleteFile (missing deletes for etcd metadata)
Also move resource and serializer interfaces to types.go
2016-09-20 00:25:50 -07:00
Soam Vasani 7963d7527c Wrap resourceStore for Functions, HTTPTriggers and Environments
FunctionStore uses fileStore for function code and resourceStore for
the Function's metadata.  Environment- and HTTPTrigger- Store are just
thin wrappers on resourceStore.

There is probably a better way to organize this code, maybe with
reflection.
2016-09-20 00:12:21 -07:00
Soam Vasani 94899a88a7 Some sort of generic etcd-backed store
- A generic Resource interface, which is serializable and has
  a key() method to get an identifying key.

- A resourceStore, which has create, read, update, delete and list.
  This wraps etcd key operations and serialization/deserialization in
  a convenient service.  Serialization is provided to the
  resourceStore as a 'serialization' interface.  This can be JSON or
  anything else.

- The resourceStore also has file operations -- this has read, write
  and delete operations.  The general idea is to store metadata in
  etcd and data on the fileStore (which could also be an object store,
  we don't really use any file-specific properties).  Files are also
  versioned -- each writeFile writes to a new UUID and that UUID is
  stored in an etcd in-order list.  readFile can retrieve an arbitrary
  version by UUID, or just get the latest contents.
2016-09-10 01:01:27 -07:00
Soam Vasani 5c336043db Move /src/controller/ to /controller 2016-09-10 01:01:27 -07:00