Skip to content

Commit

Permalink
Merge branch 'master' into pwdcom
Browse files Browse the repository at this point in the history
  • Loading branch information
richardzcode authored Apr 20, 2018
2 parents ee04d88 + 652c2ab commit 308af82
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ category_list:
- title: AWS Pinpoint
url: https://aws.amazon.com/pinpoint/
- title: Storage
excerpt: A simple mechanism for managing user content in public or private storage.
excerpt: A simple mechanism for managing user content in public, protected or private storage.
cta: Read more
class: aws-icon-ps-60-file-box
url: '/media/storage_guide'
Expand Down
4 changes: 2 additions & 2 deletions docs/media/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ For a complete guide for starting your app with AWS Amplify, please see our [Qui

### Store Files on The Cloud

AWS Amplify's default implementation for Storage category uses Amazon S3. You can store content in public or private Amazon S3 buckets. Private folders enable the resources are only available to a specific user identity.
AWS Amplify's default implementation for Storage category uses Amazon S3. You can store content in public, protected or private folders. Protected folders allow content to be readable by everyone, but writable only by the creating user. Private folders restrict all content access to the creating user.

```js
Storage.put(key, fileObj, {level: 'private'})
.then (result => console.log(result))
.catch(err => console.log(err));

// Stores data with specifying its MIME type
Storage.put(key, fileObj, {
level: 'private',
Expand Down
8 changes: 5 additions & 3 deletions docs/media/storage_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Storage

AWS Amplify Storage module provides a simple mechanism for managing user content for your app in public or private storage buckets.
AWS Amplify Storage module provides a simple mechanism for managing user content for your app in public, protected or private storage buckets.

## Installation and Configuration

Expand Down Expand Up @@ -89,13 +89,15 @@ Note: You can restrict the access to your bucket by updating AllowedOrigin to in

### File Access Levels

Storage module can manage files in two different access levels; `public` and `private`.
Storage module can manage files with three different access levels; `public`, `protected` and `private`.

Files with public access level can be accessed by all users who are using your app. In S3, they are stored under the `public/` path in your S3 bucket.

Files with protected access level are readable by all users but writable only by the creating user. In S3, they are stored under `protected/{user_identity_id}/` where the **user_identity_id** corresponds to a unique Amazon Cognito Identity ID for that user.

Files with private access level are only accessible for specific authenticated users only. In S3, they are stored under `private/{user_identity_id}/` where the **user_identity_id** corresponds to a unique Amazon Cognito Identity ID for that user.

The access level can be configured on the Storage object globally. Alternatively, the access levels can be set in individual function calls.
The access level can be configured on the Storage object globally. Alternatively, the access levels can be set in individual function calls.

Default access level for Storage module is `public`. Unless you configure Storage otherwise, all uploaded files will be publicly available for all users.
{: .callout .callout--info}
Expand Down
8 changes: 4 additions & 4 deletions packages/aws-amplify/src/Storage/Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class StorageClass {
/**
* Get a presigned URL of the file
* @param {String} key - key of the object
* @param {Object} [options] - { level : private|public }
* @param {Object} [options] - { level : private|protected|public }
* @return - A promise resolves to Amazon S3 presigned URL on success
*/
public async get(key: string, options?): Promise<Object> {
Expand Down Expand Up @@ -141,7 +141,7 @@ export default class StorageClass {
* Put a file in S3 bucket specified to configure method
* @param {Stirng} key - key of the object
* @param {Object} object - File to be put in Amazon S3 bucket
* @param {Object} [options] - { level : private|public, contentType: MIME Types }
* @param {Object} [options] - { level : private|protected|public, contentType: MIME Types }
* @return - promise resolves to object on success
*/
public async put(key: string, object, options?): Promise<Object> {
Expand Down Expand Up @@ -195,7 +195,7 @@ export default class StorageClass {
/**
* Remove the object for specified key
* @param {String} key - key of the object
* @param {Object} [options] - { level : private|public }
* @param {Object} [options] - { level : private|protected|public }
* @return - Promise resolves upon successful removal of the object
*/
public async remove(key: string, options?): Promise<any> {
Expand Down Expand Up @@ -237,7 +237,7 @@ export default class StorageClass {
/**
* List bucket objects relative to the level and prefix specified
* @param {String} path - the path that contains objects
* @param {Object} [options] - { level : private|public }
* @param {Object} [options] - { level : private|protected|public }
* @return - Promise resolves to list of keys for all objects in path
*/
public async list(path, options?): Promise<any> {
Expand Down

0 comments on commit 308af82

Please sign in to comment.