File tree Expand file tree Collapse file tree 5 files changed +54
-6
lines changed Expand file tree Collapse file tree 5 files changed +54
-6
lines changed Original file line number Diff line number Diff line change @@ -91,11 +91,14 @@ function getObjectUrl() {
91
91
}
92
92
93
93
function getService ( ) {
94
- cos . getService (
95
- {
96
- Region : 'ap-guangzhou' ,
97
- } ,
98
- function ( err , data ) {
94
+ cos . getService ( {
95
+ // Region: 'ap-beijing',
96
+ CreateRange : 'lt' ,
97
+ CreateTime : 1642662645 ,
98
+ // TagKey: 'k1',
99
+ // TagValue: 'v1',
100
+ MaxKeys : 20 ,
101
+ } , function ( err , data ) {
99
102
console . log ( err || data ) ;
100
103
}
101
104
) ;
Original file line number Diff line number Diff line change @@ -351,6 +351,18 @@ declare namespace COS {
351
351
Region ?: Region ;
352
352
/** 发请求时带上的 Header 字段 */
353
353
Headers ?: Headers ;
354
+ /** 传入标签键 */
355
+ TagKey ?: string ;
356
+ /** 传入标签值 */
357
+ TagValue ?: string ;
358
+ /** GMT 时间戳,和 CreateRange 参数一起使用,支持根据创建时间过滤存储桶 */
359
+ CreateTime ?: number ;
360
+ /** 和 CreateTime 参数一起使用,支持根据创建时间过滤存储桶 */
361
+ CreateRange ?: 'lt' | 'gt' | 'lte' | 'gte' | string ;
362
+ /** 起始标记,从该标记之后(不含)按照 UTF-8 字典序返回存储桶条目 */
363
+ Marker ?: string ;
364
+ /** 单次返回最大的条目数量,默认值为2000,最大为2000 */
365
+ MaxKeys ?: number ;
354
366
}
355
367
/** getService 接口返回值 */
356
368
interface GetServiceResult extends GeneralResult {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " cos-nodejs-sdk-v5" ,
3
- "version" : " 2.13.3 " ,
3
+ "version" : " 2.13.4 " ,
4
4
"description" : " cos nodejs sdk v5" ,
5
5
"main" : " index.js" ,
6
6
"types" : " index.d.ts" ,
Original file line number Diff line number Diff line change @@ -52,6 +52,14 @@ function getService(params, callback) {
52
52
method : 'GET' ,
53
53
headers : params . Headers ,
54
54
SignHost : SignHost ,
55
+ qs : {
56
+ tagkey : params . TagKey ,
57
+ tagvalue : params . TagValue ,
58
+ 'create-time' : params . CreateTime ,
59
+ range : params . CreateRange ,
60
+ marker : params . Marker ,
61
+ 'max-keys' : params . MaxKeys ,
62
+ } ,
55
63
} ,
56
64
function ( err , data ) {
57
65
if ( err ) return callback ( err ) ;
Original file line number Diff line number Diff line change @@ -393,6 +393,31 @@ group('getService()', function () {
393
393
} )
394
394
. catch ( function ( ) { } ) ;
395
395
} ) ;
396
+ test ( '能正常列出 Bucket 多参数' , function ( done , assert ) {
397
+ prepareBucket ( )
398
+ . then ( function ( ) {
399
+ cos . getService (
400
+ {
401
+ Region : config . Region ,
402
+ CreateRange : 'gt' ,
403
+ CreateTime : 1642662645 ,
404
+ MaxKeys : 2000 ,
405
+ } ,
406
+ function ( err , data ) {
407
+ var hasBucket = false ;
408
+ data . Buckets &&
409
+ data . Buckets . forEach ( function ( item ) {
410
+ if ( item . Name === BucketLongName && ( item . Location === config . Region || ! item . Location ) ) {
411
+ hasBucket = true ;
412
+ }
413
+ } ) ;
414
+ assert . ok ( hasBucket ) ;
415
+ done ( ) ;
416
+ }
417
+ ) ;
418
+ } )
419
+ . catch ( function ( ) { } ) ;
420
+ } ) ;
396
421
} ) ;
397
422
398
423
group ( 'putBucket()' , function ( ) {
You can’t perform that action at this time.
0 commit comments