-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add getBucketStat method (#1102)
* feat: add getBucketStat method * chore: add return type add documentation
- Loading branch information
Showing
6 changed files
with
129 additions
and
0 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
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 @@ | ||
declare type bucketStatRes = { | ||
Storage: string; | ||
ObjectCount: string; | ||
MultipartUploadCount: string; | ||
LiveChannelCount: string; | ||
LastModifiedTime: string; | ||
StandardStorage: string; | ||
StandardObjectCount: string; | ||
InfrequentAccessStorage: string; | ||
InfrequentAccessRealStorage: string; | ||
InfrequentAccessObjectCount: string; | ||
ArchiveStorage: string; | ||
ArchiveRealStorage: string; | ||
ArchiveObjectCount: string; | ||
ColdArchiveStorage: string; | ||
ColdArchiveRealStorage: string; | ||
ColdArchiveObjectCount: string; | ||
}; | ||
export declare function getBucketStat(this: any, name: string, options: {}): Promise<{ | ||
res: any; | ||
stat: bucketStatRes; | ||
}>; | ||
export {}; |
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,17 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getBucketStat = void 0; | ||
const checkBucketName_1 = require("../utils/checkBucketName"); | ||
async function getBucketStat(name, options) { | ||
name = name || this.options.bucket; | ||
checkBucketName_1.checkBucketName(name); | ||
const params = this._bucketRequestParams('GET', name, 'stat', options); | ||
params.successStatuses = [200]; | ||
params.xmlResponse = true; | ||
const result = await this.request(params); | ||
return { | ||
res: result.res, | ||
stat: result.data | ||
}; | ||
} | ||
exports.getBucketStat = getBucketStat; |
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,34 @@ | ||
import { checkBucketName } from '../utils/checkBucketName'; | ||
|
||
type bucketStatRes = { | ||
Storage: string; | ||
ObjectCount: string; | ||
MultipartUploadCount: string; | ||
LiveChannelCount: string; | ||
LastModifiedTime: string; | ||
StandardStorage: string; | ||
StandardObjectCount: string; | ||
InfrequentAccessStorage: string; | ||
InfrequentAccessRealStorage: string; | ||
InfrequentAccessObjectCount: string; | ||
ArchiveStorage: string; | ||
ArchiveRealStorage: string; | ||
ArchiveObjectCount: string; | ||
ColdArchiveStorage: string; | ||
ColdArchiveRealStorage: string; | ||
ColdArchiveObjectCount: string; | ||
}; | ||
|
||
export async function getBucketStat(this: any, name: string, options: {}): Promise<{ res: any; stat: bucketStatRes }> { | ||
name = name || this.options.bucket; | ||
checkBucketName(name); | ||
const params = this._bucketRequestParams('GET', name, 'stat', options); | ||
params.successStatuses = [200]; | ||
params.xmlResponse = true; | ||
const result = await this.request(params); | ||
|
||
return { | ||
res: result.res, | ||
stat: result.data | ||
}; | ||
} |
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
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