-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support using Huawei Cloud OBS to store custom define yml file (#1266)
Co-authored-by: tomsun28 <[email protected]>
- Loading branch information
Showing
24 changed files
with
930 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
manager/src/main/java/org/dromara/hertzbeat/manager/pojo/dto/FileDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.dromara.hertzbeat.manager.pojo.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.InputStream; | ||
|
||
/** | ||
* 文件存储 | ||
* | ||
* @author <a href="mailto:[email protected]">gcdd1993</a> | ||
* Created by gcdd1993 on 2023/9/13 | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class FileDTO { | ||
private String name; | ||
private InputStream inputStream; | ||
} |
20 changes: 20 additions & 0 deletions
20
...er/src/main/java/org/dromara/hertzbeat/manager/pojo/dto/ObjectStoreConfigChangeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.dromara.hertzbeat.manager.pojo.dto; | ||
|
||
import lombok.Getter; | ||
import org.springframework.context.ApplicationEvent; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">gcdd1993</a> | ||
* Created by gcdd1993 on 2023/9/28 | ||
*/ | ||
@Getter | ||
public class ObjectStoreConfigChangeEvent extends ApplicationEvent { | ||
private final ObjectStoreDTO<?> config; | ||
|
||
public ObjectStoreConfigChangeEvent(ObjectStoreDTO<?> config) { | ||
super(UUID.randomUUID()); | ||
this.config = config; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
manager/src/main/java/org/dromara/hertzbeat/manager/pojo/dto/ObjectStoreDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.dromara.hertzbeat.manager.pojo.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* 文件存储容器 | ||
* | ||
* @author <a href="mailto:[email protected]">gcdd1993</a> | ||
* Created by gcdd1993 on 2023/9/13 | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ObjectStoreDTO<T> { | ||
|
||
/** | ||
* 文件存储服务类型 | ||
*/ | ||
private Type type; | ||
|
||
/** | ||
* 配置项 | ||
*/ | ||
private T config; | ||
|
||
/** | ||
* 文件存储服务类型 | ||
*/ | ||
public enum Type { | ||
|
||
/** | ||
* 本地文件 | ||
*/ | ||
FILE, | ||
|
||
/** | ||
* <a href="https://support.huaweicloud.com/obs/index.html">华为云OBS</a> | ||
*/ | ||
OBS | ||
} | ||
|
||
@Data | ||
public static class ObsConfig { | ||
private String accessKey; | ||
private String secretKey; | ||
private String bucketName; | ||
private String endpoint; | ||
|
||
/** | ||
* 保存路径 | ||
*/ | ||
private String savePath = "hertzbeat"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ public class SystemConfig { | |
* 系统语言地区 | ||
*/ | ||
private String locale; | ||
|
||
/** | ||
* layout ui theme | ||
*/ | ||
|
43 changes: 43 additions & 0 deletions
43
manager/src/main/java/org/dromara/hertzbeat/manager/service/ObjectStoreService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.dromara.hertzbeat.manager.service; | ||
|
||
import org.dromara.hertzbeat.manager.pojo.dto.FileDTO; | ||
import org.dromara.hertzbeat.manager.pojo.dto.ObjectStoreDTO; | ||
|
||
import java.io.InputStream; | ||
import java.util.List; | ||
|
||
/** | ||
* 文件存储服务 | ||
* | ||
* @author <a href="mailto:[email protected]">gcdd1993</a> | ||
* Created by gcdd1993 on 2023/9/13 | ||
*/ | ||
public interface ObjectStoreService { | ||
|
||
/** | ||
* 保存文件 | ||
* | ||
* @param filePath 文件路径,例如:hertzbeat/111.json | ||
* @param is 文件流 | ||
*/ | ||
boolean upload(String filePath, InputStream is); | ||
|
||
/** | ||
* 读取文件 | ||
* | ||
* @param filePath 文件路径,例如:hertzbeat/111.json | ||
* @return 文件 | ||
*/ | ||
FileDTO download(String filePath); | ||
|
||
/** | ||
* 列举文件 | ||
* | ||
* @param dir 文件目录 | ||
* @return 文件列表 | ||
*/ | ||
List<FileDTO> list(String dir); | ||
|
||
ObjectStoreDTO.Type type(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.