// Delete deletes a volume
495082
func (s *VolumeServer) Delete(
	ctx context.Context,
	req *api.SdkVolumeDeleteRequest,
) (*api.SdkVolumeDeleteResponse, error) {
	if s.cluster() == nil || s.driver(ctx) == nil {
		return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
	}

	if len(req.GetVolumeId()) == 0 {
		return nil, status.Error(codes.InvalidArgument, "Must supply volume id")
	}

	// If the volume is not found, return OK to be idempotent
	// This checks access rights also
	resp, err := s.Inspect(ctx, &api.SdkVolumeInspectRequest{
		VolumeId: req.GetVolumeId(),
	})
	if err != nil {
		if IsErrorNotFound(err) {
			return &api.SdkVolumeDeleteResponse{}, nil
		}
		return nil, err
	}
	vol := resp.GetVolume()

	// Only the owner or the admin can delete
	if !vol.IsPermitted(ctx, api.Ownership_Admin) {
		return nil, status.Errorf(codes.PermissionDenied, "Cannot delete volume %v", vol.GetId())
	}

	// Delete the volume
	err = s.driver(ctx).Delete(req.GetVolumeId())
	if err != nil {
		return nil, status.Errorf(
			codes.Internal,
			"Failed to delete volume %s: %v",
			req.GetVolumeId(),
			err.Error())
	}

	return &api.SdkVolumeDeleteResponse{}, nil
}
1322128
func (r *Release) Delete(name string) error {
	ok, err := r.canDelete(name)
	if !ok {
		if err != nil {
			return err
		}
		return nil
	}

	_, err = r.HelmClient.DeleteRelease(name, k8shelm.DeletePurge(true))
	if err != nil {
		r.logger.Log("error", fmt.Sprintf("Release deletion error: %#v", err))
		return err
	}
	r.logger.Log("info", fmt.Sprintf("Release deleted: [%s]", name))
	return nil
}
167602
func (c *FakePersistentVolumeClaims) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(persistentvolumeclaimsResource, c.ns, name), &corev1.PersistentVolumeClaim{})

	return err
}
158428
func (f *fileStorage) Delete(key string) error {
	return os.Remove(f.filePathToFile(key))
}
928993
func (s *S3Storage) Delete(filepath string) error {
	bucket, err := s.Bucket()

	if err != nil {
		return err
	}

	return bucket.Del(s.Path(filepath))
}
1313254
func (d *RsyncDriver) Remove(volumeName string) error {
	v, err := d.Get(volumeName)
	if err != nil {
		return err
	}
	// Delete all of the snapshots
	snapshots, err := v.Snapshots()
	if err != nil {
		return err
	}

	for _, snapshot := range snapshots {
		if err := v.RemoveSnapshot(snapshot); err != nil {
			return err
		}
	}
	// Delete the volume
	v.(*RsyncVolume).Lock()
	defer v.(*RsyncVolume).Unlock()
	if err := os.RemoveAll(filepath.Join(d.MetadataDir(), volumeName)); err != nil {
		return err
	} else if err := os.RemoveAll(v.Path()); err != nil {
		glog.Errorf("Could not delete volume %s: %s", volumeName, err)
		return ErrDeletingVolume
	}
	return nil
}
425443
func (v *StorageVol) Delete(flags StorageVolDeleteFlags) error {
	var err C.virError
	result := C.virStorageVolDeleteWrapper(v.ptr, C.uint(flags), &err)
	if result == -1 {
		return makeError(&err)
	}
	return nil
}
471665
func (l *LFUNoTS) Delete(key string) error {
	res, err := l.cache.Get(key)
	if err != nil && err != ErrNotFound {
		return err
	}

	// we dont need to delete if already doesn't exist
	if err == ErrNotFound {
		return nil
	}

	ci := res.(*cacheItem)

	l.remove(ci, ci.freqElement)
	l.currentSize--
	return l.cache.Delete(key)
}
643525
func (o *Organizations) Delete(ctx context.Context, org *chronograf.Organization) error {
	return fmt.Errorf("unable to delete an organization from the filesystem")
}
819445
func (c *Cache) Delete(key string) {
	c.db.Delete([]byte(key), nil)
}
1258412
func (kv *keyValue) Delete(key string) error {
	kv.mu.Lock()
	defer kv.mu.Unlock()
	err := kv.db.Remove(&bson.M{mgoKey: key})
	if err == mgo.ErrNotFound {
		return nil
	}
	return err
}
557672
func (c *Client) Delete(key string) error {
	return c.withKeyRw(key, func(rw *bufio.ReadWriter) error {
		return writeExpectf(rw, resultDeleted, "delete %s\r\n", key)
	})
}
574660
func (s *redisStorage) Delete(key string) error {
	cmd := s.c.Del(key)
	return cmd.Err()
}
1173943
func (m *dirsMap) Delete(key string) {
	m.data.Delete(m.normalizeKey(key))
}
92967
func (p *rbdProvisioner) Delete(volume *v1.PersistentVolume) error {
	// TODO: Should we check `pv.kubernetes.io/provisioned-by` key too?
	ann, ok := volume.Annotations[provisionerIDAnn]
	if !ok {
		return errors.New("identity annotation not found on PV")
	}
	if ann != p.identity {
		return &controller.IgnoredError{Reason: "identity annotation on PV does not match ours"}
	}

	class, err := p.client.StorageV1beta1().StorageClasses().Get(util.GetPersistentVolumeClass(volume), metav1.GetOptions{})
	if err != nil {
		return err
	}
	opts, err := p.parseParameters(class.Parameters)
	if err != nil {
		return err
	}
	image := volume.Spec.PersistentVolumeSource.RBD.RBDImage
	return p.rbdUtil.DeleteImage(image, opts)
}
585619
func (e *Echo) Delete(path string, h interface{}, m ...interface{}) {
	e.add(DELETE, "", path, h, m...)
}
648141
func (db *DB) Delete(key []byte, wo *opt.WriteOptions) error {
	return db.putRec(keyTypeDel, key, nil, wo)
}