oak-external-sdk/es/service/ctyun/CTYun.d.ts

41 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { CTYunZone, ReqOptionProps } from '../../types/CTYun';
export declare class CTYunInstance {
private accessKey;
private secretKey;
constructor(accessKey: string, secretKey: string);
getUploadInfo(bucket: string, zone: CTYunZone, key?: string): {
key: string | undefined;
accessKey: string;
policy: string;
signature: string;
uploadHost: string;
bucket: string;
};
getSignInfo(bucket: string): {
encodePolicy: string;
signature: string;
};
private base64ToUrlSafe;
private hmacSha1;
private urlSafeBase64Encode;
removeFile(bucket: string, zone: CTYunZone, key: string): Promise<void>;
isExistObject(srcBucket: string, zone: CTYunZone, srcKey: string): Promise<boolean>;
getAuthorization(reqOptions: ReqOptionProps, zone: CTYunZone): string;
private getSignatureKey;
private buildCanonicalRequest;
private buildCanonicalQueryString;
private calculatePayloadHash;
/**
* 获取预签名对象URL统一接口
* 生成天翼云对象的预签名访问URL兼容 AWS S3 Signature V4
*/
presignObjectUrl(method: 'GET' | 'PUT' | 'POST' | 'DELETE', bucket: string, zone: CTYunZone, key: string, options?: {
expires?: number;
contentType?: string;
}): Promise<{
url: string;
headers?: Record<string, string | string[]>;
formdata?: Record<string, any>;
}>;
}