github.com/aavshr/aws-sdk-go@v1.41.3/service/machinelearning/customizations.go (about)

     1  package machinelearning
     2  
     3  import (
     4  	"net/url"
     5  
     6  	"github.com/aavshr/aws-sdk-go/aws/request"
     7  )
     8  
     9  func init() {
    10  	initRequest = func(r *request.Request) {
    11  		switch r.Operation.Name {
    12  		case opPredict:
    13  			r.Handlers.Build.PushBack(updatePredictEndpoint)
    14  		}
    15  	}
    16  }
    17  
    18  // updatePredictEndpoint rewrites the request endpoint to use the
    19  // "PredictEndpoint" parameter of the Predict operation.
    20  func updatePredictEndpoint(r *request.Request) {
    21  	if !r.ParamsFilled() {
    22  		return
    23  	}
    24  
    25  	r.ClientInfo.Endpoint = *r.Params.(*PredictInput).PredictEndpoint
    26  
    27  	uri, err := url.Parse(r.ClientInfo.Endpoint)
    28  	if err != nil {
    29  		r.Error = err
    30  		return
    31  	}
    32  	r.HTTPRequest.URL = uri
    33  }