agent/handlers/v3/container_association_handler.go
func ContainerAssociationHandler(state dockerstate.TaskEngineState) func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		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.RequestTypeContainerAssociation)
			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.RequestTypeContainerAssociation)
			return
		}

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

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

		writeContainerAssociationResponse(w, taskARN, associationType, associationName, state)
	}
}
func ContainerAssociationHandler(state dockerstate.TaskEngineState) func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		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.RequestTypeContainerAssociation)
			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.RequestTypeContainerAssociation)
			return
		}

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

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

		writeContainerAssociationResponse(w, taskARN, associationType, associationName, state)
	}
}
func ContainerAssociationHandler ( state dockerstate . TaskEngineState ) func ( http . ResponseWriter , * http . Request ) { return func ( w http . ResponseWriter , r * http . Request ) { taskARN , err := getTaskARNByRequest ( r , state ) if err != nil { responseJSON , _ := json . Marshal ( fmt . Sprintf ( " " , err . Error ( ) ) ) utils . WriteJSONToResponse ( w , http . StatusBadRequest , responseJSON , utils . RequestTypeContainerAssociation ) return } associationType , err := getAssociationTypeByRequest ( r ) if err != nil { responseJSON , _ := json . Marshal ( fmt . Sprintf ( " " , err . Error ( ) ) ) utils . WriteJSONToResponse ( w , http . StatusBadRequest , responseJSON , utils . RequestTypeContainerAssociation ) return } associationName , err := getAssociationNameByRequest ( r ) if err != nil { responseJSON , _ := json . Marshal ( fmt . Sprintf ( " " , err . Error ( ) ) ) utils . WriteJSONToResponse ( w , http . StatusBadRequest , responseJSON , utils . RequestTypeContainerAssociation ) return } seelog . Infof ( " " , associationName , associationType ) writeContainerAssociationResponse ( w , taskARN , associationType , associationName , state ) } }
// ContainerAssociationHandler returns the handler method for handling container association requests.
ContainerAssociationHandler returns the handler method for handling container association requests .