@cumulus/aws-client
Version:
Utilities for working with AWS
46 lines • 2.23 kB
TypeScript
import { GetObjectCommand, HeadObjectCommand, GetObjectCommandInput, S3ClientConfig } from '@aws-sdk/client-s3';
import { RequestPresigningArguments } from '@aws-sdk/types';
declare type QueryParams = {
[key: string]: string;
};
/**
* Class to use when interacting with S3
*
*/
declare class S3ObjectStore {
private readonly s3;
private readonly middlewareName;
private queryParams;
constructor(config?: Partial<S3ClientConfig>);
getQueryParams(): QueryParams;
setQueryParams(queryParams: QueryParams): void;
getS3SignedUrlWithCustomQueryParams(command: GetObjectCommand | HeadObjectCommand, presignOptions?: RequestPresigningArguments): Promise<string>;
/**
* Returns an HTTPS URL that can be used to perform a GET on the given object
* store URL
*
* @param {string} objectUrl - the URL of the object to sign
* @param {string} [options] - options to pass to S3.getObject
* @param {string} [queryParams] - a mapping of parameter key/values to put in the URL
* @param {RequestPresigningArguments} presignOptions - presignOptions
* @returns {Promise<string>} a signed URL
* @throws TypeError - if the URL is not a recognized protocol or cannot be parsed
*/
signGetObject(objectUrl: string, options?: Partial<GetObjectCommandInput>, queryParams?: QueryParams, presignOptions?: RequestPresigningArguments): Promise<string>;
/**
* Returns an HTTPS URL that can be used to perform a HEAD on the given object
* store URL
*
* @param {string} objectUrl - the URL of the object to sign
* @param {string} [options] - options to pass to S3.getObject
* @param {string} [queryParams] - a mapping of parameter key/values to put in the URL
* @param {RequestPresigningArguments} presignOptions - presignOptions
* @returns {Promise<string>} a signed URL
* @throws TypeError - if the URL is not a recognized protocol or cannot be parsed
*/
signHeadObject(objectUrl: string, options: {
[key: string]: string;
} | undefined, queryParams: QueryParams, presignOptions?: RequestPresigningArguments): Promise<string>;
}
export = S3ObjectStore;
//# sourceMappingURL=S3ObjectStore.d.ts.map