// DeleteFileShare deletes a file share using storage account name and key
540605
func (az *Cloud) DeleteFileShare(accountName, accountKey, shareName string) error {
	if err := az.deleteFileShare(accountName, accountKey, shareName); err != nil {
		return err
	}
	klog.V(4).Infof("share %s deleted", shareName)
	return nil
}
1326006
func (api *Client) DeleteFileContext(ctx context.Context, fileID string) (err error) {
	values := url.Values{
		"token": {api.token},
		"file":  {fileID},
	}

	_, err = api.fileRequest(ctx, "files.delete", values)
	return err
}
376360
func DeleteLease(server, authToken, cloudProvider, leaseToken string) error {
	endpt := newEndpoint(htp.Delete, server, "lease/"+cloudProvider+"/"+leaseToken)
	resp, err := endpt.executeReq(getHTTPClient(), nil, authToken)
	if err != nil {
		return errHTTPRequest{endpoint: endpt.String(), err: err}
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return APIError{endpoint: endpt.String(), code: resp.StatusCode}
	}
	return nil
}
748177
func (s *DeleteFileShareOutput) SetFileShareARN(v string) *DeleteFileShareOutput {
	s.FileShareARN = &v
	return s
}
52052
func (a *Client) DeleteFilesFileidentifier(params *DeleteFilesFileidentifierParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteFilesFileidentifierNoContent, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteFilesFileidentifierParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "DeleteFilesFileidentifier",
		Method:             "DELETE",
		PathPattern:        "/files/{fileidentifier}",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeleteFilesFileidentifierReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*DeleteFilesFileidentifierNoContent), nil
}
1296818
func (s *shareDBV1) Delete(objectURL string) {
	s.mutex.Lock()
	defer s.mutex.Unlock()

	delete(s.Shares, objectURL)
}
429786
func (az *Cloud) createFileShare(accountName, accountKey, name string, sizeGiB int) error {
	return az.FileClient.createFileShare(accountName, accountKey, name, sizeGiB)
}
1204658
func (s *FileShareInfo) SetFileShareType(v string) *FileShareInfo {
	s.FileShareType = &v
	return s
}
998274
func (m *DatastoreFileManager) DeleteFile(ctx context.Context, name string) error {
	p := m.Path(name)

	task, err := m.FileManager.DeleteDatastoreFile(ctx, p.String(), m.Datacenter)
	if err != nil {
		return err
	}

	return m.wait(ctx, task)
}
160115
func (c *DbClient) DeleteFile(path string) {
	c.Lock()
	defer c.Unlock()

	delete(c.db, path)
}
845113
func (c SimpleFSClient) SimpleFSRemove(ctx context.Context, __arg SimpleFSRemoveArg) (err error) {
	err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSRemove", []interface{}{__arg}, nil)
	return
}
1171753
func (c *Client) DeleteDatastoreFile(ctx context.Context, datastorePath string) error {
	_, datacenter, err := c.finder(ctx)
	if err != nil {
		return errors.Trace(err)
	}
	fileManager := object.NewFileManager(c.client.Client)
	deleteTask, err := fileManager.DeleteDatastoreFile(ctx, datastorePath, datacenter)
	if err != nil {
		return errors.Trace(err)
	}
	if _, err := deleteTask.WaitForResult(ctx, nil); err != nil {
		if types.IsFileNotFound(err) {
			return nil
		}
		return errors.Trace(err)
	}
	return nil
}
1365153
func (s *UpdateNFSFileShareInput) SetFileShareARN(v string) *UpdateNFSFileShareInput {
	s.FileShareARN = &v
	return s
}
1273591
func (f *sendReceiveFolder) deleteFile(file protocol.FileInfo, scanChan chan<- string) (dbUpdateJob, error) {
	// Used in the defer closure below, updated by the function body. Take
	// care not declare another err.
	var err error

	events.Default.Log(events.ItemStarted, map[string]string{
		"folder": f.folderID,
		"item":   file.Name,
		"type":   "file",
		"action": "delete",
	})

	defer func() {
		events.Default.Log(events.ItemFinished, map[string]interface{}{
			"folder": f.folderID,
			"item":   file.Name,
			"error":  events.Error(err),
			"type":   "file",
			"action": "delete",
		})
	}()

	cur, ok := f.fset.Get(protocol.LocalDeviceID, file.Name)
	if !ok {
		// We should never try to pull a deletion for a file we don't have in the DB.
		l.Debugln(f, "not deleting file we don't have", file.Name)
		return dbUpdateJob{file, dbUpdateDeleteFile}, nil
	}
	if err = f.checkToBeDeleted(cur, scanChan); err != nil {
		return dbUpdateJob{}, err
	}

	// We are asked to delete a file, but what we have on disk and in db
	// is a directory. Something is wrong here, should probably not happen.
	if cur.IsDirectory() {
		return dbUpdateJob{}, errUnexpectedDirOnFileDel
	}

	if f.inConflict(cur.Version, file.Version) {
		// There is a conflict here, which shouldn't happen as deletions
		// always lose. Merge the version vector of the file we have
		// locally and commit it to db to resolve the conflict.
		cur.Version = cur.Version.Merge(file.Version)
		return dbUpdateJob{cur, dbUpdateHandleFile}, nil
	}

	if f.versioner != nil && !cur.IsSymlink() {
		err = osutil.InWritableDir(f.versioner.Archive, f.fs, file.Name)
	} else {
		err = osutil.InWritableDir(f.fs.Remove, f.fs, file.Name)
	}

	if err == nil || fs.IsNotExist(err) {
		// It was removed or it doesn't exist to start with
		return dbUpdateJob{file, dbUpdateDeleteFile}, nil
	}

	if _, serr := f.fs.Lstat(file.Name); serr != nil && !fs.IsPermission(serr) {
		// We get an error just looking at the file, and it's not a permission
		// problem. Lets assume the error is in fact some variant of "file
		// does not exist" (possibly expressed as some parent being a file and
		// not a directory etc) and that the delete is handled.
		err = nil
		return dbUpdateJob{file, dbUpdateDeleteFile}, nil
	}

	return dbUpdateJob{}, err
}
726194
func (s *RefreshCacheOutput) SetFileShareARN(v string) *RefreshCacheOutput {
	s.FileShareARN = &v
	return s
}
552143
func (s *NFSFileShareInfo) SetFileShareId(v string) *NFSFileShareInfo {
	s.FileShareId = &v
	return s
}
301102
func DeleteFilesIf(dir string, shouldDelete func(os.FileInfo) bool) error {
	files, err := ioutil.ReadDir(dir)
	if err != nil {
		return err
	}
	for _, fi := range files {
		if fi.IsDir() || !fi.Mode().IsRegular() {
			continue
		}
		if shouldDelete(fi) {
			path := filepath.Join(dir, fi.Name())
			err = os.Remove(path)
			// Maybe: keep deleting?
			if err != nil {
				return err
			}
		}
	}
	return nil
}