// Delete corresponds to the DELETE /tokens/:token endpoint.
//
// Revoke an auth token for log out
540509
func (c *TokensClient) Delete(ctx context.Context, token string) error {
	p := fmt.Sprintf("/tokens/%s", token)

	req, err := c.backend.NewRequest(http.MethodDelete, p, nil, nil)
	if err != nil {
		return err
	}

	_, err = c.backend.Do(ctx, req, nil, func(code int) error {
		return &Error{}
	})
	if err != nil {
		return err
	}

	return nil
}
29998
func (c *Client) Delete(ctx context.Context, container, key string) error {
	req := newReq(ctx, c.keyURL(container, key))
	req.Method = "DELETE"
	c.Auth.SignRequest(req)
	res, err := c.transport().RoundTrip(req)
	if err != nil {
		return err
	}
	if res != nil && res.Body != nil {
		defer res.Body.Close()
	}
	if res.StatusCode == http.StatusNotFound || res.StatusCode == http.StatusNoContent ||
		res.StatusCode == http.StatusAccepted {
		return nil
	}
	return fmt.Errorf("azure HTTP error on DELETE: %d", res.StatusCode)
}
562863
func (s *Service) OAuthAuthorizationDelete(ctx context.Context, oauthAuthorizationIdentity string) (*OAuthAuthorization, error) {
	var oauthAuthorization OAuthAuthorization
	return &oauthAuthorization, s.Delete(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations/%v", oauthAuthorizationIdentity))
}
1252068
func (r Resource) Delete(request *restful.Request, response *restful.Response) {
	if resource, ok := r.Parent.(DeleteSupported); ok {
		context := r.Context.NewAPIContext()
		if resource.DeleteAuthRequired() {
			auth, err := context.Authentication(request)
			if err != nil || auth == nil {
				ErrorResponseHandler(request, response, err, NewErrorResponse(
					http.StatusUnauthorized,
					"Invalid accesstoken",
					"DELETE"))
				return
			}
		}

		resource.Delete(context, request, response)
		request.SetAttribute("context", context)
	}
}
731217
func (s *Sensu) delete(endpoint string) error {
	url := fmt.Sprintf("%s/%s", s.URL, endpoint)
	req, err := http.NewRequest("DELETE", url, nil)
	if err != nil {
		return fmt.Errorf("Parsing error: %q returned: %v", err, err)
	}

	if s.User != "" && s.Pass != "" {
		req.SetBasicAuth(s.User, s.Pass)
	}

	res, err := s.Client.Do(req)

	if err != nil {
		return fmt.Errorf("API call to %q returned: %v", url, err)
	}
	defer res.Body.Close()

	if err != nil {
		return fmt.Errorf("%v", err)
	}
	if res.StatusCode >= 400 {
		return fmt.Errorf("%v", res.Status)
	}
	return nil
}
977748
func Delete(c *client.Client, username string) error {
	var body []byte
	var err error

	if username != "" {
		req := api.AuthCancelRequest{Username: username}
		body, err = json.Marshal(req)

		if err != nil {
			return err
		}
	}

	_, err = c.BasicRequest("DELETE", "/v1/auth/cancel/", body)
	return err
}
592456
func (s *SwiftBackend) Delete(ctx context.Context, key string) error {
	defer metrics.MeasureSince([]string{"swift", "delete"}, time.Now())

	s.permitPool.Acquire()
	defer s.permitPool.Release()

	err := s.client.ObjectDelete(s.container, key)

	if err != nil && err != swift.ObjectNotFound {
		return err
	}

	return nil
}
877147
func (s *REST) Delete(ctx context.Context, name string, options *metav1.DeleteOptions) (runtime.Object, bool, error) {
	return &metav1.Status{Status: metav1.StatusSuccess}, false, s.client.Delete(name, nil)
}
39713
func (a *ACLTokens) Delete(accessorID string, q *WriteOptions) (*WriteMeta, error) {
	if accessorID == "" {
		return nil, fmt.Errorf("missing accessor ID")
	}
	wm, err := a.client.delete("/v1/acl/token/"+accessorID, nil, q)
	if err != nil {
		return nil, err
	}
	return wm, nil
}
1285153
func (t *DomainPassword) Delete() (err error) {
	err = sysCredDelete(&t.Credential, sysCRED_TYPE_DOMAIN_PASSWORD)
	return
}
224349
func (s *APIServer) deleteToken(auth ClientI, w http.ResponseWriter, r *http.Request, p httprouter.Params, version string) (interface{}, error) {
	token := p.ByName("token")
	if err := auth.DeleteToken(token); err != nil {
		return nil, trace.Wrap(err)
	}
	return message(fmt.Sprintf("Token %v deleted", token)), nil
}
1237667
func (forceApi *ForceApi) Delete(path string, params url.Values) error {
	return forceApi.request("DELETE", path, params, nil, nil)
}
166304
func (c *FakeOAuthAuthorizeTokens) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewRootDeleteAction(oauthauthorizetokensResource, name), &oauth.OAuthAuthorizeToken{})
	return err
}
800325
func Delete(c *deis.Client, username string) error {
	var body []byte
	var err error

	if username != "" {
		req := api.AuthCancelRequest{Username: username}
		body, err = json.Marshal(req)

		if err != nil {
			return err
		}
	}

	res, err := c.Request("DELETE", "/v2/auth/cancel/", body)
	if err == nil {
		res.Body.Close()
	}
	return err
}
400067
func (firewalls *Firewalls) Delete(ctx context.Context, zone, id string) (err error) {
	response, err := httpDo(ctx, firewalls.Options, "DELETE", apiURL("/zones/%s/firewall/access_rules/rules/%s", zone, id), nil)
	if err != nil {
		return
	}
	defer response.Body.Close()
	_, err = readResponse(response.Body)
	return
}
419032
func (m *MySQLStore) Delete(token string) error {
	_, err := m.DB.Exec("DELETE FROM sessions WHERE token = ?", token)
	return err
}
648168
func (s *AccountsService) Delete(k AccountKey) (*http.Response, error) {
	return s.client.delete(k.URI(), nil)
}