From bd2f45609909ac9099cf69865e4da7253fdaefd8 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 20 May 2024 13:27:05 -0700 Subject: [PATCH] chore: add move back into vPrevious docs --- src/directory/directory.mjs | 3 +++ src/fragments/lib-v1/storage/flutter/move.mdx | 26 +++++++++++++++++++ .../build-a-backend/storage/move/index.mdx | 26 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 src/fragments/lib-v1/storage/flutter/move.mdx create mode 100644 src/pages/gen1/[platform]/prev/build-a-backend/storage/move/index.mdx diff --git a/src/directory/directory.mjs b/src/directory/directory.mjs index d2c9274d31f..894a6dbb0b9 100644 --- a/src/directory/directory.mjs +++ b/src/directory/directory.mjs @@ -2315,6 +2315,9 @@ export const directory = { { path: 'src/pages/gen1/[platform]/prev/build-a-backend/storage/copy/index.mdx' }, + { + path: 'src/pages/gen1/[platform]/prev/build-a-backend/storage/move/index.mdx' + }, { path: 'src/pages/gen1/[platform]/prev/build-a-backend/storage/remove/index.mdx' }, diff --git a/src/fragments/lib-v1/storage/flutter/move.mdx b/src/fragments/lib-v1/storage/flutter/move.mdx new file mode 100644 index 00000000000..a2b3572df3e --- /dev/null +++ b/src/fragments/lib-v1/storage/flutter/move.mdx @@ -0,0 +1,26 @@ +You can move an existing file to a different folder location in your S3 bucket. The user initiating the move operation must have read and write permission on both the source file and destination file. + +```dart +import 'package:amplify_flutter/amplify_flutter.dart'; +Future movePrivateFile({ + required String sourceKey, + required String destinationKey, +}) async { + try { + final result = await Amplify.Storage.move( + source: StorageItemWithAccessLevel( + storageItem: StorageItem(key: sourceKey), + accessLevel: StorageAccessLevel.private, + ), + destination: StorageItemWithAccessLevel( + storageItem: StorageItem(key: destinationKey), + accessLevel: StorageAccessLevel.private, + ), + ).result; + safePrint('Moved file to: ${result.movedItem.key}'); + } on StorageException catch (e) { + safePrint('Something went wrong moving the file: ${e.message}'); + rethrow; + } +} +``` \ No newline at end of file diff --git a/src/pages/gen1/[platform]/prev/build-a-backend/storage/move/index.mdx b/src/pages/gen1/[platform]/prev/build-a-backend/storage/move/index.mdx new file mode 100644 index 00000000000..a3c648bc358 --- /dev/null +++ b/src/pages/gen1/[platform]/prev/build-a-backend/storage/move/index.mdx @@ -0,0 +1,26 @@ +import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; + +export const meta = { + title: 'Move files', + description: "Learn more about how to move files using Amplify's storage category.", + platforms: ['flutter'] +}; + +export const getStaticPaths = async () => { + return getCustomStaticPath(meta.platforms); +}; + +export function getStaticProps(context) { + return { + props: { + platform: context.params.platform, + meta + } + }; +} + + + +import flutter0 from '/src/fragments/lib-v1/storage/flutter/move.mdx'; + +