Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
erinleigh90 committed Mar 25, 2024
1 parent 30d5b86 commit b604e0a
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 25 deletions.
4 changes: 2 additions & 2 deletions packages/storage/src/providers/s3/apis/getProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface GetProperties {
* Gets the properties of a file. The properties include S3 system metadata and
* the user metadata that was provided when uploading the file.
*
* @param input - The `GetPropertiesInput` object.
* @param input - The `GetPropertiesInputPath` object.
* @returns Requested object properties.
* @throws An `S3Exception` when the underlying S3 service returned error.
* @throws A `StorageValidationErrorCode` when API call parameters are invalid.
Expand All @@ -32,7 +32,7 @@ interface GetProperties {
* Gets the properties of a file. The properties include S3 system metadata and
* the user metadata that was provided when uploading the file.
*
* @param input - The `GetPropertiesInput` object.
* @param input - The `GetPropertiesInputKey` object.
* @returns Requested object properties.
* @throws An `S3Exception` when the underlying S3 service returned error.
* @throws A `StorageValidationErrorCode` when API call parameters are invalid.
Expand Down
4 changes: 2 additions & 2 deletions packages/storage/src/providers/s3/apis/getUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface GetUrl {
* to true, this method will verify the given object already exists in S3 before returning a presigned
* URL, and will throw `StorageError` if the object does not exist.
*
* @param input - The `GetUrlInput` object.
* @param input - The `GetUrlInputPath` object.
* @returns Presigned URL and timestamp when the URL MAY expire.
* @throws service: `S3Exception` - thrown when checking for existence of the object
* @throws validation: `StorageValidationErrorCode` - Validation errors
Expand All @@ -42,7 +42,7 @@ interface GetUrl {
* to true, this method will verify the given object already exists in S3 before returning a presigned
* URL, and will throw `StorageError` if the object does not exist.
*
* @param input - The `GetUrlInput` object.
* @param input - The `GetUrlInputKey` object.
* @returns Presigned URL and timestamp when the URL MAY expire.
* @throws service: `S3Exception` - thrown when checking for existence of the object
* @throws validation: `StorageValidationErrorCode` - Validation errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface GetProperties {
* the user metadata that was provided when uploading the file.
*
* @param contextSpec - The isolated server context.
* @param input - The `GetPropertiesInput` object.
* @param input - The `GetPropertiesInputPath` object.
* @returns Requested object properties.
* @throws An `S3Exception` when the underlying S3 service returned error.
* @throws A `StorageValidationErrorCode` when API call parameters are invalid.
Expand All @@ -39,7 +39,7 @@ interface GetProperties {
* the user metadata that was provided when uploading the file.
*
* @param contextSpec - The isolated server context.
* @param input - The `GetPropertiesInput` object.
* @param input - The `GetPropertiesInputKey` object.
* @returns Requested object properties.
* @throws An `S3Exception` when the underlying S3 service returned error.
* @throws A `StorageValidationErrorCode` when API call parameters are invalid.
Expand Down
73 changes: 54 additions & 19 deletions packages/storage/src/providers/s3/apis/server/getUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,62 @@ import {
getAmplifyServerContext,
} from '@aws-amplify/core/internals/adapter-core';

import { GetUrlInput, GetUrlOutput } from '../../types';
import {
GetUrlInput,
GetUrlInputKey,
GetUrlInputPath,
GetUrlOutput,
} from '../../types';
import { getUrl as getUrlInternal } from '../internal/getUrl';

/**
* Get a temporary presigned URL to download the specified S3 object.
* The presigned URL expires when the associated role used to sign the request expires or
* the option `expiresIn` is reached. The `expiresAt` property in the output object indicates when the URL MAY expire.
*
* By default, it will not validate the object that exists in S3. If you set the `options.validateObjectExistence`
* to true, this method will verify the given object already exists in S3 before returning a presigned
* URL, and will throw `StorageError` if the object does not exist.
*
* @param contextSpec - The isolated server context.
* @param input - The `GetUrlInput` object.
* @returns Presigned URL and timestamp when the URL MAY expire.
* @throws service: `S3Exception` - thrown when checking for existence of the object
* @throws validation: `StorageValidationErrorCode` - Validation errors
* thrown either username or key are not defined.
*
*/
export const getUrl = async (
interface GetUrl {
/**
* Get a temporary presigned URL to download the specified S3 object.
* The presigned URL expires when the associated role used to sign the request expires or
* the option `expiresIn` is reached. The `expiresAt` property in the output object indicates when the URL MAY expire.
*
* By default, it will not validate the object that exists in S3. If you set the `options.validateObjectExistence`
* to true, this method will verify the given object already exists in S3 before returning a presigned
* URL, and will throw `StorageError` if the object does not exist.
*
* @param contextSpec - The isolated server context.
* @param input - The `GetUrlInputPath` object.
* @returns Presigned URL and timestamp when the URL MAY expire.
* @throws service: `S3Exception` - thrown when checking for existence of the object
* @throws validation: `StorageValidationErrorCode` - Validation errors
* thrown either username or key are not defined.
*
*/
(
contextSpec: AmplifyServer.ContextSpec,
input: GetUrlInputPath,
): Promise<GetUrlOutput>;
/**
* @deprecated The `key` and `accessLevel` parameters are deprecated and may be removed in the next major version.
* Please use {@link https://docs.amplify.aws/javascript/build-a-backend/storage/download/#generate-a-download-url | path} instead.
*
* Get a temporary presigned URL to download the specified S3 object.
* The presigned URL expires when the associated role used to sign the request expires or
* the option `expiresIn` is reached. The `expiresAt` property in the output object indicates when the URL MAY expire.
*
* By default, it will not validate the object that exists in S3. If you set the `options.validateObjectExistence`
* to true, this method will verify the given object already exists in S3 before returning a presigned
* URL, and will throw `StorageError` if the object does not exist.
*
* @param contextSpec - The isolated server context.
* @param input - The `GetUrlInputKey` object.
* @returns Presigned URL and timestamp when the URL MAY expire.
* @throws service: `S3Exception` - thrown when checking for existence of the object
* @throws validation: `StorageValidationErrorCode` - Validation errors
* thrown either username or key are not defined.
*
*/
(
contextSpec: AmplifyServer.ContextSpec,
input: GetUrlInputKey,
): Promise<GetUrlOutput>;
}
export const getUrl: GetUrl = async (
contextSpec: AmplifyServer.ContextSpec,
input: GetUrlInput,
): Promise<GetUrlOutput> =>
Expand Down

0 comments on commit b604e0a

Please sign in to comment.