// Delete a extContractsGroup object
489088
func DeleteExtContractsGroup(key string) error {
	collections.extContractsGroupMutex.Lock()
	obj := collections.extContractsGroups[key]
	collections.extContractsGroupMutex.Unlock()
	if obj == nil {
		log.Errorf("extContractsGroup %s not found", key)
		return errors.New("extContractsGroup not found")
	}

	// Check if we handle this object
	if objCallbackHandler.ExtContractsGroupCb == nil {
		log.Errorf("No callback registered for extContractsGroup object")
		return errors.New("Invalid object type")
	}

	// Perform callback
	err := objCallbackHandler.ExtContractsGroupCb.ExtContractsGroupDelete(obj)
	if err != nil {
		log.Errorf("ExtContractsGroupDelete retruned error for: %+v. Err: %v", obj, err)
		return err
	}

	// delete it from modeldb
	collections.extContractsGroupMutex.Lock()
	err = obj.Delete()
	collections.extContractsGroupMutex.Unlock()
	if err != nil {
		log.Errorf("Error deleting extContractsGroup %s. Err: %v", obj.Key, err)
	}

	// delete it from cache
	collections.extContractsGroupMutex.Lock()
	delete(collections.extContractsGroups, key)
	collections.extContractsGroupMutex.Unlock()

	return nil
}
627045
func (c *FakeInstanceGroups) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(instancegroupsResource, c.ns, name), &kops.InstanceGroup{})

	return err
}
326446
func (c *Cache) remItemFromGroups(itmKey string, groupIDs []string) {
	for _, grpID := range groupIDs {
		delete(c.groups[grpID], itmKey)
		if len(c.groups[grpID]) == 0 {
			delete(c.groups, grpID)
		}
	}
}
620678
func httpInspectExtContractsGroup(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	var obj ExtContractsGroupInspect
	log.Debugf("Received httpInspectExtContractsGroup: %+v", vars)

	key := vars["key"]

	collections.extContractsGroupMutex.Lock()
	defer collections.extContractsGroupMutex.Unlock()
	objConfig := collections.extContractsGroups[key]
	if objConfig == nil {
		log.Errorf("extContractsGroup %s not found", key)
		return nil, errors.New("extContractsGroup not found")
	}
	obj.Config = *objConfig

	// Return the obj
	return &obj, nil
}
203013
func LeaveGroup(hexid string) error {
	g, ok := groups[hexid]
	if !ok {
		return UnknownGroupIDError{hexid}
	}

	for _, m := range g.Members {
		if m != config.Tel {
			omsg := &outgoingMessage{
				tel: m,
				group: &groupMessage{
					id:  g.ID,
					typ: textsecure.GroupContext_QUIT,
				},
			}
			_, err := sendMessage(omsg)
			if err != nil {
				return err
			}
		}
	}
	removeGroup(g.ID)
	return nil
}
747821
func RemoveContact(c *messagebird.Client, groupID, contactID string) error {
	formattedPath := fmt.Sprintf("%s/%s/contacts/%s", path, groupID, contactID)

	return c.Request(nil, http.MethodDelete, formattedPath, nil)
}
683057
func (b *Broker) DeleteGroups(request *DeleteGroupsRequest) (*DeleteGroupsResponse, error) {
	response := new(DeleteGroupsResponse)

	if err := b.sendAndReceive(request, response); err != nil {
		return nil, err
	}

	return response, nil
}
844771
func quitGroup(src string, hexid string) error {
	gr, ok := groups[hexid]
	if !ok {
		return UnknownGroupIDError{hexid}
	}

	gr.Members = removeMember(src, gr.Members)

	return saveGroup(hexid)
}
466074
func (c *gceCloudImplementation) DeleteGroup(g *cloudinstances.CloudInstanceGroup) error {
	return deleteCloudInstanceGroup(c, g)
}
608924
func DestroyCgroup(groups *lconfigs.Cgroup, executorPid int) error {
	mErrs := new(multierror.Error)
	if groups == nil {
		return fmt.Errorf("Can't destroy: cgroup configuration empty")
	}

	// Move the executor into the global cgroup so that the task specific
	// cgroup can be destroyed.
	path, err := cgroups.GetInitCgroupPath("freezer")
	if err != nil {
		return err
	}

	if err := cgroups.EnterPid(map[string]string{"freezer": path}, executorPid); err != nil {
		return err
	}

	// Freeze the Cgroup so that it can not continue to fork/exec.
	groups.Resources.Freezer = lconfigs.Frozen
	freezer := cgroupFs.FreezerGroup{}
	if err := freezer.Set(groups.Paths[freezer.Name()], groups); err != nil {
		return err
	}

	var procs []*os.Process
	pids, err := cgroups.GetAllPids(groups.Paths[freezer.Name()])
	if err != nil {
		multierror.Append(mErrs, fmt.Errorf("error getting pids: %v", err))

		// Unfreeze the cgroup.
		groups.Resources.Freezer = lconfigs.Thawed
		freezer := cgroupFs.FreezerGroup{}
		if err := freezer.Set(groups.Paths[freezer.Name()], groups); err != nil {
			multierror.Append(mErrs, fmt.Errorf("failed to unfreeze cgroup: %v", err))
			return mErrs.ErrorOrNil()
		}
	}

	// Kill the processes in the cgroup
	for _, pid := range pids {
		proc, err := os.FindProcess(pid)
		if err != nil {
			multierror.Append(mErrs, fmt.Errorf("error finding process %v: %v", pid, err))
			continue
		}

		procs = append(procs, proc)
		if e := proc.Kill(); e != nil {
			multierror.Append(mErrs, fmt.Errorf("error killing process %v: %v", pid, e))
		}
	}

	// Unfreeze the cgroug so we can wait.
	groups.Resources.Freezer = lconfigs.Thawed
	if err := freezer.Set(groups.Paths[freezer.Name()], groups); err != nil {
		multierror.Append(mErrs, fmt.Errorf("failed to unfreeze cgroup: %v", err))
		return mErrs.ErrorOrNil()
	}

	// Wait on the killed processes to ensure they are cleaned up.
	for _, proc := range procs {
		// Don't capture the error because we expect this to fail for
		// processes we didn't fork.
		proc.Wait()
	}

	// Remove the cgroup.
	if err := cgroups.RemovePaths(groups.Paths); err != nil {
		multierror.Append(mErrs, fmt.Errorf("failed to delete the cgroup directories: %v", err))
	}
	return mErrs.ErrorOrNil()
}
17337
func (c *Client) DeleteFirewallGroup(groupID string) error {
	values := url.Values{
		"FIREWALLGROUPID": {groupID},
	}

	if err := c.post(`firewall/group_delete`, values, nil); err != nil {
		return err
	}
	return nil
}
332491
func httpGetExtContractsGroup(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	log.Debugf("Received httpGetExtContractsGroup: %+v", vars)

	key := vars["key"]

	collections.extContractsGroupMutex.Lock()
	defer collections.extContractsGroupMutex.Unlock()
	obj := collections.extContractsGroups[key]
	if obj == nil {
		log.Infof("extContractsGroup %s not found", key)
		return nil, errors.New("extContractsGroup not found")
	}

	// Return the obj
	return obj, nil
}
1325950
func (cg *Consumergroup) Delete() error {
	if instances, err := cg.Instances(); err != nil {
		return err
	} else if len(instances) > 0 {
		return ErrRunningInstances
	}

	return cg.kz.deleteRecursive(fmt.Sprintf("%s/consumers/%s", cg.kz.conf.Chroot, cg.Name))
}
870082
func (c *awsCloudImplementation) DeleteGroup(g *cloudinstances.CloudInstanceGroup) error {
	if c.spotinst != nil {
		return spotinst.DeleteGroup(c.spotinst, g)
	}

	return deleteGroup(c, g)
}
414327
func (s *VMGroupService) DeleteInstanceGroup(p *DeleteInstanceGroupParams) (*DeleteInstanceGroupResponse, error) {
	resp, err := s.cs.newRequest("deleteInstanceGroup", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r DeleteInstanceGroupResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
252187
func (s *AffinityGroupService) DeleteAffinityGroup(p *DeleteAffinityGroupParams) (*DeleteAffinityGroupResponse, error) {
	resp, err := s.cs.newRequest("deleteAffinityGroup", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r DeleteAffinityGroupResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
883005
func (s *VMGroupService) NewDeleteInstanceGroupParams(id string) *DeleteInstanceGroupParams {
	p := &DeleteInstanceGroupParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	return p
}