mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* Logs should support specifying region when using S3-compatible object store * Use aws-sdk-go client for s3 backed logstore * fixes vendor with aws-sdk-go dependencies
34 lines
649 B
Go
34 lines
649 B
Go
package machinelearning
|
|
|
|
import (
|
|
"net/url"
|
|
|
|
"github.com/aws/aws-sdk-go/aws/request"
|
|
)
|
|
|
|
func init() {
|
|
initRequest = func(r *request.Request) {
|
|
switch r.Operation.Name {
|
|
case opPredict:
|
|
r.Handlers.Build.PushBack(updatePredictEndpoint)
|
|
}
|
|
}
|
|
}
|
|
|
|
// updatePredictEndpoint rewrites the request endpoint to use the
|
|
// "PredictEndpoint" parameter of the Predict operation.
|
|
func updatePredictEndpoint(r *request.Request) {
|
|
if !r.ParamsFilled() {
|
|
return
|
|
}
|
|
|
|
r.ClientInfo.Endpoint = *r.Params.(*PredictInput).PredictEndpoint
|
|
|
|
uri, err := url.Parse(r.ClientInfo.Endpoint)
|
|
if err != nil {
|
|
r.Error = err
|
|
return
|
|
}
|
|
r.HTTPRequest.URL = uri
|
|
}
|