1
0
Fork 0
mirror of https://github.com/Luzifer/share.git synced 2024-12-21 11:01:17 +00:00
share/vendor/github.com/aws/aws-sdk-go/service/machinelearning/customizations.go
Knut Ahlers 8f80d158ca
Move CLI util
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2017-12-02 19:12:46 +01:00

33 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
}