//Purge an instance with the specified id in the current environment
//The instance must be in the Destroyed state. To destroy and purge an instance, see the Destroy method
772958
func (instanceApi *InstanceApi) Purge(id string) (bool, error) {
	_, err := instanceApi.entityService.Execute(id, INSTANCE_PURGE_OPERATION, []byte{}, map[string]string{})
	return err == nil, err
}
635475
func (*Instances) Delete(c context.Context, req *instances.DeleteRequest) (*empty.Empty, error) {
	if req.GetId() == "" {
		return nil, status.Errorf(codes.InvalidArgument, "ID is required")
	}
	vm := &model.VM{
		ID: req.Id,
	}
	if err := datastore.RunInTransaction(c, func(c context.Context) error {
		switch err := datastore.Get(c, vm); {
		case err == datastore.ErrNoSuchEntity:
			return nil
		case err != nil:
			return errors.Annotate(err, "failed to fetch VM").Err()
		case vm.Drained:
			return nil
		}
		vm.Drained = true
		if err := datastore.Put(c, vm); err != nil {
			return errors.Annotate(err, "failed to store VM").Err()
		}
		return nil
	}, nil); err != nil {
		return nil, err
	}
	return &empty.Empty{}, nil
}
684596
func (b *Backend) PurgeState(taskUUID string) error {
	_, err := b.tasksCollection.DeleteOne(context.Background(), bson.M{"_id": taskUUID})
	return err
}
1294831
func RemoveStateInstances(stor storage.Storage, ids ...instance.Id) error {
	state, err := LoadState(stor)
	if err == environs.ErrNotBootstrapped {
		return nil
	} else if err != nil {
		return errors.Annotate(err, "cannot remove recorded state instance-id")
	}
	var anyFound bool
	for i := 0; i < len(state.StateInstances); i++ {
		for _, id := range ids {
			if state.StateInstances[i] == id {
				head := state.StateInstances[:i]
				tail := state.StateInstances[i+1:]
				state.StateInstances = append(head, tail...)
				anyFound = true
				i--
				break
			}
		}
	}
	if !anyFound {
		return nil
	}
	return SaveState(stor, state)
}
1136949
func (s *File) Delete(id string) error {
	name := s.Prefixed.Name(id)
	if err := os.Remove(s.join(name)); err != nil {
		return err
	}
	if s.RemoveEmpty && filepath.Dir(name) != "." {
		return s.removeIfEmpty(filepath.Dir(name))
	}
	return nil
}
961582
func (s *SQS) Purge() error {

	params := &sqs.PurgeQueueInput{
		QueueUrl: s.queueURL,
	}
	_, err := s.client().PurgeQueue(params)
	return err
}
484208
func (e *environ) Destroy(ctx context.ProviderCallContext) error {
	if err := common.Destroy(e, ctx); err != nil {
		return errors.Trace(maybeConvertCredentialError(err, ctx))
	}
	if err := e.cleanEnvironmentSecurityGroups(ctx); err != nil {
		return errors.Annotate(maybeConvertCredentialError(err, ctx), "cannot delete environment security groups")
	}
	return nil
}
746599
func (idx *ListIndex) RemoveID(targetID []byte) error {
	value := idx.IDs.Get(targetID)
	if value == nil {
		return nil
	}

	err := idx.IndexBucket.Delete(value)
	if err != nil {
		return err
	}

	return idx.IDs.Remove(targetID)
}
605223
func (rbac *RBAC) Remove(id string) (err error) {
	rbac.mutex.Lock()
	if _, ok := rbac.roles[id]; ok {
		delete(rbac.roles, id)
		for rid, parents := range rbac.parents {
			if rid == id {
				delete(rbac.parents, rid)
				continue
			}
			for parent := range parents {
				if parent == id {
					delete(rbac.parents[rid], id)
					break
				}
			}
		}
	} else {
		err = ErrRoleNotExist
	}
	rbac.mutex.Unlock()
	return
}
959772
func (c *Client) DestroyRecord(domain string, id string) error {
	params := make(map[string]string)

	params["z"] = domain
	params["id"] = id

	req, err := c.NewRequest(params, "POST", "rec_delete")
	if err != nil {
		return err
	}

	resp, err := checkResp(c.Http.Do(req))

	if err != nil {
		return fmt.Errorf("Error deleting record: %s", err)
	}

	recordResp := new(RecordResponse)

	err = decodeBody(resp, &recordResp)

	if err != nil {
		return fmt.Errorf("Error parsing record response: %s", err)
	}
	_, err = recordResp.GetRecord()
	if err != nil {
		return err
	}

	// The request was successful
	return nil
}
131162
func (client *Client) DeleteInstance(instanceId string) error {
	args := DeleteInstanceArgs{InstanceId: instanceId}
	response := DeleteInstanceResponse{}
	err := client.Invoke("DeleteInstance", &args, &response)
	return err
}
395527
func (s *DeleteTemplateService) Id(id string) *DeleteTemplateService {
	s.id = id
	return s
}
682823
func (inst *environInstance) Id() instance.Id {
	return instance.Id(inst.base.ID)
}
489435
func Destroy(env environs.Environ, ctx context.ProviderCallContext) error {
	logger.Infof("destroying model %q", env.Config().Name())
	if err := destroyInstances(env, ctx); err != nil {
		return errors.Annotate(err, "destroying instances")
	}
	if err := destroyStorage(env, ctx); err != nil {
		return errors.Annotate(err, "destroying storage")
	}
	return nil
}
350934
func (s *Session) Destroy() {
	s.MaxAge = -1
	s.Expires = time.Now()
	s.data = make(map[interface{}]interface{})
	s.isDirty = true
}
274868
func (s *Session) Destroy(id string, q *WriteOptions) (*WriteMeta, error) {
	wm, err := s.c.write("/v1/session/destroy/"+id, nil, nil, q)
	if err != nil {
		return nil, err
	}
	return wm, nil
}
1102446
func (gfs *GridFS) RemoveId(id interface{}) error {
	err := gfs.Files.Remove(bson.M{"_id": id})
	if err != nil {
		return err
	}
	_, err = gfs.Chunks.RemoveAll(bson.M{"files_id": id})
	return err
}