// DeleteSubtask deletes the provided Subtask.
518689
func (c oauthClient) DeleteSubtask(subtask wl.Subtask) error {
	url := fmt.Sprintf(
		"%s/subtasks/%d?revision=%d",
		c.apiURL,
		subtask.ID,
		subtask.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
}
1287788
func (t TaskService) DeleteTask(ctx context.Context, id platform.ID) error {
	span, _ := tracing.StartSpanFromContext(ctx)
	defer span.Finish()

	u, err := newURL(t.Addr, taskIDPath(id))
	if err != nil {
		return err
	}

	req, err := http.NewRequest("DELETE", u.String(), nil)
	if err != nil {
		return err
	}

	req.Header.Set("Content-Type", "application/json")
	SetToken(t.Token, req)
	tracing.InjectToHTTPRequest(span, req)

	hc := newClient(u.Scheme, t.InsecureSkipVerify)

	resp, err := hc.Do(req)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	return CheckErrorStatus(http.StatusNoContent, resp)
}
360131
func (api *InternetAPI) DeleteSubnet(id int64, subnetID int64) (*sacloud.ResultFlagValue, error) {
	var (
		method = "DELETE"
		uri    = fmt.Sprintf("%s/%d/subnet/%d", api.getResourceURL(), id, subnetID)
	)

	res := &sacloud.ResultFlagValue{}
	err := api.baseAPI.request(method, uri, nil, res)
	if err != nil {
		return nil, err
	}
	return res, nil
}
902059
func (c *client) unsubscribe(acc *Account, sub *subscription, force bool) {
	c.mu.Lock()
	if !force && sub.max > 0 && sub.nm < sub.max {
		c.Debugf(
			"Deferring actual UNSUB(%s): %d max, %d received",
			string(sub.subject), sub.max, sub.nm)
		c.mu.Unlock()
		return
	}
	c.traceOp("<-> %s", "DELSUB", sub.sid)

	delete(c.subs, string(sub.sid))
	if c.kind != CLIENT && c.kind != SYSTEM {
		c.removeReplySubTimeout(sub)
	}

	if acc != nil {
		acc.sl.Remove(sub)
	}

	// Check to see if we have shadow subscriptions.
	var updateRoute bool
	shadowSubs := sub.shadow
	sub.shadow = nil
	if len(shadowSubs) > 0 {
		updateRoute = (c.kind == CLIENT || c.kind == SYSTEM || c.kind == LEAF) && c.srv != nil
	}
	c.mu.Unlock()

	for _, nsub := range shadowSubs {
		if err := nsub.im.acc.sl.Remove(nsub); err != nil {
			c.Debugf("Could not remove shadow import subscription for account %q", nsub.im.acc.Name)
		} else if updateRoute {
			c.srv.updateRouteSubscriptionMap(nsub.im.acc, nsub, -1)
		}
		// Now check on leafnode updates.
		c.srv.updateLeafNodes(nsub.im.acc, nsub, -1)
	}
}
212636
func (c oauthClient) DeleteAllTasks() error {
	tasks, err := c.Tasks()
	if err != nil {
		return err
	}

	taskCount := len(tasks)
	c.logger.Debug(
		"delete-all-tasks",
		map[string]interface{}{"taskCount": taskCount},
	)

	idErrChan := make(chan idErr, taskCount)
	for _, f := range tasks {
		go func(task wl.Task) {
			c.logger.Debug(
				"delete-all-tasks - deleting task",
				map[string]interface{}{"taskID": task.ID},
			)
			err := c.DeleteTask(task)
			idErrChan <- idErr{idType: "task", id: task.ID, err: err}
		}(f)
	}

	e := multiIDErr{}
	for i := 0; i < taskCount; i++ {
		idErr := <-idErrChan
		if idErr.err != nil {
			c.logger.Debug(
				"delete-all-tasks - error received",
				map[string]interface{}{"id": idErr.id, "err": err},
			)
			e.addError(idErr)
		}
	}

	if len(e.errors()) > 0 {
		return e
	}

	return nil
}
967126
func (s *SnapshotService) DeleteVMSnapshot(p *DeleteVMSnapshotParams) (*DeleteVMSnapshotResponse, error) {
	resp, err := s.cs.newRequest("deleteVMSnapshot", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r DeleteVMSnapshotResponse
	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
}
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
}
289024
func (gss *genericSubStore) DeleteSub(subid uint64) error {
	gss.Lock()
	delete(gss.subs, subid)
	gss.Unlock()
	return nil
}
1011190
func (s *AuthService) DeleteSubscription(c context.Context, subscription string) error {
	var reply struct {
		Error struct {
			Code int `json:"code"`
		} `json:"error"`
	}
	req := internal.Request{
		Method: "DELETE",
		URL:    s.pubSubURL(subscription),
		Scopes: oauthScopes,
		Out:    &reply,
	}
	if err := req.Do(c); err != nil && reply.Error.Code != 404 {
		return err
	}
	return nil
}
990683
func (c *Cloud) DeleteSnapshot(snapshotID string) (bool, error) {
	request := &ec2.DeleteSnapshotInput{}
	request.SnapshotId = aws.String(snapshotID)
	_, err := c.ec2.DeleteSnapshot(request)
	if err != nil {
		return false, err
	}

	return true, nil
}
1043165
func deleteBatch(ctx aws.Context, d *BatchDelete, input *s3.DeleteObjectsInput, objects []BatchDeleteObject) []Error {
	errs := []Error{}

	if result, err := d.Client.DeleteObjectsWithContext(ctx, input); err != nil {
		for i := 0; i < len(input.Delete.Objects); i++ {
			errs = append(errs, newError(err, input.Bucket, input.Delete.Objects[i].Key))
		}
	} else if len(result.Errors) > 0 {
		for i := 0; i < len(result.Errors); i++ {
			code := ErrDeleteBatchFailCode
			msg := errDefaultDeleteBatchMessage
			if result.Errors[i].Message != nil {
				msg = *result.Errors[i].Message
			}
			if result.Errors[i].Code != nil {
				code = *result.Errors[i].Code
			}

			errs = append(errs, newError(awserr.New(code, msg, err), input.Bucket, result.Errors[i].Key))
		}
	}
	for _, object := range objects {
		if object.After == nil {
			continue
		}
		if err := object.After(); err != nil {
			errs = append(errs, newError(err, object.Object.Bucket, object.Object.Key))
		}
	}

	return errs
}
101930
func (a *Allocation) LookupTask(name string) *Task {
	if a.Job == nil {
		return nil
	}

	tg := a.Job.LookupTaskGroup(a.TaskGroup)
	if tg == nil {
		return nil
	}

	return tg.LookupTask(name)
}
791328
func (s *TemplateService) DeleteTemplate(p *DeleteTemplateParams) (*DeleteTemplateResponse, error) {
	resp, err := s.cs.newRequest("deleteTemplate", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r DeleteTemplateResponse
	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
}
450046
func (c *Client) DeleteAccountFromProject(p *DeleteAccountFromProjectParameter) (*Result, error) {
	obj, err := c.Request("deleteAccountFromProject", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Result), err
}
544937
func (c *client) removeReplySubTimeout(sub *subscription) {
	// Remove any reply sub timer if it exists.
	if c.route == nil || c.route.replySubs == nil {
		return
	}
	if t, ok := c.route.replySubs[sub]; ok {
		t.Stop()
		delete(c.route.replySubs, sub)
	}
}
994457
func (cs *clientStore) removeSub(ID string, sub *subState) bool {
	cs.RLock()
	defer cs.RUnlock()
	c := cs.clients[ID]
	if c == nil {
		return false
	}
	c.Lock()
	removed := false
	c.subs, removed = sub.deleteFromList(c.subs)
	c.Unlock()
	return removed
}
705855
func (c *controllerAPI) DeleteSink(ctx context.Context, w http.ResponseWriter, req *http.Request) {
	params, _ := ctxhelper.ParamsFromContext(ctx)
	sinkID := params.ByName("sink_id")

	sink, err := c.sinkRepo.Get(sinkID)
	if err != nil {
		respondWithError(w, err)
		return
	}

	if err = c.sinkRepo.Remove(sinkID); err != nil {
		respondWithError(w, err)
		return
	}

	httphelper.JSON(w, 200, sink)
}