@Override
  protected RequestStatus deleteResourcesAuthorized(final Request request, Predicate predicate)
    throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {

    final Long mpackId;
    Map<String, Object> propertyMap = new HashMap<>(PredicateHelper.getProperties(predicate));
    DeleteStatusMetaData deleteStatusMetaData = null;

    // Allow deleting mpack only if there are no cluster services deploying using this mpack.
    // Support deleting mpacks only if no cluster has been deployed
    // (i.e. you should be able to delete an mpack during install wizard only).
    // TODO : Relax the rule
    if (getManagementController().getClusters().getClusters().size() > 0) {
      throw new SystemException("Delete request cannot be completed since there is a cluster deployed");
    } else {
      if (propertyMap.containsKey(MPACK_RESOURCE_ID)) {
        Object objMpackId = propertyMap.get(MPACK_RESOURCE_ID);
        if (objMpackId != null) {
          mpackId = Long.valueOf((String) objMpackId);
          LOG.info("Deleting Mpack, id = " + mpackId.toString());

          MpackEntity mpackEntity = mpackDAO.findById(mpackId);
          StackEntity stackEntity = stackDAO.findByMpack(mpackId);

          try {
            getManagementController().removeMpack(mpackEntity, stackEntity);
            if (mpackEntity != null) {
              deleteStatusMetaData = modifyResources(new Command<DeleteStatusMetaData>() {
                @Override
                public DeleteStatusMetaData invoke() throws AmbariException {
                  if (stackEntity != null) {
                    repositoryVersionDAO
                      .removeByStack(new StackId(stackEntity.getStackName() + "-" + stackEntity.getStackVersion()));
                    stackDAO.removeByMpack(mpackId);
                    notifyDelete(Resource.Type.Stack, predicate);
                  }
                  mpackDAO.removeById(mpackId);

                  return new DeleteStatusMetaData();
                }
              });
              notifyDelete(Resource.Type.Mpack, predicate);
              deleteStatusMetaData.addDeletedKey(mpackId.toString());
            } else {
              throw new NoSuchResourceException("The requested resource doesn't exist: " + predicate);
            }
          } catch (IOException e) {
            throw new SystemException("There is an issue with the Files");
          }
        }
      } else {
        throw new UnsupportedPropertyException(Resource.Type.Mpack, null);
      }

      return getRequestStatus(null, null, deleteStatusMetaData);
    }
  }
Validates the request body for the required properties in order to create an Mpack resource.

@param mpackRequest
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MpackResourceProvider.java