If the given resource points to an AEM page, delete the page using PageManager.
Otherwise delete the resource using ResourceResolver.
@param resource Resource to delete
343433
public static void deletePageOrResource(Resource resource) {
    Page configPage = resource.adaptTo(Page.class);
    if (configPage != null) {
      try {
        log.trace("! Delete page {}", configPage.getPath());
        PageManager pageManager = configPage.getPageManager();
        pageManager.delete(configPage, false);
      }
      catch (WCMException ex) {
        throw convertWCMException("Unable to delete configuration page at " + resource.getPath(), ex);
      }
    }
    else {
      try {
        log.trace("! Delete resource {}", resource.getPath());
        resource.getResourceResolver().delete(resource);
      }
      catch (PersistenceException ex) {
        throw convertPersistenceException("Unable to delete configuration resource at " + resource.getPath(), ex);
      }
    }
  }
838374
public static base_response delete(nitro_service client) throws Exception {
		locationfile deleteresource = new locationfile();
		return deleteresource.delete_resource(client);
	}
180989
private void deleteEverythingExceptNSAndSOA(String id, String name) {
    List<ActionOnResourceRecordSet> deletes = new ArrayList<ActionOnResourceRecordSet>();
    ResourceRecordSetList page = api.listResourceRecordSets(id);
    while (!page.isEmpty()) {
      for (ResourceRecordSet<?> rrset : page) {
        if (rrset.type().equals("SOA") || rrset.type().equals("NS") && rrset.name().equals(name)) {
          continue;
        }
        deletes.add(ActionOnResourceRecordSet.delete(rrset));
      }
      if (!deletes.isEmpty()) {
        api.changeResourceRecordSets(id, deletes);
      }
      if (page.next == null) {
        page.clear();
      } else {
        deletes.clear();
        page = api.listResourceRecordSets(id, page.next.name, page.next.type, page.next.identifier);
      }
    }
  }
143225
def delete_resource(resource_id):
    """"""
    resource_obj = app.db.resource(resource_id)
    try:
        os.remove(resource_obj.path)
    except OSError as err:
        app.logger.debug(err.message)

    app.db.delete_resource(resource_id)
    return redirect(request.referrer)
445501
public static base_response delete(nitro_service client, route resource) throws Exception {
		route deleteresource = new route();
		deleteresource.network = resource.network;
		deleteresource.netmask = resource.netmask;
		deleteresource.gateway = resource.gateway;
		deleteresource.td = resource.td;
		return deleteresource.delete_resource(client);
	}
1132879
public void removeOfflineJspFromRepository(CmsResource resource) throws CmsLoaderException {

        String jspName = getJspRfsPath(resource, false);
        Set<String> pathSet = new HashSet<String>();
        pathSet.add(resource.getRootPath());
        ReentrantReadWriteLock lock = getFileLock(jspName);
        lock.writeLock().lock();
        try {
            removeFromCache(pathSet, false);
            File jspFile = new File(jspName);
            jspFile.delete();
        } finally {
            lock.writeLock().unlock();
        }
    }
328783
public static base_response delete(nitro_service client, vrid resource) throws Exception {
		vrid deleteresource = new vrid();
		deleteresource.id = resource.id;
		deleteresource.all = resource.all;
		return deleteresource.delete_resource(client);
	}
352179
private void deleteResource(final CmsUUID structureId) {

        CmsRpcAction<Void> action = new CmsRpcAction<Void>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                CmsCoreProvider.getVfsService().deleteResource(structureId, this);

            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(Void result) {

                onAfterDeletion();
            }
        };
        action.execute();
    }
1365359
public static base_response delete(nitro_service client, location resource) throws Exception {
		location deleteresource = new location();
		deleteresource.ipfrom = resource.ipfrom;
		deleteresource.ipto = resource.ipto;
		return deleteresource.delete_resource(client);
	}
1062201
def delete_page_property(self, page_id, page_property):
        
        url = 'rest/api/content/{page_id}/property/{page_property}'.format(page_id=page_id,
                                                                           page_property=str(page_property))
        return self.delete(path=url)
1374289
public static void deleteChildrenNotInCollection(Resource resource, ConfigurationCollectionPersistData data) {
    Set<String> collectionItemNames = data.getItems().stream()
        .map(item -> item.getCollectionItemName())
        .collect(Collectors.toSet());

    for (Resource child : resource.getChildren()) {
      if (!collectionItemNames.contains(child.getName()) && !StringUtils.equals(JCR_CONTENT, child.getName())) {
        deletePageOrResource(child);
      }
    }
  }
1202738
public static base_response delete(nitro_service client, nsip6 resource) throws Exception {
		nsip6 deleteresource = new nsip6();
		deleteresource.ipv6address = resource.ipv6address;
		deleteresource.td = resource.td;
		return deleteresource.delete_resource(client);
	}
410775
public static base_response delete(nitro_service client, dnsmxrec resource) throws Exception {
		dnsmxrec deleteresource = new dnsmxrec();
		deleteresource.domain = resource.domain;
		deleteresource.mx = resource.mx;
		return deleteresource.delete_resource(client);
	}
13645
public void merge(Resource resource) {
        if (resource == null) {
            return;
        }

        checkRel(resource);
        checkHrefs(resource);

        if (resource.templated()) {
            this.pathParams.putAll(resource.pathParams);
            this.queryParams.putAll(resource.queryParams);
        }
        if (resource.hints() != null) {
            this.hints.merge(resource.hints());
        }
    }
949641
private void doDelete() throws PageException {
	try {
	    RegistryQuery.deleteValue(branch, entry);
	}
	catch (Exception e) {
	    throw Caster.toPageException(e);
	}
    }
1291475
@Override
  public void deletePage(int pageID) {
    try {
      // / put id to empty nodes and
      // delete from cache
      super.deletePage(pageID);

      // delete from file
      countWrite();
      byte[] array = pageToByteArray(null);
      file.getRecordBuffer(pageID).put(array);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
795252
public static base_response delete(nitro_service client, dnsnameserver resource) throws Exception {
		dnsnameserver deleteresource = new dnsnameserver();
		deleteresource.ip = resource.ip;
		deleteresource.dnsvservername = resource.dnsvservername;
		return deleteresource.delete_resource(client);
	}