code: public String addConnectionRequirement(NodeTemplate target, String type, String varName) {
          Map<String, Object> requirement = new LinkedHashMap();
          
          String requirementName = "endpoint";
          Map requirementMap = new LinkedHashMap<String, Object>();
          requirement.put(requirementName, requirementMap);
          requirementMap.put("node", target.getName());
          requirementMap.put("type", type);
          if (!varName.isEmpty()) {
              Map<String, String> properties = new LinkedHashMap();
              properties.put("prop.name", varName);
              requirementMap.put("properties", properties);
          }
          requirements().add(requirement);
          
          return requirementName;
      }
docs: Add an endpoint requirement to a NodeTemplate
  @return name given to the requirement