code: def post_connection(*, session: Session = NEW_SESSION) -> APIResponse:
      """Create connection entry."""
      body = request.json
      try:
          data = connection_schema.load(body)
      except ValidationError as err:
          raise BadRequest(detail=str(err.messages))
      conn_id = data["conn_id"]
      try:
          helpers.validate_key(conn_id, max_length=200)
      except Exception as e:
          raise BadRequest(detail=str(e))
      connection = session.scalar(
          select(Connection).filter_by(conn_id=conn_id).limit(1)
      )
      if not connection:
          connection = Connection(**data)
          session.add(connection)
          session.commit()
          return connection_schema.dump(connection)
      raise AlreadyExists(
          detail=f"Connection already exist. ID: {conn_id}"
      )
  
imports: from __future__ import annotations
  import os
  from http import HTTPStatus
  from typing import TYPE_CHECKING
  from connexion import NoContent
  from flask import Response, request
  from marshmallow import ValidationError
  from sqlalchemy import func, select
  from airflow.api_connexion import security
  from airflow.api_connexion.endpoints.update_mask import extract_update_mask_data
  from airflow.api_connexion.exceptions import AlreadyExists, BadRequest, NotFound
  from airflow.api_connexion.parameters import apply_sorting, check_limit, format_parameters
  from airflow.api_connexion.schemas.connection_schema import ConnectionCollection, connection_collection_schema, connection_schema, connection_test_schema
  from airflow.configuration import conf
  from airflow.models import Connection
  from airflow.secrets.environment_variables import CONN_ENV_PREFIX
  from airflow.security import permissions
  from airflow.utils import helpers
  from airflow.utils.log.action_logger import action_event_from_permission
  from airflow.utils.session import NEW_SESSION, provide_session
  from airflow.utils.strings import get_random_string
  from airflow.www.decorators import action_logging
label_desc: Use image node_id 5 for calling a global function with example usage: post_connection() and returns: connection_schema