forked from aws-amplify/amplify-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetUrl.ts
30 lines (26 loc) · 1.1 KB
/
getUrl.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Amplify } from '@aws-amplify/core';
import { getUrl as getUrlInternal } from '../../providers/s3/apis/internal/getUrl';
import { GetUrlInput } from '../types/inputs';
import { GetUrlOutput } from '../types/outputs';
/**
* @internal
*/
export function getUrl(input: GetUrlInput) {
return getUrlInternal(Amplify, {
path: input.path,
options: {
useAccelerateEndpoint: input?.options?.useAccelerateEndpoint,
bucket: input?.options?.bucket,
validateObjectExistence: input?.options?.validateObjectExistence,
expiresIn: input?.options?.expiresIn,
contentDisposition: input?.options?.contentDisposition,
contentType: input?.options?.contentType,
// Advanced options
locationCredentialsProvider: input?.options?.locationCredentialsProvider,
},
// Type casting is necessary because `getPropertiesInternal` supports both Gen1 and Gen2 signatures, but here
// given in input can only be Gen2 signature, the return can only ben Gen2 signature.
}) as Promise<GetUrlOutput>;
}