Files
fission-src/controller/storagesvc.go
T
Soam VasaniandGitHub 8d103fa35b Large functions: API proxy for storage svc, upload support in the CLI (#304)
This change contains CLI support for uploading large functions to the storage service.

It also adds a reverse proxy into the storage service to the fission API.

The helm chart is not yet updated to actually run the storage service -- that will come in the next change.
2017-08-31 15:42:59 -07:00

39 lines
1016 B
Go

/*
Copyright 2017 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package controller
import (
"fmt"
"log"
"net/http"
"net/http/httputil"
"net/url"
)
func (api *API) StorageServiceProxy(w http.ResponseWriter, r *http.Request) {
u := api.storageServiceUrl + "/v1/archive"
ssUrl, err := url.Parse(u)
if err != nil {
msg := fmt.Sprintf("Error parsing url %v: %v", u, err)
log.Println(msg)
http.Error(w, msg, 500)
return
}
proxy := httputil.NewSingleHostReverseProxy(ssUrl)
proxy.ServeHTTP(w, r)
}