You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: aliyun_action_proxy.go
    path of file: ./repos/erda/internal/apps/cmp/endpoints
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// 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 p
    
func (e *Endpoints) DoRemoteAction(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
	var req apistructs.RemoteActionRequest
	if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
		logrus.Errorf("unmarshal to remoteactionrequest failed, err: %+v", err)
		return err
	}
	ctx = context.WithValue(ctx, "i18nPrinter", message.NewPrinter(language.English))
	akCtx, resp := e.mkCtx(ctx, req.OrgID)
	if resp != nil {
		err := fmt.Errorf("mkCtx failed, orgId: %s", req.OrgID)
		logrus.Error(err.Error())
		return err
	}
	regionId := acquireClusterRegion(akCtx, req.ClusterName)
	client := &aliyunclient.Client{}
	err := client.InitWithAccessKey(regionId, akCtx.AccessKeyID, akCtx.AccessSecret)
	if err != nil {
		logrus.Errorf("init aliyun client failed, err: %+v", err)
		return err
	}
	client.EndpointMap = req.EndpointMap
	client.EndpointType = req.EndpointType
	rpcRequest := &requests.RpcRequest{}
	rpcRequest.InitWithApiInfo(req.Product, req.Version, req.ActionName, req.LocationServiceCode, req.LocationEndpointType)
	rpcRequest.Scheme = req.Scheme
	rpcRequest.QueryParams = req.QueryParams
	rpcRequest.Headers = req.Headers
	rpcRequest.FormParams = req.FormParams
	response, err := client.GetActionResponse(rpcRequest)
	if err != nil {
		logrus.Errorf("get action response failed, err:%+v", err)
		return err
	}
	defer response.Body.Close()
	for key, values := range response.Header {
		for _, value := range values {
			w.Header().Add(key, value)
		}
	}
	w.WriteHeader(response.StatusCode)
	respBody, err := ioutil.ReadAll(response.Body)
	if err != nil {
		logrus.Errorf("read body falied, err:%+v", err)
	}
	_, err = w.Write(respBody)
	if err != nil {
		logrus.Errorf("write response failed, err:%+v", err)
		return err
	}
	return nil
}