// Deletes tasks from a staged recovery.
// 
// Parameters:
//  - Query
339295
func (p *AuroraAdminClient) DeleteRecoveryTasks(ctx context.Context, query *TaskQuery) (r *Response, err error) {
  var _args328 AuroraAdminDeleteRecoveryTasksArgs
  _args328.Query = query
  var _result329 AuroraAdminDeleteRecoveryTasksResult
  if err = p.Client_().Call(ctx, "deleteRecoveryTasks", &_args328, &_result329); err != nil {
    return
  }
  return _result329.GetSuccess(), nil
}
650087
func (s *globalTaskService) taskRemoveAfter(t *task) {
	go func() {
		logTimeoutDur, err := time.ParseDuration(
			s.config.GetString(types.ConfigServerTasksLogTimeout))
		if err != nil {
			logTimeoutDur = time.Duration(time.Second * 60)
		}

		// wait to remove the task
		time.Sleep(logTimeoutDur)

		// sync access to the task map for querying its size before and after
		// executing the delete operation on it
		s.Lock()
		defer s.Unlock()

		t.ctx.WithFields(log.Fields{
			"removedAfter": logTimeoutDur,
			"tasksLen":     len(s.tasks),
		}).Debug("removing task")

		// delete the task
		delete(s.tasks, t.ID)

		t.ctx.WithField("tasksLen", len(s.tasks)).Debug("removed task")
	}()
}
1325268
func (self *SqlBackend) DeleteQuery(collection *dal.Collection, f *filter.Filter) error {
	if tx, err := self.db.Begin(); err == nil {
		queryGen := self.makeQueryGen(collection)
		queryGen.Type = generators.SqlDeleteStatement

		// generate SQL
		if stmt, err := filter.Render(queryGen, collection.Name, f); err == nil {
			querylog.Debugf("[%v] %s %v", self, string(stmt[:]), queryGen.GetValues())

			// execute SQL
			if _, err := tx.Exec(string(stmt[:]), queryGen.GetValues()...); err == nil {
				if err := tx.Commit(); err == nil {
					return nil
				} else {
					return err
				}
			} else {
				defer tx.Rollback()
				return err
			}
		} else {
			defer tx.Rollback()
			return err
		}
	} else {
		return err
	}
}
1243373
func (c *Client) Delete() *Request {
	req := c.Request()
	req.Method("DELETE")
	return req
}
603824
func (s *ScanService) Query(query Query) *ScanService {
	s.searchSource = s.searchSource.Query(query)
	return s
}
1356512
func (api *RoutersAPI) Delete(routerID string) (task *Task, err error) {
	res, err := api.client.restClient.Delete(api.client.Endpoint+routerUrl+routerID, api.client.options.TokenOptions)
	if err != nil {
		return
	}

	defer res.Body.Close()
	task, err = getTask(getError(res))
	return
}
1136497
func (s *Store) PreparedQueryDelete(idx uint64, queryID string) error {
	tx := s.db.Txn(true)
	defer tx.Abort()

	if err := s.preparedQueryDeleteTxn(tx, idx, queryID); err != nil {
		return fmt.Errorf("failed prepared query delete: %s", err)
	}

	tx.Commit()
	return nil
}
1168158
func (mem *Memory) Query(keyvals map[string]string) ([]*rspb.Release, error) {
	defer unlock(mem.rlock())

	var lbs labels

	lbs.init()
	lbs.fromMap(keyvals)

	var ls []*rspb.Release
	for _, recs := range mem.cache {
		recs.Iter(func(_ int, rec *record) bool {
			// A query for a release name that doesn't exist (has been deleted)
			// can cause rec to be nil.
			if rec == nil {
				return false
			}
			if rec.lbs.match(lbs) {
				ls = append(ls, rec.rls)
			}
			return true
		})
	}
	return ls, nil
}
471368
func (m *qlbStmt) Query(args []driver.Value) (driver.Rows, error) {
	var err error
	if len(args) > 0 {
		m.query, err = queryArgsConvert(m.query, args)
		if err != nil {
			return nil, err
		}
	}
	u.Debugf("query: %v", m.query)

	// Create a Job, which is Dag of Tasks that Run()
	ctx := plan.NewContext(m.query)
	ctx.Schema = m.conn.schema
	job, err := BuildSqlJob(ctx)
	if err != nil {
		u.Warnf("return error? %v", err)
		return nil, err
	}
	m.job = job

	// The only type of stmt that makes sense for Query is SELECT
	//  and we need list of columns that requires casing
	sqlSelect, ok := job.Ctx.Stmt.(*rel.SqlSelect)
	if !ok {
		u.Warnf("ctx? %v", job.Ctx)
		return nil, fmt.Errorf("We could not recognize that as a select query: %T", job.Ctx.Stmt)
	}

	// Prepare a result writer, we manually append this task to end
	// of job?
	resultWriter := NewResultRows(ctx, sqlSelect.Columns.AliasedFieldNames())

	job.RootTask.Add(resultWriter)

	job.Setup()

	// TODO:   this can't run in parallel-buffered mode?
	// how to open in go-routine and still be able to send error to rows?
	go func() {
		//u.Debugf("Start Job.Run")
		err = job.Run()
		//u.Debugf("After job.Run()")
		if err != nil {
			u.Errorf("error on Query.Run(): %v", err)
			//resultWriter.ErrChan() <- err
			//job.Close()
		}
		job.Close()
		//u.Debugf("exiting Background Query")
	}()

	return resultWriter, nil
}
1101586
func (self *Model) DeleteQuery(flt interface{}) error {
	if f, err := self.filterFromInterface(flt); err == nil {
		f.IdentityField = self.collection.IdentityField

		if search := self.db.WithSearch(self.collection, f); search != nil {
			return search.DeleteQuery(self.collection, f)
		} else {
			return fmt.Errorf("backend %T does not support searching", self.db)
		}
	} else {
		return err
	}
}
1176391
func (t *Task) Delete(ctx context.Context) (*runtime.Exit, error) {
	rsp, err := t.shim.Delete(ctx, empty)
	if err != nil {
		return nil, errdefs.FromGRPC(err)
	}
	t.tasks.Delete(ctx, t.id)
	if err := t.shim.KillShim(ctx); err != nil {
		log.G(ctx).WithError(err).Error("failed to kill shim")
	}
	if err := t.bundle.Delete(); err != nil {
		log.G(ctx).WithError(err).Error("failed to delete bundle")
	}
	t.events.Publish(ctx, runtime.TaskDeleteEventTopic, &eventstypes.TaskDelete{
		ContainerID: t.id,
		ExitStatus:  rsp.ExitStatus,
		ExitedAt:    rsp.ExitedAt,
		Pid:         rsp.Pid,
	})
	return &runtime.Exit{
		Status:    rsp.ExitStatus,
		Timestamp: rsp.ExitedAt,
		Pid:       rsp.Pid,
	}, nil
}
401049
func (ix *Reindexer) Query(q Query) *Reindexer {
	ix.query = q
	return ix
}
825316
func (c *Client) DeleteByQuery(indices ...string) *DeleteByQueryService {
	return NewDeleteByQueryService(c).Index(indices...)
}
1106161
func (s *Snapshotter) processQuery(q *Query) {
	// Ignore old clocks
	if q.LTime <= s.lastQueryClock {
		return
	}
	s.lastQueryClock = q.LTime
	s.tryAppend(fmt.Sprintf("query-clock: %d\n", q.LTime))
}
772253
func (s *Server) Delete(ctx context.Context, q *ClusterQuery) (*ClusterResponse, error) {
	if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceClusters, rbacpolicy.ActionDelete, q.Server); err != nil {
		return nil, err
	}
	err := s.db.DeleteCluster(ctx, q.Server)
	return &ClusterResponse{}, err
}
1248431
func (c oauthClient) DeleteTask(task wl.Task) error {
	url := fmt.Sprintf(
		"%s/tasks/%d?revision=%d",
		c.apiURL,
		task.ID,
		task.Revision,
	)

	req, err := c.newDeleteRequest(url)
	if err != nil {
		return err
	}

	resp, err := c.do(req)
	if err != nil {
		return err
	}

	if resp.StatusCode != http.StatusNoContent {
		return fmt.Errorf("Unexpected response code %d - expected %d", resp.StatusCode, http.StatusNoContent)
	}

	return nil
}
697972
func (s *Server) Delete(ctx context.Context, q *ProjectQuery) (*EmptyResponse, error) {
	if q.Name == common.DefaultAppProjectName {
		return nil, status.Errorf(codes.InvalidArgument, "name '%s' is reserved and cannot be deleted", q.Name)
	}
	if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceProjects, rbacpolicy.ActionDelete, q.Name); err != nil {
		return nil, err
	}

	s.projectLock.Lock(q.Name)
	defer s.projectLock.Unlock(q.Name)

	p, err := s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).Get(q.Name, metav1.GetOptions{})
	if err != nil {
		return nil, err
	}

	appsList, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).List(metav1.ListOptions{})
	if err != nil {
		return nil, err
	}
	apps := argo.FilterByProjects(appsList.Items, []string{q.Name})
	if len(apps) > 0 {
		return nil, status.Errorf(codes.InvalidArgument, "project is referenced by %d applications", len(apps))
	}
	err = s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).Delete(q.Name, &metav1.DeleteOptions{})
	if err == nil {
		s.logEvent(p, ctx, argo.EventReasonResourceDeleted, "deleted project")
	}
	return &EmptyResponse{}, err
}