Skip to content

Commit 9e49383

Browse files
zhuxiaolong37huiguangjun
authored andcommitted
Modify getBucketStat interface
1 parent 2036f4a commit 9e49383

File tree

4 files changed

+416
-3
lines changed

4 files changed

+416
-3
lines changed

src/main/java/com/aliyun/oss/internal/ResponseParsers.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2804,7 +2804,37 @@ public static BucketStat parseGetBucketStat(InputStream responseBody) throws Res
28042804
Long storage = Long.parseLong(root.getChildText("Storage"));
28052805
Long objectCount = Long.parseLong(root.getChildText("ObjectCount"));
28062806
Long multipartUploadCount = Long.parseLong(root.getChildText("MultipartUploadCount"));
2807-
BucketStat bucketStat = new BucketStat(storage, objectCount, multipartUploadCount);
2807+
Long liveChannelCount = Long.parseLong(root.getChildText("LiveChannelCount"));
2808+
Long lastModifiedTime = Long.parseLong(root.getChildText("LastModifiedTime"));
2809+
Long standardStorage = Long.parseLong(root.getChildText("StandardStorage"));
2810+
Long standardObjectCount = Long.parseLong(root.getChildText("StandardObjectCount"));
2811+
Long infrequentAccessStorage = Long.parseLong(root.getChildText("InfrequentAccessStorage"));
2812+
Long infrequentAccessRealStorage = Long.parseLong(root.getChildText("InfrequentAccessRealStorage"));
2813+
Long infrequentAccessObjectCount = Long.parseLong(root.getChildText("InfrequentAccessObjectCount"));
2814+
Long archiveStorage = Long.parseLong(root.getChildText("ArchiveStorage"));
2815+
Long archiveRealStorage = Long.parseLong(root.getChildText("ArchiveRealStorage"));
2816+
Long archiveObjectCount = Long.parseLong(root.getChildText("ArchiveObjectCount"));
2817+
Long coldArchiveStorage = Long.parseLong(root.getChildText("ColdArchiveStorage"));
2818+
Long coldArchiveRealStorage = Long.parseLong(root.getChildText("ColdArchiveRealStorage"));
2819+
Long coldArchiveObjectCount = Long.parseLong(root.getChildText("ColdArchiveObjectCount"));
2820+
BucketStat bucketStat = new BucketStat()
2821+
.withStorageSize(storage)
2822+
.withObjectCount(objectCount)
2823+
.withMultipartUploadCount(multipartUploadCount)
2824+
.withLiveChannelCount(liveChannelCount)
2825+
.withLastModifiedTime(lastModifiedTime)
2826+
.withStandardStorage(standardStorage)
2827+
.withStandardObjectCount(standardObjectCount)
2828+
.withInfrequentAccessStorage(infrequentAccessStorage)
2829+
.withInfrequentAccessRealStorage(infrequentAccessRealStorage)
2830+
.withInfrequentAccessObjectCount(infrequentAccessObjectCount)
2831+
.withArchiveStorage(archiveStorage)
2832+
.withArchiveRealStorage(archiveRealStorage)
2833+
.withArchiveObjectCount(archiveObjectCount)
2834+
.withColdArchiveStorage(coldArchiveStorage)
2835+
.withColdArchiveRealStorage(coldArchiveRealStorage)
2836+
.withColdArchiveObjectCount(coldArchiveObjectCount);
2837+
28082838
return bucketStat;
28092839
} catch (JDOMParseException e) {
28102840
throw new ResponseParseException(e.getPartialDocument() + ": " + e.getMessage(), e);

src/main/java/com/aliyun/oss/model/BucketStat.java

Lines changed: 327 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
*/
2525
public class BucketStat extends GenericResult {
2626

27+
public BucketStat() {
28+
}
29+
2730
public BucketStat(Long storageSize, Long objectCount, Long multipartUploadCount) {
2831
this.storageSize = storageSize;
2932
this.objectCount = objectCount;
@@ -39,6 +42,18 @@ public Long getStorageSize() {
3942
return storageSize;
4043
}
4144

45+
/**
46+
* Sets the storage size and returns the current BucketStat instance
47+
* (this).
48+
*
49+
* @param storageSize
50+
* The storage size.
51+
*/
52+
public BucketStat withStorageSize(Long storageSize) {
53+
this.storageSize = storageSize;
54+
return this;
55+
}
56+
4257
/**
4358
* Gets the object count under the bucket.
4459
*
@@ -49,15 +64,325 @@ public Long getObjectCount() {
4964
}
5065

5166
/**
52-
* Gets the unfinished parts uploading count.
67+
* Sets the object count and returns the current BucketStat instance
68+
* (this).
69+
*
70+
* @param objectCount
71+
* The object count.
72+
*/
73+
public BucketStat withObjectCount(Long objectCount) {
74+
this.objectCount = objectCount;
75+
return this;
76+
}
77+
78+
/**
79+
* Gets the multipart upload count.
5380
*
54-
* @return The unfinished parts uploading count.
81+
* @return The multipart upload count.
5582
*/
5683
public Long getMultipartUploadCount() {
5784
return multipartUploadCount;
5885
}
5986

87+
/**
88+
* Sets the multipart upload count and returns the current BucketStat instance
89+
* (this).
90+
*
91+
* @param multipartUploadCount
92+
* The multipart upload count.
93+
*/
94+
public BucketStat withMultipartUploadCount(Long multipartUploadCount) {
95+
this.multipartUploadCount = multipartUploadCount;
96+
return this;
97+
}
98+
99+
/**
100+
* Gets the live channel count.
101+
*
102+
* @return The live channel count.
103+
*/
104+
public Long getLiveChannelCount() {
105+
return liveChannelCount;
106+
}
107+
108+
/**
109+
* Sets the live channel count and returns the current BucketStat instance
110+
* (this).
111+
*
112+
* @param liveChannelCount
113+
* The live channel count.
114+
*/
115+
public BucketStat withLiveChannelCount(Long liveChannelCount) {
116+
this.liveChannelCount = liveChannelCount;
117+
return this;
118+
}
119+
120+
/**
121+
* Gets the last modified time.
122+
*
123+
* @return The last modified time.
124+
*/
125+
public Long getLastModifiedTime() {
126+
return lastModifiedTime;
127+
}
128+
129+
/**
130+
* Sets the last modified time and returns the current BucketStat instance
131+
* (this).
132+
*
133+
* @param lastModifiedTime
134+
* The last modified time.
135+
*/
136+
public BucketStat withLastModifiedTime(Long lastModifiedTime) {
137+
this.lastModifiedTime = lastModifiedTime;
138+
return this;
139+
}
140+
141+
/**
142+
* Gets the standard storage.
143+
*
144+
* @return The standard storage.
145+
*/
146+
public Long getStandardStorage() {
147+
return standardStorage;
148+
}
149+
150+
/**
151+
* Sets the standard storage and returns the current BucketStat instance
152+
* (this).
153+
*
154+
* @param standardStorage
155+
* The standard storage.
156+
*/
157+
public BucketStat withStandardStorage(Long standardStorage) {
158+
this.standardStorage = standardStorage;
159+
return this;
160+
}
161+
162+
/**
163+
* Gets the standard object count.
164+
*
165+
* @return The standard object count.
166+
*/
167+
public Long getStandardObjectCount() {
168+
return standardObjectCount;
169+
}
170+
171+
/**
172+
* Sets the standard object count and returns the current BucketStat instance
173+
* (this).
174+
*
175+
* @param standardObjectCount
176+
* The standard object count.
177+
*/
178+
public BucketStat withStandardObjectCount(Long standardObjectCount) {
179+
this.standardObjectCount = standardObjectCount;
180+
return this;
181+
}
182+
183+
/**
184+
* Gets the infrequent access storage.
185+
*
186+
* @return The infrequent access storage.
187+
*/
188+
public Long getInfrequentAccessStorage() {
189+
return infrequentAccessStorage;
190+
}
191+
192+
/**
193+
* Sets the infrequent access storage and returns the current BucketStat instance
194+
* (this).
195+
*
196+
* @param infrequentAccessStorage
197+
* The infrequent access storage.
198+
*/
199+
public BucketStat withInfrequentAccessStorage(Long infrequentAccessStorage) {
200+
this.infrequentAccessStorage = infrequentAccessStorage;
201+
return this;
202+
}
203+
204+
/**
205+
* Gets the infrequent access real storage.
206+
*
207+
* @return The infrequent access real storage.
208+
*/
209+
public Long getInfrequentAccessRealStorage() {
210+
return infrequentAccessRealStorage;
211+
}
212+
213+
/**
214+
* Sets the infrequent access real storage and returns the current BucketStat instance
215+
* (this).
216+
*
217+
* @param infrequentAccessRealStorage
218+
* The infrequent access real storage.
219+
*/
220+
public BucketStat withInfrequentAccessRealStorage(Long infrequentAccessRealStorage) {
221+
this.infrequentAccessRealStorage = infrequentAccessRealStorage;
222+
return this;
223+
}
224+
225+
/**
226+
* Gets the infrequent access object count.
227+
*
228+
* @return The infrequent access object count.
229+
*/
230+
public Long getInfrequentAccessObjectCount() {
231+
return infrequentAccessObjectCount;
232+
}
233+
234+
/**
235+
* Sets the infrequent access object count and returns the current BucketStat instance
236+
* (this).
237+
*
238+
* @param infrequentAccessObjectCount
239+
* The infrequent access object count.
240+
*/
241+
public BucketStat withInfrequentAccessObjectCount(Long infrequentAccessObjectCount) {
242+
this.infrequentAccessObjectCount = infrequentAccessObjectCount;
243+
return this;
244+
}
245+
246+
/**
247+
* Gets the archive storage.
248+
*
249+
* @return The archive storage.
250+
*/
251+
public Long getArchiveStorage() {
252+
return archiveStorage;
253+
}
254+
255+
/**
256+
* Sets the archive storage and returns the current BucketStat instance
257+
* (this).
258+
*
259+
* @param archiveStorage
260+
* The archive storage.
261+
*/
262+
public BucketStat withArchiveStorage(Long archiveStorage) {
263+
this.archiveStorage = archiveStorage;
264+
return this;
265+
}
266+
267+
/**
268+
* Gets the archive real storage.
269+
*
270+
* @return The archive real storage.
271+
*/
272+
public Long getArchiveRealStorage() {
273+
return archiveRealStorage;
274+
}
275+
276+
/**
277+
* Sets the archive real storage and returns the current BucketStat instance
278+
* (this).
279+
*
280+
* @param archiveRealStorage
281+
* The archive real storage.
282+
*/
283+
public BucketStat withArchiveRealStorage(Long archiveRealStorage) {
284+
this.archiveRealStorage = archiveRealStorage;
285+
return this;
286+
}
287+
288+
/**
289+
* Gets the archive object count.
290+
*
291+
* @return The archive object count.
292+
*/
293+
public Long getArchiveObjectCount() {
294+
return archiveObjectCount;
295+
}
296+
297+
/**
298+
* Sets the archive object count and returns the current BucketStat instance
299+
* (this).
300+
*
301+
* @param archiveObjectCount
302+
* The archive object count.
303+
*/
304+
public BucketStat withArchiveObjectCount(Long archiveObjectCount) {
305+
this.archiveObjectCount = archiveObjectCount;
306+
return this;
307+
}
308+
309+
/**
310+
* Gets the cold archive storage.
311+
*
312+
* @return The cold archive storage.
313+
*/
314+
public Long getColdArchiveStorage() {
315+
return coldArchiveStorage;
316+
}
317+
318+
/**
319+
* Sets the cold archive storage and returns the current BucketStat instance
320+
* (this).
321+
*
322+
* @param coldArchiveStorage
323+
* The cold archive storage.
324+
*/
325+
public BucketStat withColdArchiveStorage(Long coldArchiveStorage) {
326+
this.coldArchiveStorage = coldArchiveStorage;
327+
return this;
328+
}
329+
330+
/**
331+
* Gets the cold archive real storage.
332+
*
333+
* @return The cold archive real storage.
334+
*/
335+
public Long getColdArchiveRealStorage() {
336+
return coldArchiveRealStorage;
337+
}
338+
339+
/**
340+
* Sets the cold archive real storage and returns the current BucketStat instance
341+
* (this).
342+
*
343+
* @param coldArchiveRealStorage
344+
* The cold archive real storage.
345+
*/
346+
public BucketStat withColdArchiveRealStorage(Long coldArchiveRealStorage) {
347+
this.coldArchiveRealStorage = coldArchiveRealStorage;
348+
return this;
349+
}
350+
351+
/**
352+
* Gets the cold archive object count.
353+
*
354+
* @return The cold archive object count.
355+
*/
356+
public Long getColdArchiveObjectCount() {
357+
return coldArchiveObjectCount;
358+
}
359+
360+
/**
361+
* Sets the cold archive object count and returns the current BucketStat instance
362+
* (this).
363+
*
364+
* @param coldArchiveObjectCount
365+
* The cold archive object count.
366+
*/
367+
public BucketStat withColdArchiveObjectCount(Long coldArchiveObjectCount) {
368+
this.coldArchiveObjectCount = coldArchiveObjectCount;
369+
return this;
370+
}
371+
60372
private Long storageSize; // bytes
61373
private Long objectCount;
62374
private Long multipartUploadCount;
375+
private Long liveChannelCount;
376+
private Long lastModifiedTime;
377+
private Long standardStorage;
378+
private Long standardObjectCount;
379+
private Long infrequentAccessStorage;
380+
private Long infrequentAccessRealStorage;
381+
private Long infrequentAccessObjectCount;
382+
private Long archiveStorage;
383+
private Long archiveRealStorage;
384+
private Long archiveObjectCount;
385+
private Long coldArchiveStorage;
386+
private Long coldArchiveRealStorage;
387+
private Long coldArchiveObjectCount;
63388
}

0 commit comments

Comments
 (0)