MCPcopy
hub / github.com/pocketbase/pocketbase / DeleteObject

Method DeleteObject

tools/filesystem/internal/s3blob/s3/delete_object.go:11–31  ·  view source on GitHub ↗

DeleteObject deletes a single object by its key. https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html

(ctx context.Context, key string, optFuncs ...func(*http.Request))

Source from the content-addressed store, hash-verified

9//
10// https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html
11func (s3 *S3) DeleteObject(ctx context.Context, key string, optFuncs ...func(*http.Request)) error {
12 req, err := http.NewRequestWithContext(ctx, http.MethodDelete, s3.URL(key), nil)
13 if err != nil {
14 return err
15 }
16
17 // apply optional request funcs
18 for _, fn := range optFuncs {
19 if fn != nil {
20 fn(req)
21 }
22 }
23
24 resp, err := s3.SignAndSend(req)
25 if err != nil {
26 return err
27 }
28 defer resp.Body.Close()
29
30 return nil
31}

Callers 2

TestS3DeleteObjectFunction · 0.95
DeleteMethod · 0.80

Calls 4

URLMethod · 0.95
SignAndSendMethod · 0.95
CloseMethod · 0.65
fnFunction · 0.50

Tested by 1

TestS3DeleteObjectFunction · 0.76