1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export = OSS;
|
8 |
|
9 |
|
10 | declare namespace OSS {
|
11 | interface Options {
|
12 |
|
13 | accessKeyId: string;
|
14 |
|
15 | accessKeySecret: string;
|
16 |
|
17 | stsToken?: string | undefined;
|
18 |
|
19 | bucket?: string | undefined;
|
20 |
|
21 | endpoint?: string | undefined;
|
22 |
|
23 | region?: string | undefined;
|
24 |
|
25 | internal?: boolean | undefined;
|
26 |
|
27 | secure?: boolean | undefined;
|
28 |
|
29 | timeout?: string | number | undefined;
|
30 |
|
31 | cname?: boolean | undefined;
|
32 |
|
33 | refreshSTSTokenInterval?: number;
|
34 |
|
35 | refreshSTSToken?: () => Promise<{ accessKeyId: string, accessKeySecret: string, stsToken: string }>;
|
36 | }
|
37 |
|
38 | |
39 |
|
40 |
|
41 | class STS {
|
42 | constructor(options: STSOptions);
|
43 |
|
44 | assumeRole(
|
45 | roleArn: string,
|
46 | |
47 |
|
48 |
|
49 | policy?: object | string,
|
50 | expirationSeconds?: number,
|
51 | session?: string,
|
52 | options?: {
|
53 | timeout: number;
|
54 | |
55 |
|
56 |
|
57 | ctx: any;
|
58 | },
|
59 | ): Promise<{ credentials: Credentials }>;
|
60 | }
|
61 |
|
62 | interface Credentials {
|
63 | |
64 |
|
65 |
|
66 | AccessKeyId: string;
|
67 |
|
68 | |
69 |
|
70 |
|
71 | AccessKeySecret: string;
|
72 |
|
73 | |
74 |
|
75 |
|
76 | SecurityToken: string;
|
77 |
|
78 | |
79 |
|
80 |
|
81 | Expiration: string;
|
82 | }
|
83 |
|
84 | interface STSOptions {
|
85 | |
86 |
|
87 |
|
88 | accessKeyId: string;
|
89 |
|
90 | |
91 |
|
92 |
|
93 | accessKeySecret: string;
|
94 | }
|
95 |
|
96 | interface Bucket {
|
97 | name: string;
|
98 | region: string;
|
99 | creationDate: string;
|
100 | StorageClass: StorageType;
|
101 | }
|
102 |
|
103 | type StorageType = 'Standard' | 'IA' | 'Archive';
|
104 |
|
105 | type ACLType = 'public-read-write' | 'public-read' | 'private';
|
106 |
|
107 | type HTTPMethods = 'GET' | 'POST' | 'DELETE' | 'PUT';
|
108 |
|
109 | type RedundancyType = 'LRS' | 'ZRS';
|
110 |
|
111 | interface RequestOptions {
|
112 |
|
113 | timeout?: number | undefined;
|
114 | }
|
115 |
|
116 | type RuleStatusType = 'Enabled' | 'Disabled';
|
117 |
|
118 | interface LifecycleRule {
|
119 |
|
120 | id?: string | undefined;
|
121 |
|
122 | prefix: string;
|
123 |
|
124 | status: RuleStatusType;
|
125 |
|
126 | days?: number | string | undefined;
|
127 |
|
128 | date: string;
|
129 | }
|
130 |
|
131 | interface CORSRule {
|
132 |
|
133 | allowedOrigin: string | string[];
|
134 |
|
135 | allowedMethod: string | string[];
|
136 |
|
137 | allowedHeader?: string | string[] | undefined;
|
138 |
|
139 | exposeHeader?: string | string[] | undefined;
|
140 |
|
141 | maxAgeSeconds?: string | string[] | undefined;
|
142 | }
|
143 |
|
144 | interface OwnerType {
|
145 | id: string;
|
146 | displayName: string;
|
147 | }
|
148 |
|
149 | interface ObjectMeta {
|
150 |
|
151 | name: string;
|
152 |
|
153 | url: string;
|
154 |
|
155 | lastModified: string;
|
156 |
|
157 | etag: string;
|
158 |
|
159 | type: string;
|
160 |
|
161 | size: number;
|
162 | storageClass: StorageType;
|
163 | owner?: OwnerType;
|
164 | }
|
165 |
|
166 | interface BucketPolicy {
|
167 | Version: string;
|
168 | Statement: Array<{
|
169 | Action: string[];
|
170 | Effect: 'Allow' | 'Deny';
|
171 | Principal: string[];
|
172 | Resource: string[];
|
173 | }>;
|
174 | }
|
175 |
|
176 | interface NormalSuccessResponse {
|
177 |
|
178 | status: number;
|
179 |
|
180 |
|
181 | headers: object;
|
182 |
|
183 | size: number;
|
184 |
|
185 | rt: number;
|
186 | }
|
187 |
|
188 | |
189 |
|
190 |
|
191 |
|
192 | interface UserMeta extends Record<string, string | number> {
|
193 | uid: number;
|
194 | pid: number;
|
195 | }
|
196 |
|
197 | interface ObjectCallback {
|
198 |
|
199 | url: string;
|
200 |
|
201 | host?: string | undefined;
|
202 |
|
203 | body: string;
|
204 |
|
205 | contentType?: string | undefined;
|
206 | customValue?: object | undefined;
|
207 |
|
208 | headers?: object | undefined;
|
209 | }
|
210 |
|
211 | interface ModifyData {
|
212 |
|
213 | lastModified: string;
|
214 |
|
215 | etag: string;
|
216 | }
|
217 |
|
218 | interface Checkpoint {
|
219 |
|
220 | file: any;
|
221 |
|
222 | name: string;
|
223 | fileSize: number;
|
224 | partSize: number;
|
225 | uploadId: string;
|
226 | doneParts: Array<{ number: number; etag: string }>;
|
227 | }
|
228 |
|
229 | interface ObjectPart {
|
230 | PartNumber: number;
|
231 |
|
232 | LastModified: any;
|
233 | ETag: string;
|
234 | size: number;
|
235 | }
|
236 |
|
237 | interface Upload {
|
238 | name: string;
|
239 | uploadId: string;
|
240 | initiated: any;
|
241 | }
|
242 |
|
243 | interface Channel {
|
244 | Name: string;
|
245 | Description: string;
|
246 | Status: string;
|
247 | LastModified: string;
|
248 | PublishUrls: string[];
|
249 | PlayUrls: string[];
|
250 | }
|
251 |
|
252 | interface ChannelHistory {
|
253 | StartTime: string;
|
254 | EndTime: string;
|
255 |
|
256 | RemoteAddr: string;
|
257 | }
|
258 |
|
259 |
|
260 | interface ListBucketsQueryType {
|
261 |
|
262 | prefix?: string | undefined;
|
263 |
|
264 | marker?: string | undefined;
|
265 |
|
266 | 'max-keys'?: string | number | undefined;
|
267 | }
|
268 |
|
269 | interface PutBucketOptions {
|
270 | acl: ACLType;
|
271 | dataRedundancyType: RedundancyType;
|
272 | timeout: number;
|
273 | storageClass: StorageType;
|
274 | }
|
275 |
|
276 | interface PutBucketWebsiteConfig {
|
277 |
|
278 | index: string;
|
279 |
|
280 | error?: string | undefined;
|
281 | }
|
282 |
|
283 | interface ListObjectsQuery {
|
284 |
|
285 | prefix?: string | undefined;
|
286 |
|
287 | marker?: string | undefined;
|
288 |
|
289 | delimiter?: string | undefined;
|
290 |
|
291 | 'max-keys': string | number;
|
292 |
|
293 | 'encoding-type'?: 'url' | '';
|
294 | }
|
295 |
|
296 | interface ListV2ObjectsQuery {
|
297 |
|
298 | prefix?: string;
|
299 |
|
300 | 'continuation-token'?: string;
|
301 |
|
302 | delimiter?: string | number;
|
303 |
|
304 | 'max-keys'?: string;
|
305 | |
306 |
|
307 |
|
308 |
|
309 | 'start-after'?: string;
|
310 |
|
311 | 'fetch-owner'?: boolean;
|
312 |
|
313 | 'encoding-type'?: 'url' | '';
|
314 | }
|
315 |
|
316 | interface ListObjectResult {
|
317 | objects: ObjectMeta[];
|
318 | prefixes: string[];
|
319 | isTruncated: boolean;
|
320 | nextMarker: string;
|
321 | res: NormalSuccessResponse;
|
322 | }
|
323 |
|
324 | interface PutObjectOptions {
|
325 |
|
326 | timeout?: number | undefined;
|
327 |
|
328 | mime?: string | undefined;
|
329 |
|
330 | meta?: UserMeta | undefined;
|
331 | callback?: ObjectCallback | undefined;
|
332 | headers?: object | undefined;
|
333 | }
|
334 |
|
335 | interface PutObjectResult {
|
336 | name: string;
|
337 | url: string;
|
338 | data: object;
|
339 | res: NormalSuccessResponse;
|
340 | }
|
341 |
|
342 | interface PutStreamOptions {
|
343 |
|
344 | contentLength?: number | undefined;
|
345 |
|
346 | timeout: number;
|
347 |
|
348 | mime: string;
|
349 | meta: UserMeta;
|
350 | callback: ObjectCallback;
|
351 | headers?: object | undefined;
|
352 | }
|
353 |
|
354 | interface AppendObjectOptions {
|
355 |
|
356 | position?: string | undefined;
|
357 |
|
358 | timeout?: number | undefined;
|
359 |
|
360 | mime?: string | undefined;
|
361 | meta?: UserMeta | undefined;
|
362 | headers?: object | undefined;
|
363 | }
|
364 |
|
365 | interface AppendObjectResult {
|
366 | name: string;
|
367 |
|
368 | url: string;
|
369 | res: NormalSuccessResponse;
|
370 |
|
371 | nextAppendPosition: string;
|
372 | }
|
373 |
|
374 | interface HeadObjectOptions {
|
375 | timeout?: number | undefined;
|
376 | headers?: object | undefined;
|
377 | }
|
378 |
|
379 | interface HeadObjectResult {
|
380 |
|
381 | status: number;
|
382 | meta: UserMeta;
|
383 | res: NormalSuccessResponse;
|
384 | }
|
385 |
|
386 | interface GetObjectOptions {
|
387 | timeout?: number | undefined;
|
388 |
|
389 | process?: string | undefined;
|
390 | headers?: object | undefined;
|
391 | }
|
392 |
|
393 | interface GetObjectResult {
|
394 |
|
395 | content?: any;
|
396 | res: NormalSuccessResponse;
|
397 | }
|
398 |
|
399 | interface GetStreamOptions {
|
400 | timeout?: number | undefined;
|
401 |
|
402 | process?: string | undefined;
|
403 | headers?: object | undefined;
|
404 | }
|
405 |
|
406 | interface GetStreamResult {
|
407 |
|
408 | stream?: any;
|
409 | res: NormalSuccessResponse;
|
410 | }
|
411 |
|
412 | interface CopyObjectOptions {
|
413 | timeout?: number | undefined;
|
414 | meta?: UserMeta | undefined;
|
415 | headers?: object | undefined;
|
416 | }
|
417 |
|
418 | interface CopyAndPutMetaResult {
|
419 | data: ModifyData;
|
420 | res: NormalSuccessResponse;
|
421 | }
|
422 |
|
423 | interface DeleteMultiOptions {
|
424 |
|
425 | quiet?: boolean | undefined;
|
426 | timeout?: number | undefined;
|
427 | }
|
428 |
|
429 | interface DeleteMultiResult {
|
430 |
|
431 | deleted?: string[] | undefined;
|
432 | res: NormalSuccessResponse;
|
433 | }
|
434 |
|
435 | interface ResponseHeaderType {
|
436 | 'content-type'?: string | undefined;
|
437 | 'content-disposition'?: string | undefined;
|
438 | 'cache-control'?: string | undefined;
|
439 | }
|
440 |
|
441 | interface SignatureUrlOptions {
|
442 |
|
443 | expires?: number | undefined;
|
444 |
|
445 | method?: HTTPMethods | undefined;
|
446 |
|
447 | 'Content-Type'?: string | undefined;
|
448 | process?: string | undefined;
|
449 |
|
450 | response?: ResponseHeaderType | undefined;
|
451 | callback?: ObjectCallback | undefined;
|
452 | }
|
453 |
|
454 | interface GetACLResult {
|
455 | acl: ACLType;
|
456 | res: NormalSuccessResponse;
|
457 | }
|
458 |
|
459 | interface InitMultipartUploadOptions {
|
460 | timeout?: number | undefined;
|
461 |
|
462 | mime?: string | undefined;
|
463 | meta?: UserMeta | undefined;
|
464 | headers?: object | undefined;
|
465 | }
|
466 |
|
467 | interface InitMultipartUploadResult {
|
468 | res: { status: number; headers: object; size: number; rt: number };
|
469 |
|
470 | bucket: string;
|
471 |
|
472 | name: string;
|
473 |
|
474 | uploadId: string;
|
475 | }
|
476 |
|
477 | interface UploadPartResult {
|
478 | name: string;
|
479 | etag: string;
|
480 | res: NormalSuccessResponse;
|
481 | }
|
482 |
|
483 | interface CompleteMultipartUploadOptions {
|
484 | timeout?: number | undefined;
|
485 | callback?: ObjectCallback | undefined;
|
486 | headers?: object | undefined;
|
487 | }
|
488 |
|
489 | interface CompleteMultipartUploadResult {
|
490 | bucket: string;
|
491 | name: string;
|
492 | etag: string;
|
493 | data: object;
|
494 | res: NormalSuccessResponse;
|
495 | }
|
496 |
|
497 | interface MultipartUploadOptions {
|
498 |
|
499 | parallel?: number | undefined;
|
500 |
|
501 | partSize?: number | undefined;
|
502 |
|
503 | progress?: ((...args: any[]) => any) | undefined;
|
504 | /** the checkpoint to resume upload, if this is provided, it will continue the upload from where interrupted, otherwise a new multipart upload will be created. */
|
505 | checkpoint?: Checkpoint | undefined;
|
506 | meta?: UserMeta | undefined;
|
507 | mime?: string | undefined;
|
508 | callback?: ObjectCallback | undefined;
|
509 | headers?: object | undefined;
|
510 | timeout?: number | undefined;
|
511 | /** {Object} only uploadPartCopy api used, detail */
|
512 | copyheaders?: object | undefined;
|
513 | }
|
514 |
|
515 | interface MultipartUploadResult {
|
516 | bucket: string;
|
517 | name: string;
|
518 | etag: string;
|
519 | data: object;
|
520 | res: NormalSuccessResponse;
|
521 | }
|
522 |
|
523 | interface MultipartUploadCopyResult {
|
524 | bucket: string;
|
525 | name: string;
|
526 | etag: string;
|
527 | res: NormalSuccessResponse;
|
528 | }
|
529 |
|
530 | interface MultipartUploadCopySourceData {
|
531 | /** the source object name */
|
532 | sourceKey: string;
|
533 | /** sourceData. the source bucket name */
|
534 | sourceBucketName: string;
|
535 | /** data copy start byte offset, e.g: 0 */
|
536 | startOffset: number;
|
537 | /** data copy end byte offset, e.g: 102400 */
|
538 | endOffset: number;
|
539 | }
|
540 |
|
541 | interface ListPartsQuery {
|
542 | /** The maximum part number in the response of the OSS. default value: 1000. */
|
543 | 'max-parts': number;
|
544 | /** Starting position of a specific list. A part is listed only when the part number is greater than the value of this parameter. */
|
545 | 'part-number-marker': number;
|
546 | /** Specify the encoding of the returned content and the encoding type. Optional value: url */
|
547 | 'encoding-type': string;
|
548 | }
|
549 |
|
550 | interface ListPartsResult {
|
551 | uploadId: string;
|
552 | bucket: string;
|
553 | name: string;
|
554 | PartNumberMarker: number;
|
555 | nextPartNumberMarker: number;
|
556 | maxParts: number;
|
557 | isTruncated: boolean;
|
558 | parts: ObjectPart[];
|
559 | res: NormalSuccessResponse;
|
560 | }
|
561 |
|
562 | interface ListUploadsQuery {
|
563 | prefix?: string | undefined;
|
564 | 'max-uploads'?: number | undefined;
|
565 | 'key-marker'?: string | undefined;
|
566 | 'upload-id-marker'?: string | undefined;
|
567 | }
|
568 |
|
569 | interface ListUploadsResult {
|
570 | res: NormalSuccessResponse;
|
571 | bucket: string;
|
572 | nextKeyMarker: any;
|
573 | nextUploadIdMarker: any;
|
574 | isTruncated: boolean;
|
575 | uploads: Upload[];
|
576 | }
|
577 |
|
578 | interface PutChannelConf {
|
579 | Description?: string | undefined;
|
580 | Status?: string | undefined;
|
581 | Target?: {
|
582 | Type: string;
|
583 | FragDuration: number;
|
584 | FragCount: number;
|
585 | PlaylistName: string;
|
586 | } | undefined;
|
587 | }
|
588 |
|
589 | interface PutChannelResult {
|
590 | publishUrls: string[];
|
591 | playUrls: string[];
|
592 | res: NormalSuccessResponse;
|
593 | }
|
594 |
|
595 | interface GetChannelResult {
|
596 | Status: string;
|
597 | ConnectedTime?: string | undefined;
|
598 | RemoteAddr?: string | undefined;
|
599 | Video?: object | undefined;
|
600 | Audio?: object | undefined;
|
601 | res: NormalSuccessResponse;
|
602 | }
|
603 |
|
604 | interface ListChannelsQuery {
|
605 | /** the channel id prefix (returns channels with this prefix) */
|
606 | prefix: string;
|
607 | /** the channel id marker (returns channels after this id) */
|
608 | marker: string;
|
609 | /** max number of channels to return */
|
610 | 'max-keys ': number;
|
611 | }
|
612 |
|
613 | interface ListChannelsResult {
|
614 | channels: Channel[];
|
615 | nextMarker: string | null;
|
616 | isTruncated: boolean;
|
617 | res: NormalSuccessResponse;
|
618 | }
|
619 |
|
620 | interface ChannelHistoryResult {
|
621 | records: ChannelHistory;
|
622 | res: NormalSuccessResponse;
|
623 | }
|
624 |
|
625 | interface GetRtmpUrlOptions {
|
626 | /** the expire time in seconds of the url */
|
627 | expires?: number | undefined;
|
628 | /** the additional parameters for url, e.g.: {playlistName: 'play.m3u8'} */
|
629 | params?: object | undefined;
|
630 | /** the operation timeout */
|
631 | timeout?: number | undefined;
|
632 | }
|
633 |
|
634 | interface GetBucketPolicyResult {
|
635 | policy: BucketPolicy | null;
|
636 | status: number;
|
637 | res: NormalSuccessResponse;
|
638 | }
|
639 |
|
640 | interface PostObjectParams {
|
641 | policy: string;
|
642 | OSSAccessKeyId: string;
|
643 | Signature: string;
|
644 | }
|
645 | }
|
646 |
|
647 | // cluster
|
648 | declare namespace OSS {
|
649 | interface ClusterType {
|
650 | host: string;
|
651 | accessKeyId: string;
|
652 | accessKeySecret: string;
|
653 | }
|
654 |
|
655 | interface ClusterOptions {
|
656 | clusters: ClusterType[];
|
657 | schedule?: string | undefined;
|
658 | }
|
659 |
|
660 | class ClusterClient {
|
661 | constructor(options: ClusterOptions);
|
662 |
|
663 | list(query: ListObjectsQuery | null, options: RequestOptions): Promise<ListObjectResult>;
|
664 |
|
665 | /**
|
666 | * @since 6.12.0
|
667 | */
|
668 | listV2(query: ListV2ObjectsQuery | null, options: RequestOptions): Promise<ListObjectResult>;
|
669 |
|
670 | put(name: string, file: any, options?: PutObjectOptions): Promise<PutObjectResult>;
|
671 |
|
672 | putStream(
|
673 | name: string,
|
674 | stream: any,
|
675 | options?: PutStreamOptions,
|
676 | ): Promise<{ name: string; res: NormalSuccessResponse }>;
|
677 |
|
678 | head(name: string, options?: HeadObjectOptions): Promise<HeadObjectResult>;
|
679 |
|
680 | get(name: string, file?: any, options?: GetObjectOptions): Promise<GetObjectResult>;
|
681 |
|
682 | getStream(name?: string, options?: GetStreamOptions): Promise<GetStreamResult>;
|
683 |
|
684 | delete(name: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
685 |
|
686 | copy(name: string, sourceName: string, options?: CopyObjectOptions): Promise<CopyAndPutMetaResult>;
|
687 |
|
688 | putMeta(name: string, meta: UserMeta, options: RequestOptions): Promise<CopyAndPutMetaResult>;
|
689 |
|
690 | deleteMulti(names: string[], options?: DeleteMultiOptions): Promise<DeleteMultiResult>;
|
691 |
|
692 | signatureUrl(name: string, options?: SignatureUrlOptions): string;
|
693 |
|
694 | putACL(name: string, acl: ACLType, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
695 |
|
696 | restore(name: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
697 | }
|
698 | }
|
699 |
|
700 | // image
|
701 | declare namespace OSS {
|
702 | interface ImageClientOptions {
|
703 | /** your image service domain that binding to a OSS bucket */
|
704 | imageHost: string;
|
705 | /** access key you create on aliyun console website */
|
706 | accessKeyId: string;
|
707 | /** access secret you create */
|
708 | accessKeySecret: string;
|
709 | /** the default bucket you want to access If you don't have any bucket, please use putBucket() create one first. */
|
710 | bucket: string;
|
711 | /** the bucket data region location, please see Data Regions, default is oss-cn-hangzhou */
|
712 | region?: string | undefined;
|
713 | /** access OSS with aliyun internal network or not, default is false If your servers are running on aliyun too, you can set true to save lot of money. */
|
714 | internal?: boolean | undefined;
|
715 | /** instance level timeout for all operations, default is 60s */
|
716 | timeout?: string | number | undefined;
|
717 | }
|
718 |
|
719 | interface ImageGetOptions {
|
720 | timeout?: number | undefined;
|
721 | headers?: object | undefined;
|
722 | }
|
723 |
|
724 | interface StyleData {
|
725 | /** style name */
|
726 | Name: string;
|
727 | /** style content */
|
728 | Content: string;
|
729 | /** style create time */
|
730 | CreateTime: string;
|
731 | /** style last modify time */
|
732 | LastModifyTime: string;
|
733 | }
|
734 |
|
735 | class ImageClient {
|
736 | constructor(options: ImageClientOptions);
|
737 |
|
738 | /**
|
739 | * Get an image from the image channel.
|
740 | */
|
741 | get(name: string, file?: any, options?: ImageGetOptions): Promise<{ content: any; res: NormalSuccessResponse }>;
|
742 |
|
743 | /**
|
744 | * Get an image read stream.
|
745 | */
|
746 | getStream(name: string, options?: ImageGetOptions): Promise<{ stream: any; res: NormalSuccessResponse }>;
|
747 |
|
748 | /**
|
749 | * Get a image exif info by image object name from the image channel.
|
750 | */
|
751 | getExif(name: string, options?: RequestOptions): Promise<{ data: object; res: NormalSuccessResponse }>;
|
752 |
|
753 | /**
|
754 | * Get a image info and exif info by image object name from the image channel.
|
755 | */
|
756 | getInfo(name: string, options?: RequestOptions): Promise<{ data: object; res: NormalSuccessResponse }>;
|
757 |
|
758 | /**
|
759 | * todo
|
760 | */
|
761 | putStyle(
|
762 | name: string,
|
763 | style: string,
|
764 | options?: RequestOptions,
|
765 | ): Promise<{ data: object; res: NormalSuccessResponse }>;
|
766 |
|
767 | /**
|
768 | * Get a style by name from the image channel.
|
769 | */
|
770 | getStyle(name: string, options?: RequestOptions): Promise<{ data: StyleData; res: NormalSuccessResponse }>;
|
771 |
|
772 | /**
|
773 | * Get all styles from the image channel.
|
774 | */
|
775 | listStyle(options?: RequestOptions): Promise<StyleData[]>;
|
776 |
|
777 | /**
|
778 | * todo
|
779 | */
|
780 | deleteStyle(styleName: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
781 |
|
782 | /**
|
783 | * Create a signature url for directly download.
|
784 | */
|
785 | signatureUrl(name: string, options?: { expires?: string | undefined; timeout?: string | undefined }): string;
|
786 | }
|
787 | }
|
788 |
|
789 | declare class OSS {
|
790 | constructor(options: OSS.Options);
|
791 |
|
792 | /******************************************* the bucket operations *************************************************/
|
793 |
|
794 | // base operators
|
795 | /**
|
796 | * List buckets in this account.
|
797 | */
|
798 | listBuckets(query: OSS.ListBucketsQueryType | null, options?: OSS.RequestOptions): Promise<OSS.Bucket[]>;
|
799 |
|
800 | /**
|
801 | * Create a new bucket.
|
802 | */
|
803 | putBucket(
|
804 | name: string,
|
805 | options?: OSS.PutBucketOptions,
|
806 | ): Promise<{ bucket: string; res: OSS.NormalSuccessResponse }>;
|
807 |
|
808 | /**
|
809 | * Use the bucket.
|
810 | */
|
811 | useBucket(name: string): void;
|
812 |
|
813 | /**
|
814 | * Delete an empty bucket.
|
815 | */
|
816 | deleteBucket(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
817 |
|
818 | /**
|
819 | * Get bucket information,include CreationDate、ExtranetEndpoint、IntranetEndpoint、Location、Name、StorageClass、 Owner、AccessControlList
|
820 | */
|
821 | getBucketInfo(name: string): Promise<any>;
|
822 |
|
823 | /**
|
824 | * Get bucket location
|
825 | */
|
826 | getBucketLocation(name: string): Promise<any>;
|
827 |
|
828 | // ACL operations
|
829 | /**
|
830 | * Update the bucket ACL.
|
831 | */
|
832 | putBucketACL(name: string, acl: OSS.ACLType, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
833 |
|
834 | /**
|
835 | * Get the bucket ACL.
|
836 | * acl - acl settings string
|
837 | */
|
838 | getBucketACL(name: string, options?: OSS.RequestOptions): Promise<{ acl: string; res: OSS.NormalSuccessResponse }>;
|
839 |
|
840 | // logging operations
|
841 | /**
|
842 | * Update the bucket logging settings. Log file will create every one hour and name format: <prefix><bucket>-YYYY-mm-DD-HH-MM-SS-UniqueString.
|
843 | */
|
844 | putBucketLogging(name: string, prefix?: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
845 |
|
846 | /**
|
847 | * Get the bucket logging settings.
|
848 | */
|
849 | getBucketLogging(
|
850 | name: string,
|
851 | options?: OSS.RequestOptions,
|
852 | ): Promise<{ enable: boolean; prefix: string | null; res: OSS.NormalSuccessResponse }>;
|
853 |
|
854 | /**
|
855 | * Delete the bucket logging settings.
|
856 | */
|
857 | deleteBucketLogging(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
858 |
|
859 | // Website operations
|
860 | /**
|
861 | * Set the bucket as a static website.
|
862 | */
|
863 | putBucketWebsite(name: string, config: OSS.PutBucketWebsiteConfig): Promise<OSS.NormalSuccessResponse>;
|
864 |
|
865 | /**
|
866 | * Get the bucket website config.
|
867 | */
|
868 | getBucketWebsite(
|
869 | name: string,
|
870 | options?: OSS.RequestOptions,
|
871 | ): Promise<{ index: string; error: string; res: OSS.NormalSuccessResponse }>;
|
872 |
|
873 | /**
|
874 | * Delete the bucket website config.
|
875 | */
|
876 | deleteBucketWebsite(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
877 |
|
878 | // referer operations
|
879 | /**
|
880 | * Set the bucket request Referer white list.
|
881 | */
|
882 | putBucketReferer(
|
883 | name: string,
|
884 | allowEmpty: boolean,
|
885 | referers: string[],
|
886 | options?: OSS.RequestOptions,
|
887 | ): Promise<OSS.NormalSuccessResponse>;
|
888 |
|
889 | /**
|
890 | * Get the bucket request Referer white list.
|
891 | */
|
892 | getBucketReferer(
|
893 | name: string,
|
894 | options?: OSS.RequestOptions,
|
895 | ): Promise<{ allowEmpty: boolean; referers: string[]; res: OSS.NormalSuccessResponse }>;
|
896 |
|
897 | /**
|
898 | * Delete the bucket request Referer white list.
|
899 | */
|
900 | deleteBucketReferer(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
901 |
|
902 | // lifecycle operations
|
903 | /**
|
904 | * Set the bucket object lifecycle.
|
905 | */
|
906 | putBucketLifecycle(
|
907 | name: string,
|
908 | rules: OSS.LifecycleRule[],
|
909 | options?: OSS.RequestOptions,
|
910 | ): Promise<OSS.NormalSuccessResponse>;
|
911 |
|
912 | /**
|
913 | * Get the bucket object lifecycle.
|
914 | */
|
915 | getBucketLifecycle(
|
916 | name: string,
|
917 | options?: OSS.RequestOptions,
|
918 | ): Promise<{ rules: OSS.LifecycleRule[]; res: OSS.NormalSuccessResponse }>;
|
919 |
|
920 | /**
|
921 | * Delete the bucket object lifecycle.
|
922 | */
|
923 | deleteBucketLifecycle(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
924 |
|
925 | // CORS operations
|
926 | /**
|
927 | * Set CORS rules of the bucket object
|
928 | */
|
929 | putBucketCORS(
|
930 | name: string,
|
931 | rules: OSS.CORSRule[],
|
932 | options?: OSS.RequestOptions,
|
933 | ): Promise<OSS.NormalSuccessResponse>;
|
934 |
|
935 | /**
|
936 | * Get CORS rules of the bucket object.
|
937 | */
|
938 | getBucketCORS(name: string): Promise<{ rules: OSS.CORSRule[]; res: OSS.NormalSuccessResponse }>;
|
939 |
|
940 | /**
|
941 | * Delete CORS rules of the bucket object.
|
942 | */
|
943 | deleteBucketCORS(name: string): Promise<OSS.NormalSuccessResponse>;
|
944 |
|
945 | // policy operations
|
946 | /**
|
947 | * Adds or modify policy for a bucket.
|
948 | */
|
949 | putBucketPolicy(
|
950 | name: string,
|
951 | policy: OSS.BucketPolicy,
|
952 | options?: OSS.RequestOptions
|
953 | ): Promise<{
|
954 | status: number,
|
955 | res: OSS.NormalSuccessResponse,
|
956 | }>;
|
957 |
|
958 | /**
|
959 | * Obtains the policy for a bucket.
|
960 | */
|
961 | getBucketPolicy(name: string, options?: OSS.RequestOptions): Promise<OSS.GetBucketPolicyResult>;
|
962 |
|
963 | /**
|
964 | * Deletes the policy added for a bucket.
|
965 | */
|
966 | deleteBucketPolicy(
|
967 | name: string,
|
968 | options?: OSS.RequestOptions
|
969 | ): Promise<{
|
970 | status: number,
|
971 | res: OSS.NormalSuccessResponse,
|
972 | }>;
|
973 |
|
974 | /********************************************************** Object operations ********************************************/
|
975 | /**
|
976 | * List objects in the bucket.
|
977 | */
|
978 | list(query: OSS.ListObjectsQuery | null, options: OSS.RequestOptions): Promise<OSS.ListObjectResult>;
|
979 |
|
980 | /**
|
981 | * Add an object to the bucket.
|
982 | */
|
983 | put(name: string, file: any, options?: OSS.PutObjectOptions): Promise<OSS.PutObjectResult>;
|
984 |
|
985 | /**
|
986 | * Add a stream object to the bucket.
|
987 | */
|
988 | putStream(
|
989 | name: string,
|
990 | stream: any,
|
991 | options?: OSS.PutStreamOptions,
|
992 | ): Promise<{ name: string; res: OSS.NormalSuccessResponse }>;
|
993 |
|
994 | /**
|
995 | * Append an object to the bucket, it's almost same as put, but it can add content to existing object rather than override it.
|
996 | */
|
997 | append(name: string, file: any, options?: OSS.AppendObjectOptions): Promise<OSS.AppendObjectResult>;
|
998 |
|
999 | /**
|
1000 | * Get the Object url. If provide baseUrl, will use baseUrl instead the default endpoint.
|
1001 | */
|
1002 | getObjectUrl(name: string, baseUrl?: string): string;
|
1003 |
|
1004 | /**
|
1005 | * Get the Object url. If provide baseUrl, will use baseUrl instead the default bucket and endpoint. Suggest use generateObjectUrl instead of getObjectUrl.
|
1006 | */
|
1007 | generateObjectUrl(name: string, baseUrl?: string): string;
|
1008 |
|
1009 | /**
|
1010 | * Head an object and get the meta info.
|
1011 | */
|
1012 | head(name: string, options?: OSS.HeadObjectOptions): Promise<OSS.HeadObjectResult>;
|
1013 |
|
1014 | /**
|
1015 | * Get an object from the bucket.
|
1016 | */
|
1017 | get(name: string, file?: any, options?: OSS.GetObjectOptions): Promise<OSS.GetObjectResult>;
|
1018 |
|
1019 | /**
|
1020 | * Get an object read stream.
|
1021 | */
|
1022 | getStream(name?: string, options?: OSS.GetStreamOptions): Promise<OSS.GetStreamResult>;
|
1023 |
|
1024 | /**
|
1025 | * Delete an object from the bucket.
|
1026 | */
|
1027 | delete(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
1028 |
|
1029 | /**
|
1030 | * Copy an object from sourceName to name.
|
1031 | */
|
1032 | copy(name: string, sourceName: string, options?: OSS.CopyObjectOptions): Promise<OSS.CopyAndPutMetaResult>;
|
1033 | copy(name: string, sourceName: string, sourceBucket?: string, options?: OSS.CopyObjectOptions): Promise<OSS.CopyAndPutMetaResult>;
|
1034 |
|
1035 | /**
|
1036 | * Set an exists object meta.
|
1037 | */
|
1038 | putMeta(name: string, meta: OSS.UserMeta, options: OSS.RequestOptions): Promise<OSS.CopyAndPutMetaResult>;
|
1039 |
|
1040 | /**
|
1041 | * Delete multi objects in one request.
|
1042 | */
|
1043 | deleteMulti(names: string[], options?: OSS.DeleteMultiOptions): Promise<OSS.DeleteMultiResult>;
|
1044 |
|
1045 | /**
|
1046 | * Create a signature url for download or upload object. When you put object with signatureUrl ,you need to pass Content-Type.Please look at the example.
|
1047 | */
|
1048 | signatureUrl(name: string, options?: OSS.SignatureUrlOptions): string;
|
1049 |
|
1050 | /**
|
1051 | * Set object's ACL.
|
1052 | */
|
1053 | putACL(name: string, acl: OSS.ACLType, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
1054 |
|
1055 | /**
|
1056 | * Get object's ACL.
|
1057 | */
|
1058 | getACL(name: string, options?: OSS.RequestOptions): Promise<OSS.GetACLResult>;
|
1059 |
|
1060 | /**
|
1061 | * Restore Object.
|
1062 | */
|
1063 | restore(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
1064 |
|
1065 | /**
|
1066 | * multi upload
|
1067 | */
|
1068 | initMultipartUpload(name: string, options?: OSS.InitMultipartUploadOptions): Promise<OSS.InitMultipartUploadResult>;
|
1069 |
|
1070 | /**
|
1071 | * After initiating a Multipart Upload event, you can upload data in parts based on the specified object name and Upload ID.
|
1072 | */
|
1073 | uploadPart(
|
1074 | name: string,
|
1075 | uploadId: string,
|
1076 | partNo: number,
|
1077 | file: any,
|
1078 | start: number,
|
1079 | end: number,
|
1080 | options?: OSS.RequestOptions,
|
1081 | ): Promise<OSS.UploadPartResult>;
|
1082 |
|
1083 | /**
|
1084 | * Using Upload Part Copy, you can copy data from an existing object and upload a part of the data.
|
1085 | * When copying a file larger than 1 GB, you must use the Upload Part Copy method. If you want to copy a file smaller than 1 GB, see Copy Object.
|
1086 | */
|
1087 | uploadPartCopy(
|
1088 | name: string,
|
1089 | uploadId: string,
|
1090 | partNo: number,
|
1091 | range: string,
|
1092 | sourceData: { sourceKey: string; sourceBucketName: string },
|
1093 | options: { timeout?: number | undefined; headers?: object | undefined },
|
1094 | ): Promise<OSS.UploadPartResult>;
|
1095 |
|
1096 | /**
|
1097 | * After uploading all data parts, you must call the Complete Multipart Upload API to complete Multipart Upload for the entire file.
|
1098 | */
|
1099 | completeMultipartUpload(
|
1100 | name: string,
|
1101 | uploadId: string,
|
1102 | parts: Array<{ number: number; etag: string }>,
|
1103 | options?: OSS.CompleteMultipartUploadOptions,
|
1104 | ): Promise<OSS.CompleteMultipartUploadResult>;
|
1105 |
|
1106 | /**
|
1107 | * Upload file with OSS multipart.
|
1108 | */
|
1109 | multipartUpload(name: string, file: any, options: OSS.MultipartUploadOptions): Promise<OSS.MultipartUploadResult>;
|
1110 |
|
1111 | /**
|
1112 | * Copy file with OSS multipart.
|
1113 | * this function contains head, initMultipartUpload, uploadPartCopy, completeMultipartUpload.
|
1114 | * When copying a file larger than 1 GB, you should use the Upload Part Copy method. If you want to copy a file smaller than 1 GB, see Copy Object.
|
1115 | */
|
1116 | multipartUploadCopy(
|
1117 | name: string,
|
1118 | sourceData: OSS.MultipartUploadCopySourceData,
|
1119 | options?: OSS.MultipartUploadOptions,
|
1120 | ): Promise<OSS.MultipartUploadCopyResult>;
|
1121 |
|
1122 | /**
|
1123 | * The ListParts command can be used to list all successfully uploaded parts mapped to a specific upload ID, i.e.: those not completed and not aborted.
|
1124 | */
|
1125 | listParts(
|
1126 | name: string,
|
1127 | uploadId: string,
|
1128 | query?: OSS.ListPartsQuery,
|
1129 | options?: OSS.RequestOptions,
|
1130 | ): Promise<OSS.ListPartsResult>;
|
1131 |
|
1132 | /**
|
1133 | * List on-going multipart uploads, i.e.: those not completed and not aborted.
|
1134 | */
|
1135 | listUploads(query: OSS.ListUploadsQuery, options?: OSS.RequestOptions): Promise<OSS.ListUploadsResult>;
|
1136 |
|
1137 | /**
|
1138 | * Abort a multipart upload for object.
|
1139 | */
|
1140 | abortMultipartUpload(
|
1141 | name: string,
|
1142 | uploadId: string,
|
1143 | options?: OSS.RequestOptions,
|
1144 | ): Promise<OSS.NormalSuccessResponse>;
|
1145 |
|
1146 | /**
|
1147 | * get postObject params.
|
1148 | */
|
1149 | calculatePostSignature(
|
1150 | |
1151 |
|
1152 |
|
1153 | policy: object | string
|
1154 | ): OSS.PostObjectParams;
|
1155 |
|
1156 | /************************************************ RTMP Operations *************************************************************/
|
1157 | /**
|
1158 | * Create a live channel.
|
1159 | */
|
1160 | putChannel(id: string, conf: OSS.PutChannelConf, options?: OSS.RequestOptions): Promise<OSS.PutChannelResult>;
|
1161 |
|
1162 | /**
|
1163 | * Get live channel info.
|
1164 | */
|
1165 | getChannel(
|
1166 | id: string,
|
1167 | options?: OSS.RequestOptions,
|
1168 | ): Promise<{ data: OSS.PutChannelConf; res: OSS.NormalSuccessResponse }>;
|
1169 |
|
1170 | /**
|
1171 | * Delete a live channel.
|
1172 | */
|
1173 | deleteChannel(id: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
1174 |
|
1175 | /**
|
1176 | * Change the live channel status.
|
1177 | */
|
1178 | putChannelStatus(id: string, status?: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
1179 |
|
1180 | /**
|
1181 | * Get the live channel status.
|
1182 | */
|
1183 | getChannelStatus(id: string, options?: OSS.RequestOptions): Promise<OSS.GetChannelResult>;
|
1184 |
|
1185 | /**
|
1186 | * List channels.
|
1187 | */
|
1188 | listChannels(query: OSS.ListChannelsQuery, options?: OSS.RequestOptions): Promise<OSS.ListChannelsResult>;
|
1189 |
|
1190 | /**
|
1191 | * Get the live channel history.
|
1192 | */
|
1193 | getChannelHistory(id: string, options?: OSS.RequestOptions): Promise<OSS.ChannelHistoryResult>;
|
1194 |
|
1195 | /**
|
1196 | * Create a VOD playlist for the channel.
|
1197 | */
|
1198 | createVod(
|
1199 | id: string,
|
1200 | name: string,
|
1201 | time: { startTime: number; endTime: number },
|
1202 | options?: OSS.RequestOptions,
|
1203 | ): Promise<OSS.NormalSuccessResponse>;
|
1204 |
|
1205 | /**
|
1206 | * Get signatured rtmp url for publishing.
|
1207 | */
|
1208 | getRtmpUrl(channelId?: string, options?: OSS.GetRtmpUrlOptions): string;
|
1209 | }
|
1210 |
|
\ | No newline at end of file |