Merge branch 'master' into 15577-ownership-transfer
[arvados.git] / lib / controller / router / router.go
index f37c7ea9073ac51c0553ecf03c91ff4a9b1b2e92..d3bdce527211e1b26245a820dcbc9cd174f3dc62 100644 (file)
@@ -10,7 +10,6 @@ import (
        "net/http"
        "strings"
 
-       "git.curoverse.com/arvados.git/lib/controller/federation"
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/auth"
        "git.curoverse.com/arvados.git/sdk/go/ctxlog"
@@ -24,10 +23,10 @@ type router struct {
        fed arvados.API
 }
 
-func New(cluster *arvados.Cluster) *router {
+func New(fed arvados.API) *router {
        rtr := &router{
                mux: httprouter.New(),
-               fed: federation.New(cluster),
+               fed: fed,
        }
        rtr.addRoutes()
        return rtr
@@ -41,6 +40,20 @@ func (rtr *router) addRoutes() {
                defaultOpts func() interface{}
                exec        routableFunc
        }{
+               {
+                       arvados.EndpointConfigGet,
+                       func() interface{} { return &struct{}{} },
+                       func(ctx context.Context, opts interface{}) (interface{}, error) {
+                               return rtr.fed.ConfigGet(ctx)
+                       },
+               },
+               {
+                       arvados.EndpointLogin,
+                       func() interface{} { return &arvados.LoginOptions{} },
+                       func(ctx context.Context, opts interface{}) (interface{}, error) {
+                               return rtr.fed.Login(ctx, *opts.(*arvados.LoginOptions))
+                       },
+               },
                {
                        arvados.EndpointCollectionCreate,
                        func() interface{} { return &arvados.CreateOptions{} },
@@ -257,7 +270,7 @@ func (rtr *router) addRoute(endpoint arvados.APIEndpoint, defaultOpts func() int
                        rtr.sendError(w, err)
                        return
                }
-               rtr.sendResponse(w, resp, respOpts)
+               rtr.sendResponse(w, req, resp, respOpts)
        })
 }