wip: s3 file prefix filter
This commit is contained in:
@ -8,15 +8,16 @@ import (
|
||||
|
||||
func BucketFile(c *ndh.Ctx) error {
|
||||
type Req struct {
|
||||
ConnId uint64 `json:"conn_id"`
|
||||
Bucket string `json:"bucket"`
|
||||
Keyword string `json:"keyword"`
|
||||
ConnId uint64 `json:"conn_id"`
|
||||
Bucket string `json:"bucket"`
|
||||
Prefix string `json:"prefix"`
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
req = new(Req)
|
||||
client *s3.Client
|
||||
list []*s3.ListFileRes
|
||||
)
|
||||
|
||||
if err = c.ReqParse(req); err != nil {
|
||||
@ -31,5 +32,9 @@ func BucketFile(c *ndh.Ctx) error {
|
||||
return c.Send500(err.Error())
|
||||
}
|
||||
|
||||
client.ListFile()
|
||||
if list, err = client.ListFile(c.Context(), req.Bucket, req.Prefix); err != nil {
|
||||
return c.Send500(err.Error())
|
||||
}
|
||||
|
||||
return c.Send200(map[string]any{"list": list})
|
||||
}
|
||||
|
Reference in New Issue
Block a user