// NewUploadHandler returns a new HTTP handler for the given args. func NewUploadHandler(args apihttp.NewHandlerArgs) http.Handler { return server.NewLegacyHTTPHandler( func(req *http.Request) (server.DataStore, names.Tag, error) { st, entity, err := args.Connect(req) if err != nil { return nil, nil, errors.Trace(err) } resources, err := st.Resources() if err != nil { return nil, nil, errors.Trace(err) } return resources, entity.Tag(), nil }, ) }
func newResourceHandler(httpCtxt httpContext) http.Handler { return server.NewLegacyHTTPHandler( func(req *http.Request) (server.DataStore, names.Tag, error) { st, entity, err := httpCtxt.stateForRequestAuthenticatedUser(req) if err != nil { return nil, nil, errors.Trace(err) } resources, err := st.Resources() if err != nil { return nil, nil, errors.Trace(err) } return resources, entity.Tag(), nil }, ) }