|
@@ -1,18 +1,9 @@
|
|
|
package cn.reghao.dfs.store.oss.controller;
|
|
package cn.reghao.dfs.store.oss.controller;
|
|
|
|
|
|
|
|
-import cn.reghao.dfs.store.oss.model.po.object.DeleteObjects;
|
|
|
|
|
-import cn.reghao.dfs.store.oss.service.ObjectServiceImpl;
|
|
|
|
|
import cn.reghao.jutil.jdk.result.WebBody;
|
|
import cn.reghao.jutil.jdk.result.WebBody;
|
|
|
-import cn.reghao.jutil.web.ServletUtil;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
-import org.rocksdb.RocksDBException;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
-
|
|
|
|
|
-import java.io.IOException;
|
|
|
|
|
-import java.net.URLDecoder;
|
|
|
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author reghao
|
|
* @author reghao
|
|
@@ -22,99 +13,6 @@ import java.nio.charset.StandardCharsets;
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/object")
|
|
@RequestMapping("/object")
|
|
|
public class ObjectController {
|
|
public class ObjectController {
|
|
|
- private final ObjectServiceImpl objectService;
|
|
|
|
|
-
|
|
|
|
|
- public ObjectController(ObjectServiceImpl objectService) {
|
|
|
|
|
- this.objectService = objectService;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation("上传对象")
|
|
|
|
|
- @PutMapping(value = "/**")
|
|
|
|
|
- public String putObject(MultipartFile file) throws Exception {
|
|
|
|
|
- String uri = ServletUtil.getRequest().getRequestURI();
|
|
|
|
|
- String uri1 = URLDecoder.decode(uri, StandardCharsets.UTF_8);
|
|
|
|
|
-
|
|
|
|
|
- String objectName = uri1.replace("/object", "");
|
|
|
|
|
- objectService.putObject(objectName, file);
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation("使用 formdata 上传对象")
|
|
|
|
|
- @PostMapping(value = "/")
|
|
|
|
|
- public String postObject(@RequestParam("key") String objectName, @RequestParam("file") MultipartFile file) {
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation("开启分片上传")
|
|
|
|
|
- @PostMapping(value = "/{objectName}", params = {"uploads"})
|
|
|
|
|
- public String initiateMultipartUpload(@PathVariable("objectName") String objectName) {
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation("分片上传对象")
|
|
|
|
|
- @PutMapping(value = "/{objectName}", params = {"partNumber", "uploadId"})
|
|
|
|
|
- public String uploadPart(@PathVariable("objectName") String objectName,
|
|
|
|
|
- @RequestParam("partNumber") long partNumber,
|
|
|
|
|
- @RequestParam("uploadId") String uploadId,
|
|
|
|
|
- MultipartFile multipartFile) {
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation(value = "完成分片上传")
|
|
|
|
|
- @PostMapping(value = "/{objectName}", params = {"uploadId"})
|
|
|
|
|
- public String completeMultipartUpload(@PathVariable("objectName") String objectName,
|
|
|
|
|
- @RequestParam("uploadId") String uploadId) {
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation(value = "终止分片上传")
|
|
|
|
|
- @DeleteMapping(value = "/{objectName}", params = {"uploadId"})
|
|
|
|
|
- public String abortMultipartUpload(@PathVariable("objectName") String objectName,
|
|
|
|
|
- @RequestParam("uploadId") String uploadId) {
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation("获取分片 uploadId 下的所有分片")
|
|
|
|
|
- @GetMapping(value = "/{objectName}", params = {"uploadId"})
|
|
|
|
|
- public String listParts(@PathVariable("objectName") String objectName, @RequestParam("uploadId") String uploadId) {
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation("获取对象的元数据")
|
|
|
|
|
- @RequestMapping(value = "/{objectName}", method = RequestMethod.HEAD)
|
|
|
|
|
- public String headObject(@PathVariable("objectName") String objectName) throws RocksDBException {
|
|
|
|
|
- objectService.headObject(objectName);
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation("获取对象")
|
|
|
|
|
- @GetMapping(value = "/**")
|
|
|
|
|
- public void getObject() throws RocksDBException, IOException {
|
|
|
|
|
- String uri = ServletUtil.getRequest().getRequestURI();
|
|
|
|
|
- String uri1 = URLDecoder.decode(uri, StandardCharsets.UTF_8);
|
|
|
|
|
-
|
|
|
|
|
- String objectName = uri1.replace("/object", "");
|
|
|
|
|
- objectService.getObject(objectName);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation(value = "删除对象")
|
|
|
|
|
- @DeleteMapping(value = "/{objectName}")
|
|
|
|
|
- public String deleteObject(@PathVariable("objectName") String objectName) {
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation(value = "删除多个对象")
|
|
|
|
|
- @PostMapping(value = "/", params = {"delete"})
|
|
|
|
|
- public String deleteMultipleObjects(DeleteObjects deleteObjects) {
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation("创建已存在对象的副本")
|
|
|
|
|
- @PutMapping(value = "/{destinationObject}", params = {"destinationObject"})
|
|
|
|
|
- public String putObjectCopy(@PathVariable("destinationObject") String destinationObject) {
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@ApiOperation("开启或关闭对象的依法保留状态")
|
|
@ApiOperation("开启或关闭对象的依法保留状态")
|
|
|
@PutMapping(value = "/{objectKey}", params = {"legal-hold"})
|
|
@PutMapping(value = "/{objectKey}", params = {"legal-hold"})
|
|
|
public String putObjectLegalHold(@PathVariable("objectKey") String objectKey) {
|
|
public String putObjectLegalHold(@PathVariable("objectKey") String objectKey) {
|
|
@@ -133,15 +31,6 @@ public class ObjectController {
|
|
|
return WebBody.success();
|
|
return WebBody.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @ApiOperation("复制已存在的对象作为源数据上传分片")
|
|
|
|
|
- @PutMapping(value = "/{objectName}", params = {"partNumber", "uploadId"}, headers = {"x-amz-copy-source"})
|
|
|
|
|
- public String uploadPartCopy(@PathVariable("objectName") String objectName,
|
|
|
|
|
- @RequestParam("partNumber") long partNumber,
|
|
|
|
|
- @RequestParam("uploadId") String uploadId,
|
|
|
|
|
- MultipartFile multipartFile) {
|
|
|
|
|
- return WebBody.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@ApiOperation(value = "对存储类型为 GLACIER 的对象还原临时副本")
|
|
@ApiOperation(value = "对存储类型为 GLACIER 的对象还原临时副本")
|
|
|
@PostMapping(value = "/{objectName}", params = {"restore"})
|
|
@PostMapping(value = "/{objectName}", params = {"restore"})
|
|
|
public String postObjectRestore(@PathVariable("objectName") String objectName) {
|
|
public String postObjectRestore(@PathVariable("objectName") String objectName) {
|