@Override
  public RequestStatus updateResources(Request requestInfo, Predicate predicate)
          throws SystemException, UnsupportedPropertyException,
          NoSuchResourceException, NoSuchParentResourceException {

    AmbariManagementController amc = getManagementController();
    final Set<RequestRequest> requests = new HashSet<>();

    Iterator<Map<String,Object>> iterator = requestInfo.getProperties().iterator();
    if (iterator.hasNext()) {
      for (Map<String, Object> propertyMap : getPropertyMaps(iterator.next(), predicate)) {
        requests.add(getRequest(propertyMap));
      }
    }
    // Validate
    List<org.apache.ambari.server.actionmanager.Request> targets =
      new ArrayList<>();
    for (RequestRequest updateRequest : requests) {
      ActionManager actionManager = amc.getActionManager();
      List<org.apache.ambari.server.actionmanager.Request> internalRequests =
              actionManager.getRequests(Collections.singletonList(updateRequest.getRequestId()));
      if (internalRequests.size() == 0) {
        throw new IllegalArgumentException(
                String.format("Request %s does not exist", updateRequest.getRequestId()));
      }
      // There should be only one request with this id (or no request at all)
      org.apache.ambari.server.actionmanager.Request internalRequest = internalRequests.get(0);

      if (updateRequest.isRemovePendingHostRequests()) {
        if (internalRequest instanceof LogicalRequest) {
          targets.add(internalRequest);
        } else {
          throw new IllegalArgumentException("Request with id: " + internalRequest.getRequestId() + "is not a Logical Request.");
        }
      } else {
        // Validate update request (check constraints on state value and presence of abort reason)
        if (updateRequest.getAbortReason() == null || updateRequest.getAbortReason().isEmpty()) {
          throw new IllegalArgumentException("Abort reason can not be empty.");
        }

        if (updateRequest.getStatus() != HostRoleStatus.ABORTED) {
          throw new IllegalArgumentException(
                  String.format("%s is wrong value. The only allowed value " +
                                  "for updating request status is ABORTED",
                          updateRequest.getStatus()));
        }

        HostRoleStatus internalRequestStatus =
                CalculatedStatus.statusFromStages(internalRequest.getStages()).getStatus();

        if (internalRequestStatus.isCompletedState()) {
          // Ignore updates to completed requests to avoid throwing exception on race condition
        } else {
          // Validation passed
          targets.add(internalRequest);
        }
      }

    }

    // Perform update
    Iterator<RequestRequest> reqIterator = requests.iterator();
    for (org.apache.ambari.server.actionmanager.Request target : targets) {
      if (target instanceof LogicalRequest) {
        topologyManager.removePendingHostRequests(target.getClusterName(), target.getRequestId());
      } else {
        String reason = reqIterator.next().getAbortReason();
        amc.getActionManager().cancelRequest(target.getRequestId(), reason);
      }
    }
    return getRequestStatus(null);
  }
Create a  new resource provider for the given management controller.

@param managementController the management controller
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java