find the resource
 If we have a resource service, we call destroy on it with the reosurce id, so that any callbacks can be triggered
 Otherwise, just call destroy on the resource
437749
def destroy(*args)
      resource = find(*args)
      if enclosing_resource
        service.destroy(*args)
        resource
      else
        resource.destroy
      end
    end
470220
private static void destroyService() {
        Thread thread = DESTROY_THREAD;
        if (thread == null) {
            thread = new Thread() {
                @Override
                public void run() {
                    try {
                        // we wait 5000ms, because the service maybe can use
                        Thread.sleep(5000);
                        dispose();
                    } catch (InterruptedException e) {
                        //e.printStackTrace();
                    }
                    DESTROY_THREAD = null;
                }
            };
            thread.setDaemon(true);
            DESTROY_THREAD = thread;
            thread.start();
        }
    }
445958
def _delete_resource(resource, name=None, resource_id=None, region=None,
                     key=None, keyid=None, profile=None, **kwargs):
    '''
    
    '''

    if not _exactly_one((name, resource_id)):
        raise SaltInvocationError('One (but not both) of name or id must be '
                                  'provided.')

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

        try:
            delete_resource = getattr(conn, 'delete_' + resource)
        except AttributeError:
            raise AttributeError('{0} function does not exist for boto VPC '
                                 'connection.'.format('delete_' + resource))
        if name:
            resource_id = _get_resource_id(resource, name,
                                           region=region, key=key,
                                           keyid=keyid, profile=profile)
            if not resource_id:
                return {'deleted': False, 'error': {'message':
                        '{0} {1} does not exist.'.format(resource, name)}}

        if delete_resource(resource_id, **kwargs):
            _cache_id(name, sub_resource=resource,
                      resource_id=resource_id,
                      invalidate=True,
                      region=region,
                      key=key, keyid=keyid,
                      profile=profile)
            return {'deleted': True}
        else:
            if name:
                e = '{0} {1} was not deleted.'.format(resource, name)
            else:
                e = '{0} was not deleted.'.format(resource)
            return {'deleted': False, 'error': {'message': e}}
    except BotoServerError as e:
        return {'deleted': False, 'error': __utils__['boto.get_error'](e)}
1365758
public void destroy() throws ResourceException {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "destroy");
        }

        // In the event of an error the connection manager may call destroy
        // without calling cleanup. We need to do the cleanup logic without
        // calling cleanup as we could throw an exception from cleanup.
        // Invalidate any currently associated connections
        for (Iterator iterator = _connections.iterator(); iterator.hasNext();) {

            final SibRaConnection connection = (SibRaConnection) iterator
                    .next();
            connection.invalidate();
        }

        try {

            // Close the core connection
            // when destroy calls close connections then connection cannot be reset for future usage so force close by passing boolean true.-PM39926
            _coreConnection.close(true);

        } catch (final SIConnectionLostException exception) {

          // No FFDC code needed
          // d352473
          // We are remote to the ME and the ME connection has been lost
          // we shall surpress this exception as we want the destroy to complete

        } catch (final SIConnectionDroppedException exception) {

          // No FFDC code needed
          // d352473
          // We are remote to the ME and the ME connection has been dropped
          // we shall surpress this exception as we want the destroy to complete

        } catch (SIException exception) {

            FFDCFilter.processException(exception,
                    "com.ibm.ws.sib.ra.impl.SibRaManagedConnection.destroy",
                    FFDC_PROBE_2, this);
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
                SibTr.exception(this, TRACE, exception);
            }
            throw new ResourceException(NLS.getFormattedMessage(
                    "CONNECTION_CLOSE_CWSIV0402", new Object[] { exception },
                    null), exception);

        } catch (SIErrorException exception) {

            FFDCFilter.processException(exception,
                    "com.ibm.ws.sib.ra.impl.SibRaManagedConnection.destroy",
                    FFDC_PROBE_8, this);
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
                SibTr.exception(this, TRACE, exception);
            }
            throw new ResourceException(NLS.getFormattedMessage(
                    "CONNECTION_CLOSE_CWSIV0402", new Object[] { exception },
                    null), exception);

        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "destroy");
        }

    }
725144
def remove(self, resource, **kwargs):
        
        log.info(
            "Removing {} '{}'...".format(self._model_name, resource.name))
        resource.remove(**kwargs)
        self._ids.remove(resource.id)
634545
def remove(id, resource_ids)
      params = {
        id: id,
        resource_ids: resource_ids
      }
      requires params
      DataSift.request(:PUT, 'source/resource/remove', @config, params)
    end
62078
public void unload(String resourceId) {
        LoadableResource res = this.resources.get(resourceId);
        if (res!=null) {
            res.unload();
        }
    }
1209251
def monitor_resource_sync_state(resource, callback, exit_event=None):
    
    exit_event = exit_event or AsyncEvent()
    callback(False)        # Initial condition, assume resource is not connected

    while not exit_event.is_set():
        # Wait for resource to be synced
        yield until_any(resource.until_synced(), exit_event.until_set())
        if exit_event.is_set():
            break       # If exit event is set we stop without calling callback
        else:
            callback(True)

        # Wait for resource to be un-synced
        yield until_any(resource.until_not_synced(), exit_event.until_set())
        if exit_event.is_set():
            break       # If exit event is set we stop without calling callback
        else:
            callback(False)
928775
def delete_resource(self, resource_id):
        
        # resource_id could be a path such as '/asset/123' so quote
        uri = self._get_resource_uri(guid=resource_id)
        return self.service._delete(uri)
1364283
def create_resource(self, parent_id=""):
        
        resource_name = self.trigger_settings.get('resource', '')
        resource_name = resource_name.replace('/', '')
        if not self.resource_id:
            created_resource = self.client.create_resource(
                restApiId=self.api_id, parentId=parent_id, pathPart=resource_name)
            self.resource_id = created_resource['id']
            self.log.info("Successfully created resource")
        else:
            self.log.info("Resource already exists. To update resource please delete existing resource: %s",
                          resource_name)
1089139
def find_resource(controller)
      (controller.enclosing_resource ? controller.enclosing_resource.send(source) : klass).find controller.params[key]
    end
74464
def get_resource(self, resource_id):
        
        # resource_id could be a path such as '/asset/123' so quote
        uri = self._get_resource_uri(guid=resource_id)
        return self.service._get(uri)
943033
def delete_resource(self, resource_id):
        """"""
        resource_obj = self.resource(resource_id)
        logger.debug("Deleting resource {0}".format(resource_obj.name))
        self.session.delete(resource_obj)
        self.save()
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)
425166
@Override
	@Transactional
	public String getResource(String id)
	{
		final TemplateCall call = templater.template("resource_template");

		final ResourceTemplateEntity entity = resourceProvisionService.getOrCreateTemplate(id);

		if (entity == null)
			throw new RestException(404, "No such resource with id: " + id);

		call.set("entity", entity);
		call.set("nonce", nonceStore.getValue());

		return call.process();
	}
256697
public static base_response delete(nitro_service client, String id) throws Exception {
		linkset deleteresource = new linkset();
		deleteresource.id = id;
		return deleteresource.delete_resource(client);
	}
43604
protected boolean isOperationOnMovedResource() {

        Iterator<String> i = getResourceList().iterator();
        while (i.hasNext()) {
            String resName = i.next();
            String target = resourceOriginalPath(getCms(), resName);
            if ((target != null) && !target.equals(resName)) {
                // found a moved resource
                return true;
            }
        }
        return false;
    }