private void validateCreateExtensionLinkRequest(StackInfo stackInfo, ExtensionInfo extensionInfo) throws AmbariException {
    if (stackInfo == null) {
      throw new IllegalArgumentException("Stack should be provided");
    }
    if (extensionInfo == null) {
      throw new IllegalArgumentException("Extension should be provided");
    }
    if (StringUtils.isBlank(stackInfo.getName())
            || StringUtils.isBlank(stackInfo.getVersion())
            || StringUtils.isBlank(extensionInfo.getName())
            || StringUtils.isBlank(extensionInfo.getVersion())) {

      throw new IllegalArgumentException("Stack name, stack version, extension name and extension version should be provided");
    }

    ExtensionLinkEntity entity = linkDAO.findByStackAndExtension(stackInfo.getName(), stackInfo.getVersion(),
		extensionInfo.getName(), extensionInfo.getVersion());

    if (entity != null) {
      throw new AmbariException("The stack and extension are already linked"
                + ", stackName=" + stackInfo.getName()
                + ", stackVersion=" + stackInfo.getVersion()
                + ", extensionName=" + extensionInfo.getName()
                + ", extensionVersion=" + extensionInfo.getVersion());
    }
  }
Validates the stackInfo and extensionInfo parameters are valid.
If they are then it confirms that the stack and extension are not already linked.
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java