-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(storage): Gen2 Storage Download/Upload #2741
feat(storage): Gen2 Storage Download/Upload #2741
Conversation
…pload # Conflicts: # aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/AWSS3StoragePlugin.java # aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/extensions/StorageExceptionExtensions.kt # aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/operation/AWSS3StorageDownloadFileOperation.kt # aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/operation/AWSS3StorageGetPresignedUrlOperation.java # aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/operation/AWSS3StorageListOperation.java # aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/operation/AWSS3StoragePathDownloadFileOperation.kt # aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/operation/AWSS3StorageRemoveOperation.java # aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/operation/AWSS3StorageUploadFileOperation.kt # aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/operation/AWSS3StorageUploadInputStreamOperation.kt # core-kotlin/src/test/java/com/amplifyframework/kotlin/storage/KotlinStorageFacadeTest.kt # core/src/main/java/com/amplifyframework/storage/StoragePath.kt # core/src/main/java/com/amplifyframework/storage/StoragePathValidationException.kt # core/src/main/java/com/amplifyframework/storage/result/StorageUploadFileResult.java
@@ -0,0 +1,271 @@ | |||
/* | |||
* Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to go through and check all my licenses. This one is a copy/paste issue, but I believe my auto license header was disabled and not applied to some of the new files. Will make a note.
Looks like I didn't include upload file/inputstream integration tests on this PR. Will add to follow up |
} | ||
is IdentityIdProvidedStoragePath -> { | ||
val identityId = try { | ||
runBlocking { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this function suspend
and lift this runBlocking
out to where we dispatch to the executors so that it's clear what's happening there.
In the future we will (hopefully 🤞) make the plugin fully coroutine-based and it'll be easier to understand if the borders between concurrency models are as co-located as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will make this change in follow up pr
@@ -38,8 +38,8 @@ import java.util.concurrent.ExecutorService | |||
* An operation to download a file from AWS S3. | |||
*/ | |||
@Deprecated( | |||
"Class should not be public and explicitly cast to. " + | |||
"Internal usages are moving to AWSS3StorageDownloadFileOperationV2" | |||
"Class should not be public and explicitly cast to. Case to StorageDownloadFileOperation." + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*cast
@JvmStatic | ||
fun fromIdentityId(identityIdPathResolver: IdentityIdPathResolver): StoragePath = | ||
IdentityIdProvidedStoragePath(identityIdPathResolver) | ||
} | ||
} | ||
|
||
/** | ||
* StoragePath that was created with the full String path. | ||
*/ | ||
data class StringStoragePath internal constructor(private val path: String) : StoragePath() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these classes be @InternalAmplifyApi
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked on api review and there could be some valid reason to check type that we decided it was valid to expose.
/** | ||
* An operation to upload a file from AWS S3. | ||
*/ | ||
internal class AWSS3StoragePathUploadFileOperation @JvmOverloads internal constructor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need @JvmOverloads
on these operation constructors? Seems like the plugin is always supplying all values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove. This was from copy paste
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove on InputStream operation as well.
General comment: the |
Issue #, if available:
Description of changes:
How did you test these changes?
(Please add a line here how the changes were tested)
Documentation update required?
General Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.