|
|
|
@@ -27,6 +27,26 @@ func (s *Server) Presigned() *PresignedService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (s *PresignedService) ObjectListByPath(ctx *gin.Context) { |
|
|
|
log := logger.WithField("HTTP", "Presigned.ObjectListByPath") |
|
|
|
|
|
|
|
var req cdsapi.PresignedObjectListByPath |
|
|
|
if err := ctx.ShouldBindQuery(&req); err != nil { |
|
|
|
log.Warnf("binding body: %s", err.Error()) |
|
|
|
ctx.JSON(http.StatusBadRequest, Failed(errorcode.BadArgument, "missing argument or invalid argument")) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
resp, err := s.svc.ObjectSvc().GetByPath(req.ObjectListByPath) |
|
|
|
if err != nil { |
|
|
|
log.Warnf("listing objects: %s", err.Error()) |
|
|
|
ctx.JSON(http.StatusOK, Failed(errorcode.OperationFailed, fmt.Sprintf("listing objects: %v", err))) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
ctx.JSON(http.StatusOK, OK(resp)) |
|
|
|
} |
|
|
|
|
|
|
|
func (s *PresignedService) ObjectDownloadByPath(ctx *gin.Context) { |
|
|
|
log := logger.WithField("HTTP", "Presigned.ObjectDownloadByPath") |
|
|
|
|
|
|
|
|