func CompatHandler(w http.ResponseWriter, req *http.Request) {
	if bbpd_runinfo.BBPDAbortIfClosed(w) {
		return
	}
	// look for the X-Amz-Target header
	target_, target_ok := req.Header[aws_const.AMZ_TARGET_HDR]
	if !target_ok {
		e := fmt.Sprintf("bbpd_route.CompatHandler:missing %s", aws_const.AMZ_TARGET_HDR)
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
	target := target_[0]
	normalized_target := target
	target_version_delim := "."
	// allow the header to have the API version string or not
	if strings.Contains(target, target_version_delim) {
		vers_target := strings.SplitN(target, target_version_delim, 2)
		if vers_target[0] != aws_const.CURRENT_API_VERSION {
			e := fmt.Sprintf("bbpd_route.CompatHandler:unsupported API version '%s'", vers_target[0])
			log.Printf(e)
			http.Error(w, e, http.StatusBadRequest)
			return
		}
		normalized_target = vers_target[1]
	}
	endpoint_path := "/" + normalized_target
	if endpoint_path == COMPATPATH || normalized_target == "" {
		e := fmt.Sprintf("bbpd_route.CompatHandler:must call named endpoint")
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}

	// call the proper handler for the header
	switch endpoint_path {
	case DESCRIBETABLEPATH:
		describe_table_route.RawPostHandler(w, req)
		return
	case LISTTABLESPATH:
		list_tables_route.RawPostHandler(w, req)
		return
	case CREATETABLEPATH:
		create_table_route.RawPostHandler(w, req)
		return
	case UPDATETABLEPATH:
		update_table_route.RawPostHandler(w, req)
		return
	case STATUSTABLEPATH:
		describe_table_route.StatusTableHandler(w, req)
		return
	case PUTITEMPATH:
		put_item_route.RawPostHandler(w, req)
		return
	case GETITEMPATH:
		get_item_route.RawPostHandler(w, req)
		return
	case BATCHGETITEMPATH:
		batch_get_item_route.BatchGetItemHandler(w, req)
		return
	case BATCHWRITEITEMPATH:
		batch_write_item_route.BatchWriteItemHandler(w, req)
		return
	case DELETEITEMPATH:
		delete_item_route.RawPostHandler(w, req)
		return
	case UPDATEITEMPATH:
		update_item_route.RawPostHandler(w, req)
		return
	case QUERYPATH:
		query_route.RawPostHandler(w, req)
		return
	case SCANPATH:
		scan_route.RawPostHandler(w, req)
		return
	default:
		e := fmt.Sprintf("bbpd_route.CompatHandler:unknown endpoint '%s'", endpoint_path)
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
}
// CompatHandler allows bbpd to act as a partial pass-through proxy. Users can provide
// their own body and endpoint target header, but other headers are ignored.
// To use this, set headers with your http client. For example, with curl:
// curl -H "X-Amz-Target: DynamoDB_20120810.DescribeTable" -X POST -d '{"TableName":"mytable"}' http://localhost:12333/
// or alternately
// curl -H "X-Amz-Target: DescribeTable" -X POST -d '{"TableName":"mytable"}' http://localhost:12333/
// if you wish to just use the default API version string.
CompatHandler allows bbpd to act as a partial pass-through proxy. Users can provide
their own body and endpoint target header, but other headers are ignored.
To use this, set headers with your http client.
// CompatHandler allows bbpd to act as a partial pass - through proxy . Users can provide // their own body and endpoint target header but other headers are ignored . // To use this set headers with your http client . For example with curl : // curl - H " X - Amz - Target : DynamoDB_20120810 . DescribeTable " - X POST - d ' { " TableName " : " mytable " } ' http : // localhost : 12333 / // or alternately // curl - H " X - Amz - Target : DescribeTable " - X POST - d ' { " TableName " : " mytable " } ' http : // localhost : 12333 / // if you wish to just use the default API version string .
func CompatHandler(w http.ResponseWriter, req *http.Request) {
	if bbpd_runinfo.BBPDAbortIfClosed(w) {
		return
	}
	target_, target_ok := req.Header[aws_const.AMZ_TARGET_HDR]
	if !target_ok {
		e := fmt.Sprintf("bbpd_route.CompatHandler:missing %s", aws_const.AMZ_TARGET_HDR)
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
	target := target_[0]
	normalized_target := target
	target_version_delim := "."
	if strings.Contains(target, target_version_delim) {
		vers_target := strings.SplitN(target, target_version_delim, 2)
		if vers_target[0] != aws_const.CURRENT_API_VERSION {
			e := fmt.Sprintf("bbpd_route.CompatHandler:unsupported API version '%s'", vers_target[0])
			log.Printf(e)
			http.Error(w, e, http.StatusBadRequest)
			return
		}
		normalized_target = vers_target[1]
	}
	endpoint_path := "/" + normalized_target
	if endpoint_path == COMPATPATH || normalized_target == "" {
		e := fmt.Sprintf("bbpd_route.CompatHandler:must call named endpoint")
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
	switch endpoint_path {
	case DESCRIBETABLEPATH:
		describe_table_route.RawPostHandler(w, req)
		return
	case LISTTABLESPATH:
		list_tables_route.RawPostHandler(w, req)
		return
	case CREATETABLEPATH:
		create_table_route.RawPostHandler(w, req)
		return
	case UPDATETABLEPATH:
		update_table_route.RawPostHandler(w, req)
		return
	case STATUSTABLEPATH:
		describe_table_route.StatusTableHandler(w, req)
		return
	case PUTITEMPATH:
		put_item_route.RawPostHandler(w, req)
		return
	case GETITEMPATH:
		get_item_route.RawPostHandler(w, req)
		return
	case BATCHGETITEMPATH:
		batch_get_item_route.BatchGetItemHandler(w, req)
		return
	case BATCHWRITEITEMPATH:
		batch_write_item_route.BatchWriteItemHandler(w, req)
		return
	case DELETEITEMPATH:
		delete_item_route.RawPostHandler(w, req)
		return
	case UPDATEITEMPATH:
		update_item_route.RawPostHandler(w, req)
		return
	case QUERYPATH:
		query_route.RawPostHandler(w, req)
		return
	case SCANPATH:
		scan_route.RawPostHandler(w, req)
		return
	default:
		e := fmt.Sprintf("bbpd_route.CompatHandler:unknown endpoint '%s'", endpoint_path)
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
}
func CompatHandler ( w http . ResponseWriter , req * http . Request ) { if bbpd_runinfo . BBPDAbortIfClosed ( w ) { return } target_ , target_ok := req . Header [ aws_const . AMZ_TARGET_HDR ] if ! target_ok { e := fmt . Sprintf ( " " , aws_const . AMZ_TARGET_HDR ) log . Printf ( e ) http . Error ( w , e , http . StatusBadRequest ) return } target := target_ [ 0 ] normalized_target := target target_version_delim := " " if strings . Contains ( target , target_version_delim ) { vers_target := strings . SplitN ( target , target_version_delim , 2 ) if vers_target [ 0 ] != aws_const . CURRENT_API_VERSION { e := fmt . Sprintf ( " " , vers_target [ 0 ] ) log . Printf ( e ) http . Error ( w , e , http . StatusBadRequest ) return } normalized_target = vers_target [ 1 ] } endpoint_path := " " + normalized_target if endpoint_path == COMPATPATH || normalized_target == " " { e := fmt . Sprintf ( " " ) log . Printf ( e ) http . Error ( w , e , http . StatusBadRequest ) return } switch endpoint_path { case DESCRIBETABLEPATH : describe_table_route . RawPostHandler ( w , req ) return case LISTTABLESPATH : list_tables_route . RawPostHandler ( w , req ) return case CREATETABLEPATH : create_table_route . RawPostHandler ( w , req ) return case UPDATETABLEPATH : update_table_route . RawPostHandler ( w , req ) return case STATUSTABLEPATH : describe_table_route . StatusTableHandler ( w , req ) return case PUTITEMPATH : put_item_route . RawPostHandler ( w , req ) return case GETITEMPATH : get_item_route . RawPostHandler ( w , req ) return case BATCHGETITEMPATH : batch_get_item_route . BatchGetItemHandler ( w , req ) return case BATCHWRITEITEMPATH : batch_write_item_route . BatchWriteItemHandler ( w , req ) return case DELETEITEMPATH : delete_item_route . RawPostHandler ( w , req ) return case UPDATEITEMPATH : update_item_route . RawPostHandler ( w , req ) return case QUERYPATH : query_route . RawPostHandler ( w , req ) return case SCANPATH : scan_route . RawPostHandler ( w , req ) return default : e := fmt . Sprintf ( " " , endpoint_path ) log . Printf ( e ) http . Error ( w , e , http . StatusBadRequest ) return } }
CompatHandler allows bbpd to act as a partial pass-through proxy.
CompatHandler allows bbpd to act as a partial pass - through proxy .
// look for the X-Amz-Target header // allow the header to have the API version string or not // call the proper handler for the header