wip: s3 file prefix filter

This commit is contained in:
zhaoyupeng
2024-10-11 18:03:09 +08:00
parent 8bc2a2541d
commit f54ed67f0f
14 changed files with 286 additions and 52 deletions

View File

@ -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})
}