func ProxyInstance(instance *ServiceInstance, path string, evt *event.Event, requestID string, w http.ResponseWriter, r *http.Request) error {
	service, err := Get(instance.ServiceName)
	if err != nil {
		return err
	}
	endpoint, err := service.getClient("production")
	if err != nil {
		return err
	}
	prefix := fmt.Sprintf("/resources/%s/", instance.GetIdentifier())
	path = strings.Trim(strings.TrimPrefix(path+"/", prefix), "/")
	for _, reserved := range reservedProxyPaths {
		if path == reserved && r.Method != "GET" {
			return &tsuruErrors.ValidationError{
				Message: fmt.Sprintf("proxy request %s %q is forbidden", r.Method, path),
			}
		}
	}
	return endpoint.Proxy(fmt.Sprintf("%s%s", prefix, path), evt, requestID, w, r)
}
func ProxyInstance(instance *ServiceInstance, path string, evt *event.Event, requestID string, w http.ResponseWriter, r *http.Request) error {
	service, err := Get(instance.ServiceName)
	if err != nil {
		return err
	}
	endpoint, err := service.getClient("production")
	if err != nil {
		return err
	}
	prefix := fmt.Sprintf("/resources/%s/", instance.GetIdentifier())
	path = strings.Trim(strings.TrimPrefix(path+"/", prefix), "/")
	for _, reserved := range reservedProxyPaths {
		if path == reserved && r.Method != "GET" {
			return &tsuruErrors.ValidationError{
				Message: fmt.Sprintf("proxy request %s %q is forbidden", r.Method, path),
			}
		}
	}
	return endpoint.Proxy(fmt.Sprintf("%s%s", prefix, path), evt, requestID, w, r)
}
func ProxyInstance ( instance * ServiceInstance , path string , evt * event . Event , requestID string , w http . ResponseWriter , r * http . Request ) error { service , err := Get ( instance . ServiceName ) if err != nil { return err } endpoint , err := service . getClient ( " " ) if err != nil { return err } prefix := fmt . Sprintf ( " " , instance . GetIdentifier ( ) ) path = strings . Trim ( strings . TrimPrefix ( path + " " , prefix ) , " " ) for _ , reserved := range reservedProxyPaths { if path == reserved && r . Method != " " { return & tsuruErrors . ValidationError { Message : fmt . Sprintf ( " " , r . Method , path ) , } } } return endpoint . Proxy ( fmt . Sprintf ( " " , prefix , path ) , evt , requestID , w , r ) }
// ProxyInstance is a proxy between tsuru and the service instance.
// This method allow customized service instance methods.
ProxyInstance is a proxy between tsuru and the service instance . This method allow customized service instance methods .