1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.bremersee.data.minio;
18
19 import io.minio.ObjectWriteResponse;
20 import io.minio.http.Method;
21 import io.minio.messages.DeleteError;
22 import java.time.Duration;
23 import java.util.Collection;
24 import java.util.List;
25 import java.util.Optional;
26 import javax.validation.constraints.NotEmpty;
27 import javax.validation.constraints.NotNull;
28 import org.springframework.lang.Nullable;
29 import org.springframework.validation.annotation.Validated;
30 import org.springframework.web.multipart.MultipartFile;
31
32
33
34
35
36
37 @Validated
38 public interface MinioRepository {
39
40
41
42
43
44
45 @NotNull
46 MinioOperations getMinioOperations();
47
48
49
50
51
52
53 String getRegion();
54
55
56
57
58
59
60 @NotEmpty
61 String getBucket();
62
63
64
65
66
67
68 boolean isVersioningEnabled();
69
70
71
72
73
74
75
76
77
78 Optional<ObjectWriteResponse> save(
79 @NotNull MinioObjectId id,
80 @Nullable MultipartFile multipartFile,
81 @NotNull DeleteMode deleteMode);
82
83
84
85
86
87
88
89 boolean exists(@NotNull MinioObjectId id);
90
91
92
93
94
95
96
97 Optional<MinioMultipartFile> findOne(@NotNull MinioObjectId id);
98
99
100
101
102
103
104 default List<MinioMultipartFile> findAll() {
105 return findAll(null);
106 }
107
108
109
110
111
112
113
114 List<MinioMultipartFile> findAll(String prefix);
115
116
117
118
119
120
121 void delete(@NotNull MinioObjectId id);
122
123
124
125
126
127
128
129 List<DeleteError> deleteAll(Collection<MinioObjectId> ids);
130
131
132
133
134
135
136
137
138 default String getPresignedObjectUrl(@NotNull MinioObjectId id, @NotNull Method method) {
139 return getPresignedObjectUrl(id, method, null);
140 }
141
142
143
144
145
146
147
148
149
150 String getPresignedObjectUrl(
151 @NotNull MinioObjectId id,
152 @NotNull Method method,
153 @Nullable Duration duration);
154
155 }