Skip to content

Commit

Permalink
chore: merging next-release/main into next-release/dev (#7174)
Browse files Browse the repository at this point in the history
* Minor edits to Vite + React quickstart (#6926)

* Updates to Vite + React quickstart

* Update src/fragments/gen2/quickstart/build-a-backend.mdx

Co-authored-by: Kevin Old <[email protected]>

* Update build-a-backend.mdx

* Update build-a-backend.mdx

* Update build-a-backend.mdx

---------

Co-authored-by: Kevin Old <[email protected]>

* fix: Fix incorrect auth import path in migration guide. (#6934)

* fix: Update incorrect `updateMFAPreference` parameter in JS v6 migration guide. (#6935)

* Amplify Android Release 2.14.11 (#6933)

* chore: refactor .layout-header into separate component (#6826)

* platform typed as optional

* refactor init

* remove commented code

* remove angry useEffect

* fix typing

* added layoutcontext so mobile menu closes on navigation

* move import

---------

Co-authored-by: katiegoines <[email protected]>

* fix: Nesting of auth cli templates (#6932)

* fix: change config variable name (#6923)

* Guide to support Amplify v2 with AWS Android SDK (#6927)

* Update puppeteer (#6949)

* Update index.mdx (#6950)

* Update CODEOWNERS with correct PM alignment (#6951)

* fix(flutter, js): scope "connect existing cdk" guide to respective platform (#6947)

Co-authored-by: Tim Nguyen <[email protected]>

* Revert "fix(flutter, js): scope "connect existing cdk" guide to respective pl…" (#6955)

This reverts commit 5998b22.

* chore: remove duplicated logic between Layout and LayoutHeader (#6954)

* chore: more layout refactoring

* remove unused prop, alphabetize props

* improve oauth docs (#6961)

* fixed gen 2 getting started guide (#6968)

* Update redirects for deleted hidden pages (#6944)

* Update manual installation to point to @beta tag (#6972)

* include usage for multi-page apps (#6964)

* include usage for multi-page apps

* improve multi-page app docs

* use Hub syntax

* update imports in examples

* chore: Clean up broken Amplify JS API reference links (#6976)

* chore: Clean up broken Amplify JS API reference links.

* Cleaned up language.

* Update build image instructions for Gen 2 (#6978)

* update build image settings for Gen 2

* remove callout and add fragment to vite guide

* chore: add unit test for YoutubeEmbed component (#6983)

* chore: add unit test for YoutubeEmbed component

* add code coverage stats

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for Accordion component (#6981)

* chore: add unit tests for Accordion component

* issue with window properties

* fixed tracking test

* working on animation issue

* accordion tests

* fix testing errors

* added test for closing accordion

* add code coverage stats

---------

Co-authored-by: katiegoines <[email protected]>

* Update index.mdx (#6986)

* Add env variables for algolia (#6957)

* Add algolia env vars to next.config

* Remove extra code string

* fix(data): update REST API docs to document correct error response type (#6989)

* fix(data): update React Native minimum iOS deployment target guidance; add build step to docs (#6970)

* fix(data): update React Native minimum iOS deployment target; add build step to docs

* address PR feedback

* remove deployment target guidance

* add React Native version deployment target callout

* fix unrecognized syntax

* replace callout with accordion

* move 'upgrading' callout

* Clarify behavior of forgetDevice() API regarding device tracking (#6985)

* Clarify behavior of forgetDevice() API regarding device tracking

This commit updates the documentation to clarify that using the forgetDevice() API results in the device being neither remembered nor tracked. Previously, the documentation suggested that forgotten devices might still be tracked, leading to confusion about the API's behavior. The revised wording aligns with the detailed description under the "Forgotten" section, ensuring consistency and eliminating ambiguity about how forgotten devices are handled.

* Clarify behavior of forgetDevice() API regarding device tracking

* Support for enum value listing (#6885)

* Support for enum value listing

* Update src/pages/gen2/build-a-backend/data/data-modeling/add-fields/index.mdx

* CDK updates v2 (#6990)

* Add padding to bottom of nav menu (#6991)

* Adding secondary index to Gen 2 (#6996)

* Adding secondary index docs

* fixed some formatting for custom query fields

* extend config to show addOuput (#6963)

* extend config

* modify wording

* modify example

* improve wording

* Update index.mdx (#6995)

* Update index.mdx

* add guest access support to docs

* chore: add unit tests for NextPrevious component (#7003)

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for LinkCards and LinkCard components (#7006)

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for GetStartedPopover component (#7005)

Co-authored-by: katiegoines <[email protected]>

* fix: [Storage] Configure Access (#6948)

Co-authored-by: Tim Nguyen <[email protected]>

* fix(Swift): update data use policy info's tracking to false (#6938)

* fix(Swift): update data use policy info's tracking to false

* Update data-information.mdx

* chore: add callouts and troubleshooting guide for configuration (#6967)

* fix: resolve in-content broken links (#7011)

* re-platforming

* remove reference to mocking and testing for android & swift

* remove reference to mocking and testing for android & swift

* filtered out reference to optimistic ui for react native

---------

Co-authored-by: katiegoines <[email protected]>

* update gen2 storage and function docs (#7009)

* update gen2 storage and function docs

* add resource access links and example

* revisions, update code snippet titles

* Update CODEOWNERS (#7014)

* updated steps for extending components in code (#6827)

Co-authored-by: Aditya Shahani <[email protected]>

* Custom business logic support as of March @beta (#7019)

* Enhanced custom business logic DX

* addressed tim's comments

* Added custom subscription configuration worfklow

* removed in-development areas

* added titles

* added links for deep dive material

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <[email protected]>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <[email protected]>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

* added client method for clarity.

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <[email protected]>

* Apply suggestions from code review

Co-authored-by: josef <[email protected]>

---------

Co-authored-by: josef <[email protected]>
Co-authored-by: Kethan sai <[email protected]>

* add storage trigger docs (#7020)

* storage trigger docs

* Apply suggestions from code review

Co-authored-by: josef <[email protected]>

* add storage access actions

---------

Co-authored-by: josef <[email protected]>

* update link checker to wait for each call to complete before making t… (#6993)

* update link checker to wait for each call to complete before making the next and remove # from urls being checked

* update logging to show how many links found on each page

* Update tasks/link-checker.js

---------

Co-authored-by: Jacob Logan <[email protected]>
Co-authored-by: katiegoines <[email protected]>
Co-authored-by: Scott Rees <[email protected]>

* custom examples (#6979)

* custom examples

* fix: broken link, missing / at start (#7026)

Co-authored-by: katiegoines <[email protected]>

* validate and fix code snippets in Data section (#6975)

* Update sandbox --dir-to-watch description (#7031)

* Update index.mdx (#7035)

* Fix link (#7028)

* add docs to auth resource access pattern (#7032)

* fix: type platform as optional in Breadcrumbs component & add unit tests (#6912)

* platform typed as optional

* chore: add unit tests for Breadcrumbs

* testing to include platform optional

* fix: type platform as optional

* add tests for override values

---------

Co-authored-by: katiegoines <[email protected]>

* fix: proper variable naming conventions for storage (#7033)

fix:  proper variable naming conventions for storage

* remove explicit file extension from gen2 imports (#6946)

Co-authored-by: Tim Nguyen <[email protected]>

* fix: Update diff code blocks to TypeScript with code highlights (#6905)

* add docs on granting defineFunction access to defineData (#7029)

* standardize Gen 2 wording (#7036)

* Update index.mdx (#6906)

* Modify_Amplify_resources (#7018)

* fix code snippets on read data page

* code snippet updates

* updated the code snippets

* updated code snippets.

* custom business page rollback

* Update maplibre links (#7040)

* chore: add unit tests for PlatformNavigator (#6980)

* chore: add unit tests for PlatformNavigator

* add code coverage

* simplify

* simplify

---------

Co-authored-by: katiegoines <[email protected]>

* Update links to expo docs (#7044)

* Update links to expo docs

* Update src/pages/[platform]/prev/build-a-backend/auth/add-social-provider/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/prev/build-a-backend/auth/add-social-provider/index.mdx

Co-authored-by: josef <[email protected]>

---------

Co-authored-by: josef <[email protected]>

* chore: add unit tests for InternalLinkButton (#7000)

Co-authored-by: katiegoines <[email protected]>

* chore: add addtl unit test for Block component (#6982)

* chore: add addtl unit test for Block component

* add code coverage stats

* remove superfluous Block component

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for TOC (#6984)

* chore: add unit tests for TOC

* add code coverage

* hardcode expected hash

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for ExternalLink (#6915)

* chore: add unit tests for ExternalLink

* fixing tracking test

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for ExternalLinkButton (#6914)

* chore: add unit tests for ExternalLinkButton

* Update ExternalLinkButton.test.tsx

triggering checks

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for Footer component (#6999)

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for MigrationAlert component (#7004)

* chore: add unit tests for MigrationAlert component

* chore: add unit tests for MigrationAlert component

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit test for Overview component (#7002)

Co-authored-by: katiegoines <[email protected]>

* chore: upgrade docsearch/react to 3.6 (#7046)

* added utility type content (#7047)

* chore: add unit tests for PageLastUpdated (#7001)

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for Commands and Columns (#6916)

* chore: add unit test for CLICommands

* chore: add unit test for Columns

* Update Command.test.tsx

triggering checks

---------

Co-authored-by: katiegoines <[email protected]>

* Update resolution for follow-redirects (#7055)

* Update relative urls (#7048)

* Update relative urls

* Update url

* Updating link checker (#7052)

* Updating link checker to account for duplicate urls from different pages and link text

* Update slack formatting

* Remove console.log

* Add comments to function

* Remove extra console.logs()

* chore: update redirects list (#6969)

* update redirects

* updated redirects

---------

Co-authored-by: katiegoines <[email protected]>

* remove allowlist role names for appsync console access page (#7081)

* Add JavaScript resolver code sample to Gen 1 (#7087)

* fix(JS): Update v5 JS libraries installation guides. (#7090)

* fix(v5): update aws-amplify v5 dependency

* chore: remove extra '0' number from versions

* chore: remove vue2 block

* chore: update version reference

* Cbonif/field-level-auth-support-for-sql (#7091)

* chore(gen2-data): update .secondaryIndexes example to match the latest interface (#7095)

* update setup auth client example with correct props (#7106)

* update auth with correct props

* Change generated function env package name (#7096)

* Update typo in url for localhost (#7110)

* update next config to use a static build Id (#7102)

Co-authored-by: Jacob Logan <[email protected]>

* chore: Add callout on Analytics buffer persistence in Amplify JS (#7115)

* chore: Add callout on Analytics buffer persistence in Amplify JS.

* PR feedback.

* Custom subscription docs to Gen 2 (#7120)

* Add playsInline to videos (#7125)

* autoSignIn position correction in v6 migration docs (#7059)

* fix(next-release/main): update home page h1 and code block font size (#7117) (#7126)

* update font sizes

* add text-size-adjust

* add webkit prefix, add comment

* update text-size-adjust fix

---------

Co-authored-by: Tim Nguyen <[email protected]>

* remove parenthesis from "Amplify (Gen 2)" (#7113)

* change "NPM" to "npm" (#7112)

* remove explicit ".js" extension from gen2 resource imports (#7134)

* remove leading slash from storage access paths (#7116)

* remove unnecessary "Angular" mention in auth getting started (#7139)

Removed 'Angular' from the app description. It is not necessarily an angular app.

* Gen 2 Quickstart: Fix amplify console link (#7141)

* fix amplify console link

* fix text from AWS Console to Amplify Console

* updated alt text for Amplify console

* Update src/fragments/gen2/quickstart/deploy-and-host.mdx

Co-authored-by: Scott Rees <[email protected]>

* Update src/pages/gen2/deploy-and-host/fullstack-branching/branch-deployments/index.mdx

Co-authored-by: Scott Rees <[email protected]>

---------

Co-authored-by: Scott Rees <[email protected]>

* Add Favicon and apple-touch icons to root (#7137)

* add 96x96 favicons

* add favicon and apple-touch to root

* updated icons

---------

Co-authored-by: Jacob Logan <[email protected]>

* docs(migration): fixes mislabeling notification enable snippet (#7135)

the v5 snippet was labeled as v6 and the v6 was labeled as v5

Co-authored-by: derrik.fleming <[email protected]>

* edits to custom business logic (#7129)

* remove console.log (#7147)

* fix: copied code no longer includes markdown comments (#7146)

* fix: copied code no longer includes markdown comments

* minor cleanup

* splite prepareCopyText to it's own export for easier testing

* fix MDXCode mock

* chore(react-native): Add callouts for dropped Expo Go support (#7160)

* Update index.mdx (#7165)

* Update github link to maplibre repo (#7162)

* Gen2 storage docs web (#7163)

* add storage docs

* add transfer acceleration documentation

* fix spelling

* Update src/pages/[platform]/build-a-backend/storage/authorization/index.mdx

Co-authored-by: Tim Nguyen <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/define-storage/index.mdx

Co-authored-by: Tim Nguyen <[email protected]>

* fix links and add cors policy callout

* Update src/pages/[platform]/build-a-backend/storage/download-files/download-data/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/download-files/download-data/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/authorization/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/authorization/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/authorization/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/define-storage/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/authorization/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/authorization/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/authorization/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/authorization/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/define-storage/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/authorization/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/download-files/download-data/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/extend-with-cdk/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/extend-with-cdk/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/download-files/get-url/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/download-files/get-url/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/download-files/get-url/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/download-files/download-data/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/download-files/download-data/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/download-files/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/extend-with-cdk/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/lambda-triggers/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/download-files/index.mdx

Co-authored-by: josef <[email protected]>

* add language in code snippets and change list files sidebar title

* Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/upload-files/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/upload-files/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/upload-files/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx

Co-authored-by: josef <[email protected]>

---------

Co-authored-by: Tim Nguyen <[email protected]>
Co-authored-by: josef <[email protected]>

* Storage docs update (#7171)

* update list files to get files

* update extend S3 resources section

* update options links for upload api

* remove gen2 pages added

* chore: merge `main` into `next-release/main` (#7173)

* Minor edits to Vite + React quickstart (#6926)

* Updates to Vite + React quickstart

* Update src/fragments/gen2/quickstart/build-a-backend.mdx

Co-authored-by: Kevin Old <[email protected]>

* Update build-a-backend.mdx

* Update build-a-backend.mdx

* Update build-a-backend.mdx

---------

Co-authored-by: Kevin Old <[email protected]>

* fix: Fix incorrect auth import path in migration guide. (#6934)

* fix: Update incorrect `updateMFAPreference` parameter in JS v6 migration guide. (#6935)

* Amplify Android Release 2.14.11 (#6933)

* chore: refactor .layout-header into separate component (#6826)

* platform typed as optional

* refactor init

* remove commented code

* remove angry useEffect

* fix typing

* added layoutcontext so mobile menu closes on navigation

* move import

---------

Co-authored-by: katiegoines <[email protected]>

* fix: Nesting of auth cli templates (#6932)

* fix: change config variable name (#6923)

* Guide to support Amplify v2 with AWS Android SDK (#6927)

* Update puppeteer (#6949)

* Update index.mdx (#6950)

* Update CODEOWNERS with correct PM alignment (#6951)

* fix(flutter, js): scope "connect existing cdk" guide to respective platform (#6947)

Co-authored-by: Tim Nguyen <[email protected]>

* Revert "fix(flutter, js): scope "connect existing cdk" guide to respective pl…" (#6955)

This reverts commit 5998b22.

* chore: remove duplicated logic between Layout and LayoutHeader (#6954)

* chore: more layout refactoring

* remove unused prop, alphabetize props

* improve oauth docs (#6961)

* fixed gen 2 getting started guide (#6968)

* Update redirects for deleted hidden pages (#6944)

* Update manual installation to point to @beta tag (#6972)

* include usage for multi-page apps (#6964)

* include usage for multi-page apps

* improve multi-page app docs

* use Hub syntax

* update imports in examples

* chore: Clean up broken Amplify JS API reference links (#6976)

* chore: Clean up broken Amplify JS API reference links.

* Cleaned up language.

* Update build image instructions for Gen 2 (#6978)

* update build image settings for Gen 2

* remove callout and add fragment to vite guide

* chore: add unit test for YoutubeEmbed component (#6983)

* chore: add unit test for YoutubeEmbed component

* add code coverage stats

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for Accordion component (#6981)

* chore: add unit tests for Accordion component

* issue with window properties

* fixed tracking test

* working on animation issue

* accordion tests

* fix testing errors

* added test for closing accordion

* add code coverage stats

---------

Co-authored-by: katiegoines <[email protected]>

* Update index.mdx (#6986)

* Add env variables for algolia (#6957)

* Add algolia env vars to next.config

* Remove extra code string

* fix(data): update REST API docs to document correct error response type (#6989)

* fix(data): update React Native minimum iOS deployment target guidance; add build step to docs (#6970)

* fix(data): update React Native minimum iOS deployment target; add build step to docs

* address PR feedback

* remove deployment target guidance

* add React Native version deployment target callout

* fix unrecognized syntax

* replace callout with accordion

* move 'upgrading' callout

* Clarify behavior of forgetDevice() API regarding device tracking (#6985)

* Clarify behavior of forgetDevice() API regarding device tracking

This commit updates the documentation to clarify that using the forgetDevice() API results in the device being neither remembered nor tracked. Previously, the documentation suggested that forgotten devices might still be tracked, leading to confusion about the API's behavior. The revised wording aligns with the detailed description under the "Forgotten" section, ensuring consistency and eliminating ambiguity about how forgotten devices are handled.

* Clarify behavior of forgetDevice() API regarding device tracking

* Support for enum value listing (#6885)

* Support for enum value listing

* Update src/pages/gen2/build-a-backend/data/data-modeling/add-fields/index.mdx

* CDK updates v2 (#6990)

* Add padding to bottom of nav menu (#6991)

* Adding secondary index to Gen 2 (#6996)

* Adding secondary index docs

* fixed some formatting for custom query fields

* extend config to show addOuput (#6963)

* extend config

* modify wording

* modify example

* improve wording

* Update index.mdx (#6995)

* Update index.mdx

* add guest access support to docs

* chore: add unit tests for NextPrevious component (#7003)

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for LinkCards and LinkCard components (#7006)

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for GetStartedPopover component (#7005)

Co-authored-by: katiegoines <[email protected]>

* fix: [Storage] Configure Access (#6948)

Co-authored-by: Tim Nguyen <[email protected]>

* fix(Swift): update data use policy info's tracking to false (#6938)

* fix(Swift): update data use policy info's tracking to false

* Update data-information.mdx

* chore: add callouts and troubleshooting guide for configuration (#6967)

* fix: resolve in-content broken links (#7011)

* re-platforming

* remove reference to mocking and testing for android & swift

* remove reference to mocking and testing for android & swift

* filtered out reference to optimistic ui for react native

---------

Co-authored-by: katiegoines <[email protected]>

* update gen2 storage and function docs (#7009)

* update gen2 storage and function docs

* add resource access links and example

* revisions, update code snippet titles

* Update CODEOWNERS (#7014)

* updated steps for extending components in code (#6827)

Co-authored-by: Aditya Shahani <[email protected]>

* Custom business logic support as of March @beta (#7019)

* Enhanced custom business logic DX

* addressed tim's comments

* Added custom subscription configuration worfklow

* removed in-development areas

* added titles

* added links for deep dive material

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <[email protected]>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <[email protected]>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

* added client method for clarity.

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <[email protected]>

* Apply suggestions from code review

Co-authored-by: josef <[email protected]>

---------

Co-authored-by: josef <[email protected]>
Co-authored-by: Kethan sai <[email protected]>

* add storage trigger docs (#7020)

* storage trigger docs

* Apply suggestions from code review

Co-authored-by: josef <[email protected]>

* add storage access actions

---------

Co-authored-by: josef <[email protected]>

* update link checker to wait for each call to complete before making t… (#6993)

* update link checker to wait for each call to complete before making the next and remove # from urls being checked

* update logging to show how many links found on each page

* Update tasks/link-checker.js

---------

Co-authored-by: Jacob Logan <[email protected]>
Co-authored-by: katiegoines <[email protected]>
Co-authored-by: Scott Rees <[email protected]>

* custom examples (#6979)

* custom examples

* fix: broken link, missing / at start (#7026)

Co-authored-by: katiegoines <[email protected]>

* validate and fix code snippets in Data section (#6975)

* Update sandbox --dir-to-watch description (#7031)

* Update index.mdx (#7035)

* Fix link (#7028)

* add docs to auth resource access pattern (#7032)

* fix: type platform as optional in Breadcrumbs component & add unit tests (#6912)

* platform typed as optional

* chore: add unit tests for Breadcrumbs

* testing to include platform optional

* fix: type platform as optional

* add tests for override values

---------

Co-authored-by: katiegoines <[email protected]>

* fix: proper variable naming conventions for storage (#7033)

fix:  proper variable naming conventions for storage

* remove explicit file extension from gen2 imports (#6946)

Co-authored-by: Tim Nguyen <[email protected]>

* fix: Update diff code blocks to TypeScript with code highlights (#6905)

* add docs on granting defineFunction access to defineData (#7029)

* standardize Gen 2 wording (#7036)

* Update index.mdx (#6906)

* Modify_Amplify_resources (#7018)

* fix code snippets on read data page

* code snippet updates

* updated the code snippets

* updated code snippets.

* custom business page rollback

* Update maplibre links (#7040)

* chore: add unit tests for PlatformNavigator (#6980)

* chore: add unit tests for PlatformNavigator

* add code coverage

* simplify

* simplify

---------

Co-authored-by: katiegoines <[email protected]>

* Update links to expo docs (#7044)

* Update links to expo docs

* Update src/pages/[platform]/prev/build-a-backend/auth/add-social-provider/index.mdx

Co-authored-by: josef <[email protected]>

* Update src/pages/[platform]/prev/build-a-backend/auth/add-social-provider/index.mdx

Co-authored-by: josef <[email protected]>

---------

Co-authored-by: josef <[email protected]>

* chore: add unit tests for InternalLinkButton (#7000)

Co-authored-by: katiegoines <[email protected]>

* chore: add addtl unit test for Block component (#6982)

* chore: add addtl unit test for Block component

* add code coverage stats

* remove superfluous Block component

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for TOC (#6984)

* chore: add unit tests for TOC

* add code coverage

* hardcode expected hash

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for ExternalLink (#6915)

* chore: add unit tests for ExternalLink

* fixing tracking test

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for ExternalLinkButton (#6914)

* chore: add unit tests for ExternalLinkButton

* Update ExternalLinkButton.test.tsx

triggering checks

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for Footer component (#6999)

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for MigrationAlert component (#7004)

* chore: add unit tests for MigrationAlert component

* chore: add unit tests for MigrationAlert component

---------

Co-authored-by: katiegoines <[email protected]>

* chore: add unit test for Overview component (#7002)

Co-authored-by: katiegoines <[email protected]>

* chore: upgrade docsearch/react to 3.6 (#7046)

* added utility type content (#7047)

* chore: add unit tests for PageLastUpdated (#7001)

Co-authored-by: katiegoines <[email protected]>

* chore: add unit tests for Commands and Columns (#6916)

* chore: add unit test for CLICommands

* chore: add unit test for Columns

* Update Command.test.tsx

triggering checks

---------

Co-authored-by: katiegoines <[email protected]>

* Update resolution for follow-redirects (#7055)

* Update relative urls (#7048)

* Update relative urls

* Update url

* Updating link checker (#7052)

* Updating link checker to account for duplicate urls from different pages and link text

* Update slack formatting

* Remove console.log

* Add comments to function

* Remove extra console.logs()

* chore: update redirects list (#6969)

* update redirects

* updated redirects

---------

Co-authored-by: katiegoines <[email protected]>

* remove allowlist role names for appsync console access page (#7081)

* Add JavaScript resolver code sample to Gen 1 (#7087)

* fix(JS): Update v5 JS libraries installation guides. (#7090)

* fix(v5): update aws-amplify v5 dependency

* chore: remove extra '0' number from versions

* chore: remove vue2 block

* chore: update version reference

* Cbonif/field-level-auth-support-for-sql (#7091)

* chore(gen2-data): update .secondaryIndexes example to match the latest interface (#7095)

* update setup auth client example with correct props (#7106)

* update auth with correct props

* Change generated function env package name (#7096)

* Update typo in url for localhost (#7110)

* update next config to use a static build Id (#7102)

Co-authored-by: Jacob Logan <[email protected]>

* chore: Add callout on Analytics buffer persistence in Amplify JS (#7115)

* chore: Add callout on Analytics buffer persistence in Amplify JS.

* PR feedback.

* Custom subscription docs to Gen 2 (#7120)

* Add playsInline to videos (#7125)

* autoSignIn position correction in v6 migration docs (#7059)

* fix(next-release/main): update home page h1 and code block font size (#7117) (#7126)

* update font sizes

* add text-size-adjust

* add webkit prefix, add comment

* update text-size-adjust fix

---------

Co-authored-by: Tim Nguyen <[email protected]>

* remove parenthesis from "Amplify (Gen 2)" (#7113)

* change "NPM" to "npm" (#7112)

* remove explicit ".js" extension from gen2 resource imports (#7134)

* remove leading slash from storage access paths (#7116)

* remove unnecessary "Angular" mention in auth getting started (#7139)

Removed 'Angular' from the app description. It is not necessarily an angular app.

* Gen 2 Quickstart: Fix amplify console link (#7141)

* fix amplify console link

* fix text from AWS Console to Amplify Console

* updated alt text for Amplify console

* Update src/fragments/gen2/quickstart/deploy-and-host.mdx

Co-authored-by: Scott Rees <[email protected]>

* Update src/pages/gen2/deploy-and-host/fullstack-branching/branch-deployments/index.mdx

Co-authored-by: Scott Rees <[email protected]>

---------

Co-authored-by: Scott Rees <[email protected]>

* Add Favicon and apple-touch icons to root (#7137)

* add 96x96 favicons

* add favicon and apple-touch to root

* updated icons

---------

Co-authored-by: Jacob Logan <[email protected]>

* docs(migration): fixes mislabeling notification enable snippet (#7135)

the v5 snippet was labeled as v6 and the v6 was labeled as v5

Co-authored-by: derrik.fleming <[email protected]>

* edits to custom business logic (#7129)

* remove console.log (#7147)

* fix: copied code no longer includes markdown comments (#7146)

* fix: copied code no longer includes markdown comments

* minor cleanup

* splite prepareCopyText to it's own export for easier testing

* fix MDXCode mock

* chore(react-native): Add callouts for dropped Expo Go support (#7160)

* Update index.mdx (#7165)

* Update github link to maplibre repo (#7162)

* remove gen2 pages added

---------

Co-authored-by: Jim Eagan <[email protected]>
Co-authored-by: Kevin Old <[email protected]>
Co-authored-by: Jim Blanchard <[email protected]>
Co-authored-by: Ankit Shah <[email protected]>
Co-authored-by: katiegoines <[email protected]>
Co-authored-by: Dan Kiuna <[email protected]>
Co-authored-by: Kihara, Takuya <[email protected]>
Co-authored-by: Tyler Roach <[email protected]>
Co-authored-by: Tim Nguyen <[email protected]>
Co-authored-by: Rene Brandel <[email protected]>
Co-authored-by: Elijah Quartey <[email protected]>
Co-authored-by: Heather Buchel <[email protected]>
Co-authored-by: John Corser <[email protected]>
Co-authored-by: Heather Pundt <[email protected]>
Co-authored-by: Nikhil Swaminathan <[email protected]>
Co-authored-by: Jay Raval <[email protected]>
Co-authored-by: David McAfee <[email protected]>
Co-authored-by: Kethan sai <[email protected]>
Co-authored-by: Michael Law <[email protected]>
Co-authored-by: erinleigh90 <[email protected]>
Co-authored-by: Edward Foyle <[email protected]>
Co-authored-by: Adi <[email protected]>
Co-authored-by: Aditya Shahani <[email protected]>
Co-authored-by: josef <[email protected]>
Co-authored-by: jacoblogan <[email protected]>
Co-authored-by: Jacob Logan <[email protected]>
Co-authored-by: Scott Rees <[email protected]>
Co-authored-by: Chris Bonifacio <[email protected]>
Co-authored-by: Roshane Pascual <[email protected]>
Co-authored-by: Charles Shin <[email protected]>
Co-authored-by: Ujjwol Shrestha <[email protected]>
Co-authored-by: Gen Tamura <[email protected]>
Co-authored-by: dwittle <[email protected]>
Co-authored-by: Anil Maktala <[email protected]>
Co-authored-by: israx <[email protected]>
Co-authored-by: Hui Zhao <[email protected]>
Co-authored-by: Nairi Areg <[email protected]>
Co-authored-by: spivakov83 <[email protected]>
Co-authored-by: Harshita Daddala <[email protected]>
Co-authored-by: derrik <[email protected]>
Co-authored-by: derrik.fleming <[email protected]>
Co-authored-by: Chris F <[email protected]>

---------

Co-authored-by: Jim Eagan <[email protected]>
Co-authored-by: Kevin Old <[email protected]>
Co-authored-by: Jim Blanchard <[email protected]>
Co-authored-by: Ankit Shah <[email protected]>
Co-authored-by: katiegoines <[email protected]>
Co-authored-by: Dan Kiuna <[email protected]>
Co-authored-by: Kihara, Takuya <[email protected]>
Co-authored-by: Tyler Roach <[email protected]>
Co-authored-by: Tim Nguyen <[email protected]>
Co-authored-by: Rene Brandel <[email protected]>
Co-authored-by: Elijah Quartey <[email protected]>
Co-authored-by: Heather Buchel <[email protected]>
Co-authored-by: John Corser <[email protected]>
Co-authored-by: Heather Pundt <[email protected]>
Co-authored-by: Nikhil Swaminathan <[email protected]>
Co-authored-by: Jay Raval <[email protected]>
Co-authored-by: David McAfee <[email protected]>
Co-authored-by: Kethan sai <[email protected]>
Co-authored-by: Michael Law <[email protected]>
Co-authored-by: erinleigh90 <[email protected]>
Co-authored-by: Edward Foyle <[email protected]>
Co-authored-by: Adi <[email protected]>
Co-authored-by: Aditya Shahani <[email protected]>
Co-authored-by: josef <[email protected]>
Co-authored-by: jacoblogan <[email protected]>
Co-authored-by: Jacob Logan <[email protected]>
Co-authored-by: Scott Rees <[email protected]>
Co-authored-by: Chris Bonifacio <[email protected]>
Co-authored-by: Roshane Pascual <[email protected]>
Co-authored-by: Charles Shin <[email protected]>
Co-authored-by: Ujjwol Shrestha <[email protected]>
Co-authored-by: Gen Tamura <[email protected]>
Co-authored-by: dwittle <[email protected]>
Co-authored-by: Anil Maktala <[email protected]>
Co-authored-by: israx <[email protected]>
Co-authored-by: Hui Zhao <[email protected]>
Co-authored-by: Nairi Areg <[email protected]>
Co-authored-by: spivakov83 <[email protected]>
Co-authored-by: Harshita Daddala <[email protected]>
Co-authored-by: derrik <[email protected]>
Co-authored-by: derrik.fleming <[email protected]>
Co-authored-by: Chris F <[email protected]>
  • Loading branch information
Show file tree
Hide file tree
Showing 24 changed files with 1,406 additions and 315 deletions.
Binary file added public/images/gen2/storage/copy-to.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/gen2/storage/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/gen2/storage/drag-and-drop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/gen2/storage/rename-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 38 additions & 1 deletion src/directory/directory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,44 @@ export const directory = {
]
},
{
path: 'src/pages/[platform]/build-a-backend/storage/index.mdx'
path: 'src/pages/[platform]/build-a-backend/storage/index.mdx',
children: [
{
path: 'src/pages/[platform]/build-a-backend/storage/define-storage/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/storage/authorization/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/storage/upload-files/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/storage/download-files/index.mdx',
children: [
{
path: 'src/pages/[platform]/build-a-backend/storage/download-files/get-url/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/storage/download-files/download-data/index.mdx'
}
]
},
{
path: 'src/pages/[platform]/build-a-backend/storage/get-files/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/storage/remove-files/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/storage/lambda-triggers/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/storage/extend-s3-resources/index.mdx'
}
]
},
{
path: 'src/pages/[platform]/build-a-backend/functions/index.mdx',
Expand Down
2 changes: 1 addition & 1 deletion src/fragments/lib-v1/geo/android/maps/20_display_map.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ mapView.getStyle { map, style ->

### MapLibreView configuration parameters

The `MapLibreView` has several configuration parameters that are not present in the official guides yet. For a complete list, refer to the [source xml file](https://github.com/maplibre/maplibre-gl-native/blob/main/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml).
The `MapLibreView` has several configuration parameters that are not present in the official guides yet. For a complete list, refer to the [source xml file](https://github.com/maplibre/maplibre-gl-native/blob/main/platform/android/MapLibreAndroid/src/main/res/values/attrs.xml).

Also, check the [official MapView API reference](https://docs.maptiler.com/maplibre-gl-native-android/com.mapbox.mapboxsdk.maps/#mapview) for the available public API documentation.

Expand Down
2 changes: 1 addition & 1 deletion src/fragments/lib/geo/android/maps/20_display_map.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ mapView.getStyle { map, style ->

### MapLibreView configuration parameters

The `MapLibreView` has several configuration parameters that are not present in the official guides yet. For a complete list, refer to the [source xml file](https://github.com/maplibre/maplibre-gl-native/blob/main/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml).
The `MapLibreView` has several configuration parameters that are not present in the official guides yet. For a complete list, refer to the [source xml file](https://github.com/maplibre/maplibre-gl-native/blob/main/platform/android/MapLibreAndroid/src/main/res/values/attrs.xml).

Also, check the [official MapView API reference](https://docs.maptiler.com/maplibre-gl-native-android/com.mapbox.mapboxsdk.maps/#mapview) for the available public API documentation.

Expand Down
2 changes: 1 addition & 1 deletion src/fragments/lib/troubleshooting/common/upgrading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Per the [Expo docs](https://docs.expo.dev/workflow/customizing/):

> The Expo Go app is a great tool to get started. It exists to help developers quickly get projects off the ground, experiment with ideas (such as on Snack), and share their work with minimal friction. Expo Go makes this possible by including a feature-rich native runtime made up of every module in the Expo SDK, so all you need to do to use a module is install the package and reload your app. <br/><br/> The tradeoff is that Expo Go does not allow you to add custom native code. You can only use native modules built into the Expo SDK. Many great libraries are available outside of the Expo SDK, and you may even want to build your native library. You can leverage these libraries with development builds or using prebuild to generate native projects, or both. You can also continue using EAS Build to release your app as no changes are required.
A key part of Amplify's React Native strategy going forward is to reduce our reliance on third-party native modules. While third-party native modules are a mainstay of the React Native ecosystem, we believe the flexibility of building more native modules tailored to the specific needs of our customers will allow us to most quickly deliver value to them in the long run. As a result of now requiring native modules not available through the Expo SDK, Expo Go is not supported in v6 but you should be able to use Expo.
A key part of Amplify's React Native strategy going forward is to reduce our reliance on third-party native modules. While third-party native modules are a mainstay of the React Native ecosystem, we believe the flexibility of building more native modules tailored to the specific needs of our customers will allow us to most quickly deliver value to them in the long run. As a result of now requiring native modules not available through the Expo SDK, Expo Go is not supported in v6 but you should still be able to use Expo.

</InlineFilter>

Expand Down
8 changes: 7 additions & 1 deletion src/fragments/start/getting-started/reactnative/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ To get started, initialize a new React Native project.
<BlockSwitcher>
<Block name="Expo CLI">

<Callout>

Amplify now requires native modules not available through the Expo SDK. As a result, Expo Go is no longer supported but you should still be able to use Expo. [Learn more about dropping support for Expo Go in Amplify v6](/gen1/react-native/build-a-backend/troubleshooting/migrate-from-javascript-v5-to-v6/#dropping-support-for-expo-go).

</Callout>

Create a new app with the following command:

```sh
Expand All @@ -20,7 +26,7 @@ import rnVersionCallout from '/src/fragments/common/react-native-version-deploym
Install the necessary dependencies by running the following command:

```sh
npm install aws-amplify @aws-amplify/react-native @aws-amplify/rtn-web-browser @react-native-community/netinfo @react-native-async-storage/async-storage react-native-get-random-values
npm install aws-amplify @aws-amplify/react-native @react-native-community/netinfo @react-native-async-storage/async-storage react-native-get-random-values
```

Start the app with the following command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const backend = defineBackend({

const dataResources = backend.data.resources;

Object.values(dataResources.amplifyDynamoDbTables).forEach((table) => {
Object.values(dataResources.cfnResources.amplifyDynamoDbTables).forEach((table) => {
table.pointInTimeRecoveryEnabled = true;
});
```
Expand Down Expand Up @@ -80,7 +80,7 @@ const backend = defineBackend({

const dataResources = backend.data.resources;

dataResources.amplifyDynamoDbTables["Todo"].timeToLiveAttribute = {
dataResources.cfnResources.amplifyDynamoDbTables["Todo"].timeToLiveAttribute = {
attributeName: "ttl",
enabled: true,
};
Expand All @@ -100,7 +100,7 @@ const backend = defineBackend({
});
const dataResources = backend.data.resources;

dataResources.amplifyDynamoDbTables['Todo'].billingMode = BillingMode.PAY_PER_REQUEST;
dataResources.cfnResources.amplifyDynamoDbTables['Todo'].billingMode = BillingMode.PAY_PER_REQUEST;
```

### Example - Configure provisioned throughput for a DynamoDB table
Expand All @@ -117,7 +117,7 @@ const backend = defineBackend({

const dataResources = backend.data.resources;

dataResources.amplifyDynamoDbTables["Todo"].provisionedThroughput = {
dataResources.cfnResources.amplifyDynamoDbTables["Todo"].provisionedThroughput = {
readCapacityUnits: 5,
writeCapacityUnits: 5,
};
Expand All @@ -137,5 +137,5 @@ const backend = defineBackend({

const dataResources = backend.data.resources;

dataResources.amplifyDynamoDbTables['Todo'].pointInTimeRecoveryEnabled = true;
dataResources.cfnResources.amplifyDynamoDbTables['Todo'].pointInTimeRecoveryEnabled = true;
```
225 changes: 225 additions & 0 deletions src/pages/[platform]/build-a-backend/storage/authorization/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
import { getCustomStaticPath } from '@/utils/getCustomStaticPath';

export const meta = {
title: 'Customize authorization rules',
description: 'Define Authorization rules granularly for paths in the Storage bucket',
platforms: [
'angular',
'javascript',
'nextjs',
'react',
'vue'
]
};

export const getStaticPaths = async () => {
return getCustomStaticPath(meta.platforms);
};

export function getStaticProps(context) {
return {
props: {
meta
}
};
}

Customize authorization for your storage bucket by defining access individually to file prefixes for Guest, Authenticated, and group users. Access can also be defined for functions that require access to the storage bucket.

Refer to the following examples to understand how you can further customize authorization against different user types.

<Callout>

**Note:** Prefixes cannot have a '/' at the beginning of the string.

</Callout>

<BlockSwitcher>
<Block name="Guest Users">
To grant all guest (i.e. not signed in) users of your application read access to files that start with `foo/*`, use the following `access` values.

Note that your backend must include `defineAuth` in order to use this access rule.

```ts title="amplify/storage/resource.ts"
export const storage = defineStorage({
name: 'myProjectFiles',
access: (allow) => ({
'foo/*': [
allow.guest.to(['read']) // additional actions such as "write" and "delete" can be specified depending on your use case
]
})
});
```
</Block>
<Block name="Authenticated Users">
To grant all authenticated (i.e. signed in) users of your application read access to files that start with `foo/*`, use the following `access` configuration.

Note that your backend must include `defineAuth` in order to use this access rule.

```ts title="amplify/storage/resource.ts"
export const storage = defineStorage({
name: 'myProjectFiles',
access: (allow) => ({
'foo/*': [
allow.authenticated.to(['read']) // additional actions such as "write" and "delete" can be specified depending on your use case
]
})
});
```
</Block>
<Block name="User Groups">
If you have configured user groups in `defineAuth`, you can scope storage access to specific groups. Suppose you have a `defineAuth` config with `admin` and `auditor` groups.

```ts title="amplify/auth/resource.ts"
import { defineAuth } from '@aws-amplify/backend';

export const auth = defineAuth({
loginWith: {
email: true
},
groups: ['admin', 'auditor']
});
```
With the following `access` definition, you can configure permissions such that auditors have readonly permissions to `foo/*` while admin has full permissions.

```ts title="amplify/storage/resource.ts"
export const storage = defineStorage({
name: 'myProjectFiles',
access: (allow) => ({
'foo/*': [
allow.group('auditor').to(['read']),
allow.group('admin').to(['read', 'write', 'delete'])
]
})
});
```
</Block>
<Block name="Owners">
Access to files with a certain prefix can be scoped down to individual authenticated users. To do this, a placeholder token is used in the storage path which will be substituted with the user identity when uploading or downloading files. The access rule will only allow a user to upload or download files with their specific identity string.

Note that your backend must include `defineAuth` in order to use this access rule.

The following policy would allow authenticated users full access to files with a prefix that matches their identity id.

```ts title="amplify/storage/resource.ts"
export const storage = defineStorage({
name: 'myProjectFiles',
access: (allow) => ({
'foo/{entity_id}/*': [
// {entity_id} is the token that is replaced with the user identity id
allow.entity('identity').to(['read', 'write', 'delete'])
]
})
});
```
A user with identity id "123" would be able to perform read/write/delete operations on files within `foo/123/*` and would not be able to perform actions on files with any other prefix.

Likewise, a user with identity ID "ABC" would be able to perform read/write/delete operation on files only within `foo/ABC/*`. In this way, each user can be granted access to a "private storage location" that is not accessible to any other user.

It may be desireable for a file owner to be able to write and delete files in their private location but allow anyone to read from that location. For example, profile pictures should be readable by anyone, but only the owner can modify them. This use case can be configured with the following definition.

```ts title="amplify/storage/resource.ts"
export const storage = defineStorage({
name: 'myProjectFiles',
access: (allow) => ({
'foo/{entity_id}/*': [
allow.entity('identity').to(['read', 'write', 'delete']),
allow.guest.to(['read']),
allow.authenticated.to(['read'])
]
})
});
```
When a non-ID-based rule is applied to a path with the `{entity_id}` token, the token is replaced with a wildcard (`*`). This means that the access will apply to files uploaded by _any_ user. In the above policy, write and delete is scoped to just the owner, but read is allowed for guest and authenticated users for any file within `foo/*/*`.
</Block>
<Block name="Functions">
In addition to granting application users access to storage files, you may also want to grant a backend function access to storage files. This could be used to enable a use case like resizing images, or automatically deleting old files. The following configuration is used to define function access.

```ts title="amplify/storage/resource.ts"
import { defineStorage, defineFunction } from '@aws-amplify/backend';

const demoFunction = defineFunction({});

export const storage = defineStorage({
name: 'myProjectFiles',
access: (allow) => ({
'foo/*': [allow.resource(demoFunction).to(['read', 'write', 'delete'])]
})
});
```

This would grant the function `demoFunction` the ability to read write and delete files within `foo/*`.

When a function is granted access to storage, it also receives an environment variable that contains the name of the S3 bucket configured by storage. This environment variable can be used in the function to make SDK calls to the storage bucket. The environment variable is named `<storage-name>_BUCKET_NAME`. In the above example, it would be named `myProjectFiles_BUCKET_NAME`.

[Learn more about function resource access environment variables](/[platform]/build-a-backend/functions/#resource-access)
</Block>
</BlockSwitcher>

### Access definition limitations

There are some limitations on the types of prefixes that can be specified in the storage access definition.

1. All paths are treated as prefixes from the storage root. As such all paths must end with `/*` to make this explicit.
2. Only one level of nesting is allowed. For example, you can define access controls on `foo/*` and `foo/bar/*` but not on `foo/bar/baz/*` because that path has 2 other prefixes.
3. Wildcards cannot conflict with the `{entity_id}` token. For example, you cannot have both `foo/*` and `foo/{entity_id}/*` defined because the wildcard in the first path conflicts with the `{entity_id}` token in the second path.
4. A path cannot be a prefix of another path with an `{entity_id}` token. For example `foo/*` and `foo/bar/{entity_id}/*` is not allowed.

### Prefix behavior

When one path is a subpath of another, the permissions on the subpath _always override_ the permissions from the parent path. Permissions are not "inherited" from a parent path. Consider the following access definition example.

```ts
export const storage = defineStorage({
name: 'myProjectFiles',
access: (allow) => ({
'foo/*': [allow.authenticated.to(['read', 'write', 'delete'])],
'foo/bar/*': [allow.guest.to(['read'])],
'foo/baz/*': [allow.authenticated.to(['read'])],
'other/*': [
allow.guest.to(['read']),
allow.authenticated.to(['read', 'write'])
]
})
});
```

The access control matrix for this configuration is

| | foo/\* | foo/bar/\* | foo/baz/\* | other/\* |
| --- | --- | --- | --- | --- |
| **Authenticated Users** | read, write, delete | NONE | read | read, write |
| **Guest users** | NONE | read | NONE | read |

Authenticated users have access to read, write, and delete everything under `foo/*` EXCEPT `foo/bar/*` and `foo/baz/*`. For those subpaths, the scoped down access overrides the access granted on the parent `foo/*`

### Available actions

When you configure access to a particular storage prefix, you can scope the access to one or more CRUDL actions.

| Access | Corresponding Library APIs |
|---|----|
|`read`|`getUrl`, `downloadData`, `list`, and `getProperties`|
|`write`|`uploadData`, `copy`|
|`delete`|`remove`|

### For Gen 1 public, protected, and private access pattern

To configure `defineStorage` in Amplify Gen 2 to behave the same way as the storage category in Gen 1, the following definition can be used.

```ts title="amplify/storage/resource.ts"
export const storage = defineStorage({
name: 'myProjectFiles',
access: (allow) => ({
'public/*': [
allow.guest.to(['read'])
allow.authenticated.to(['read', 'write', 'delete']),
],
'protected/{entity_id}/*': [
allow.authenticated.to(['read']),
allow.entity('identity').to(['read', 'write', 'delete'])
],
'private/{entity_id}/*': [allow.entity('identity').to(['read', 'write', 'delete'])]
})
});
```
Loading

0 comments on commit 011adb5

Please sign in to comment.