UNPKG

2.58 kBTypeScriptView Raw
1import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
2import { GetUrlInput, GetUrlOutput, GetUrlWithPathInput, GetUrlWithPathOutput } from '../../types';
3/**
4 * Get a temporary presigned URL to download the specified S3 object.
5 * The presigned URL expires when the associated role used to sign the request expires or
6 * the option `expiresIn` is reached. The `expiresAt` property in the output object indicates when the URL MAY expire.
7 *
8 * By default, it will not validate the object that exists in S3. If you set the `options.validateObjectExistence`
9 * to true, this method will verify the given object already exists in S3 before returning a presigned
10 * URL, and will throw `StorageError` if the object does not exist.
11 *
12 * @param contextSpec - The isolated server context.
13 * @param input - The `GetUrlWithPathInput` object.
14 * @returns Presigned URL and timestamp when the URL may expire.
15 * @throws service: `S3Exception` - thrown when checking for existence of the object
16 * @throws validation: `StorageValidationErrorCode` - Validation errors
17 * thrown either username or key are not defined.
18 *
19 */
20export declare function getUrl(contextSpec: AmplifyServer.ContextSpec, input: GetUrlWithPathInput): Promise<GetUrlWithPathOutput>;
21/**
22 * @deprecated The `key` and `accessLevel` parameters are deprecated and may be removed in the next major version.
23 * Please use {@link https://docs.amplify.aws/javascript/build-a-backend/storage/download/#generate-a-download-url | path} instead.
24 *
25 * Get a temporary presigned URL to download the specified S3 object.
26 * The presigned URL expires when the associated role used to sign the request expires or
27 * the option `expiresIn` is reached. The `expiresAt` property in the output object indicates when the URL MAY expire.
28 *
29 * By default, it will not validate the object that exists in S3. If you set the `options.validateObjectExistence`
30 * to true, this method will verify the given object already exists in S3 before returning a presigned
31 * URL, and will throw `StorageError` if the object does not exist.
32 *
33 * @param contextSpec - The isolated server context.
34 * @param input - The `GetUrlInput` object.
35 * @returns Presigned URL and timestamp when the URL may expire.
36 * @throws service: `S3Exception` - thrown when checking for existence of the object
37 * @throws validation: `StorageValidationErrorCode` - Validation errors
38 * thrown either username or key are not defined.
39 *
40 */
41export declare function getUrl(contextSpec: AmplifyServer.ContextSpec, input: GetUrlInput): Promise<GetUrlOutput>;