1 | import { PutObjectCommandInput } from '@aws-sdk/client-s3';
|
2 | import { StorageOptions, StorageProvider, S3ProviderGetConfig, S3ProviderGetOuput, S3ProviderPutConfig, S3ProviderRemoveConfig, S3ProviderListConfig, S3ProviderCopyConfig, S3ProviderCopyOutput, S3CopySource, S3CopyDestination, S3ProviderRemoveOutput, S3ProviderPutOutput, S3ProviderListOutput } from '../types';
|
3 | /**
|
4 | * Provide storage methods to use AWS S3
|
5 | */
|
6 | export declare class AWSS3Provider implements StorageProvider {
|
7 | static readonly CATEGORY = "Storage";
|
8 | static readonly PROVIDER_NAME = "AWSS3";
|
9 | private _config;
|
10 | private _storage;
|
11 | /**
|
12 | * Initialize Storage with AWS configurations
|
13 | * @param {Object} config - Configuration object for storage
|
14 | */
|
15 | constructor(config?: StorageOptions);
|
16 | /**
|
17 | * get the category of the plugin
|
18 | */
|
19 | getCategory(): string;
|
20 | /**
|
21 | * get provider name of the plugin
|
22 | */
|
23 | getProviderName(): 'AWSS3';
|
24 | /**
|
25 | * Configure Storage part with aws configuration
|
26 | * @param {Object} config - Configuration of the Storage
|
27 | * Object} - Current configuration
{ |
28 | */
|
29 | configure(config?: any): object;
|
30 | private startResumableUpload;
|
31 | /**
|
32 | * Copy an object from a source object to a new object within the same bucket. Can optionally copy files across
|
33 | * different level or identityId (if source object's level is 'protected').
|
34 | *
|
35 | * @async
|
36 | * @param {S3CopySource} src - Key and optionally access level and identityId of the source object.
|
37 | * @param {S3CopyDestination} dest - Key and optionally access level of the destination object.
|
38 | * @param {S3ProviderCopyConfig} [config] - Optional configuration for s3 commands.
|
39 | * @return {Promise<S3ProviderCopyOutput>} The key of the copied object.
|
40 | */
|
41 | copy(src: S3CopySource, dest: S3CopyDestination, config?: S3ProviderCopyConfig): Promise<S3ProviderCopyOutput>;
|
42 | /**
|
43 | * Get a presigned URL of the file or the object data when download:true
|
44 | *
|
45 | * @param {string} key - key of the object
|
46 | * @param {S3ProviderGetConfig} [config] - Optional configuration for the underlying S3 command
|
47 | * @return {Promise<string | GetObjectCommandOutput>} - A promise resolves to Amazon S3 presigned URL or the
|
48 | * GetObjectCommandOutput if download is set to true on success
|
49 | */
|
50 | get<T extends S3ProviderGetConfig & StorageOptions>(key: string, config?: T): Promise<S3ProviderGetOuput<T>>;
|
51 | /**
|
52 | * Put a file in S3 bucket specified to configure method
|
53 | * @param key - key of the object
|
54 | * @param object - File to be put in Amazon S3 bucket
|
55 | * @param [config] - Optional configuration for the underlying S3 command
|
56 | * @return an instance of AWSS3UploadTask or a promise that resolves to an object with the new object's key on
|
57 | * success.
|
58 | */
|
59 | put<T extends S3ProviderPutConfig>(key: string, object: PutObjectCommandInput['Body'], config?: T): S3ProviderPutOutput<T>;
|
60 | /**
|
61 | * Remove the object for specified key
|
62 | * @param {string} key - key of the object
|
63 | * @param {S3ProviderRemoveConfig} [config] - Optional configuration for the underlying S3 command
|
64 | * @return {Promise<S3ProviderRemoveOutput>} - Promise resolves upon successful removal of the object
|
65 | */
|
66 | remove(key: string, config?: S3ProviderRemoveConfig): Promise<S3ProviderRemoveOutput>;
|
67 | private _list;
|
68 | /**
|
69 | * List bucket objects relative to the level and prefix specified
|
70 | * @param {string} path - the path that contains objects
|
71 | * @param {S3ProviderListConfig} [config] - Optional configuration for the underlying S3 command
|
72 | * @return {Promise<S3ProviderListOutput>} - Promise resolves to list of keys, eTags, lastModified
|
73 | * and file size for all objects in path
|
74 | */
|
75 | list(path: string, config?: S3ProviderListConfig): Promise<S3ProviderListOutput>;
|
76 | private _ensureCredentials;
|
77 | private _isWithCredentials;
|
78 | private _prefix;
|
79 | /**
|
80 | * Creates an S3 client with new V3 aws sdk
|
81 | */
|
82 | private _createNewS3Client;
|
83 | }
|