@Override
  public void createExtensionLink(ExtensionLinkRequest request) throws AmbariException {
    if (StringUtils.isBlank(request.getStackName())
            || StringUtils.isBlank(request.getStackVersion())
            || StringUtils.isBlank(request.getExtensionName())
            || StringUtils.isBlank(request.getExtensionVersion())) {

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

    StackInfo stackInfo = ambariMetaInfo.getStack(request.getStackName(), request.getStackVersion());

    if (stackInfo == null) {
      throw new StackAccessException("stackName=" + request.getStackName() + ", stackVersion=" + request.getStackVersion());
    }

    ExtensionInfo extensionInfo = ambariMetaInfo.getExtension(request.getExtensionName(), request.getExtensionVersion());

    if (extensionInfo == null) {
      throw new StackAccessException("extensionName=" + request.getExtensionName() + ", extensionVersion=" + request.getExtensionVersion());
    }

    helper.createExtensionLink(ambariMetaInfo.getStackManager(), stackInfo, extensionInfo);
  }
This method will create a link between an extension version and a stack version (Extension Link).

An extension version is like a stack version but it contains custom services.  Linking an extension
version to the current stack version allows the cluster to install the custom services contained in
the extension version.
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java