agent/handlers/v3/container_association_handler.go
func ContainerAssociationsHandler(state dockerstate.TaskEngineState) func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		containerID, err := getContainerIDByRequest(r, state)
		if err != nil {
			responseJSON, _ := json.Marshal(
				fmt.Sprintf("V3 container associations handler: unable to get container id from request: %s", err.Error()))
			utils.WriteJSONToResponse(w, http.StatusBadRequest, responseJSON, utils.RequestTypeContainerAssociations)
			return
		}

		taskARN, err := getTaskARNByRequest(r, state)
		if err != nil {
			responseJSON, _ := json.Marshal(
				fmt.Sprintf("V3 container associations handler: unable to get task arn from request: %s", err.Error()))
			utils.WriteJSONToResponse(w, http.StatusBadRequest, responseJSON, utils.RequestTypeContainerAssociations)
			return
		}

		associationType, err := getAssociationTypeByRequest(r)
		if err != nil {
			responseJSON, _ := json.Marshal(
				fmt.Sprintf("V3 container associations handler: %s", err.Error()))
			utils.WriteJSONToResponse(w, http.StatusBadRequest, responseJSON, utils.RequestTypeContainerAssociations)
			return
		}

		seelog.Infof("V3 container associations handler: writing response for container '%s' for association type %s", containerID, associationType)

		writeContainerAssociationsResponse(w, containerID, taskARN, associationType, state)
	}
}
func ContainerAssociationsHandler(state dockerstate.TaskEngineState) func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		containerID, err := getContainerIDByRequest(r, state)
		if err != nil {
			responseJSON, _ := json.Marshal(
				fmt.Sprintf("V3 container associations handler: unable to get container id from request: %s", err.Error()))
			utils.WriteJSONToResponse(w, http.StatusBadRequest, responseJSON, utils.RequestTypeContainerAssociations)
			return
		}

		taskARN, err := getTaskARNByRequest(r, state)
		if err != nil {
			responseJSON, _ := json.Marshal(
				fmt.Sprintf("V3 container associations handler: unable to get task arn from request: %s", err.Error()))
			utils.WriteJSONToResponse(w, http.StatusBadRequest, responseJSON, utils.RequestTypeContainerAssociations)
			return
		}

		associationType, err := getAssociationTypeByRequest(r)
		if err != nil {
			responseJSON, _ := json.Marshal(
				fmt.Sprintf("V3 container associations handler: %s", err.Error()))
			utils.WriteJSONToResponse(w, http.StatusBadRequest, responseJSON, utils.RequestTypeContainerAssociations)
			return
		}

		seelog.Infof("V3 container associations handler: writing response for container '%s' for association type %s", containerID, associationType)

		writeContainerAssociationsResponse(w, containerID, taskARN, associationType, state)
	}
}
// ContainerAssociationHandler returns the handler method for handling container associations requests.