Search in sources :

Example 6 with StorageService

use of com.amplifyframework.storage.s3.service.StorageService in project amplify-android by aws-amplify.

the class AWSS3StoragePlugin method uploadFile.

@NonNull
@Override
public StorageUploadFileOperation<?> uploadFile(@NonNull String key, @NonNull File local, @NonNull StorageUploadFileOptions options, @NonNull Consumer<StorageTransferProgress> onProgress, @NonNull Consumer<StorageUploadFileResult> onSuccess, @NonNull Consumer<StorageException> onError) {
    AWSS3StorageUploadRequest<File> request = new AWSS3StorageUploadRequest<>(key, local, options.getAccessLevel() != null ? options.getAccessLevel() : defaultAccessLevel, options.getTargetIdentityId(), options.getContentType(), options instanceof AWSS3StorageUploadFileOptions ? ((AWSS3StorageUploadFileOptions) options).getServerSideEncryption() : ServerSideEncryption.NONE, options.getMetadata());
    AWSS3StorageUploadFileOperation operation = new AWSS3StorageUploadFileOperation(storageService, cognitoAuthProvider, request, awsS3StoragePluginConfiguration, onProgress, onSuccess, onError);
    operation.start();
    return operation;
}
Also used : AWSS3StorageUploadFileOperation(com.amplifyframework.storage.s3.operation.AWSS3StorageUploadFileOperation) AWSS3StorageUploadRequest(com.amplifyframework.storage.s3.request.AWSS3StorageUploadRequest) File(java.io.File) AWSS3StorageUploadFileOptions(com.amplifyframework.storage.s3.options.AWSS3StorageUploadFileOptions) NonNull(androidx.annotation.NonNull)

Example 7 with StorageService

use of com.amplifyframework.storage.s3.service.StorageService in project amplify-android by aws-amplify.

the class AWSS3StoragePlugin method remove.

@NonNull
@Override
public StorageRemoveOperation<?> remove(@NonNull String key, @NonNull StorageRemoveOptions options, @NonNull Consumer<StorageRemoveResult> onSuccess, @NonNull Consumer<StorageException> onError) {
    AWSS3StorageRemoveRequest request = new AWSS3StorageRemoveRequest(key, options.getAccessLevel() != null ? options.getAccessLevel() : defaultAccessLevel, options.getTargetIdentityId());
    AWSS3StorageRemoveOperation operation = new AWSS3StorageRemoveOperation(storageService, executorService, cognitoAuthProvider, request, awsS3StoragePluginConfiguration, onSuccess, onError);
    operation.start();
    return operation;
}
Also used : AWSS3StorageRemoveRequest(com.amplifyframework.storage.s3.request.AWSS3StorageRemoveRequest) AWSS3StorageRemoveOperation(com.amplifyframework.storage.s3.operation.AWSS3StorageRemoveOperation) NonNull(androidx.annotation.NonNull)

Aggregations

NonNull (androidx.annotation.NonNull)6 AWSS3StorageUploadRequest (com.amplifyframework.storage.s3.request.AWSS3StorageUploadRequest)2 File (java.io.File)2 InputStream (java.io.InputStream)2 ApplicationProvider.getApplicationContext (androidx.test.core.app.ApplicationProvider.getApplicationContext)1 TransferListener (com.amazonaws.mobileconnectors.s3.transferutility.TransferListener)1 TransferObserver (com.amazonaws.mobileconnectors.s3.transferutility.TransferObserver)1 TransferState (com.amazonaws.mobileconnectors.s3.transferutility.TransferState)1 ObjectMetadata (com.amazonaws.services.s3.model.ObjectMetadata)1 AmplifyException (com.amplifyframework.AmplifyException)1 StorageCategory (com.amplifyframework.storage.StorageCategory)1 StorageCategoryConfiguration (com.amplifyframework.storage.StorageCategoryConfiguration)1 StorageException (com.amplifyframework.storage.StorageException)1 StorageItem (com.amplifyframework.storage.StorageItem)1 StorageDownloadFileResult (com.amplifyframework.storage.result.StorageDownloadFileResult)1 StorageGetUrlResult (com.amplifyframework.storage.result.StorageGetUrlResult)1 StorageListResult (com.amplifyframework.storage.result.StorageListResult)1 StorageRemoveResult (com.amplifyframework.storage.result.StorageRemoveResult)1 StorageUploadFileResult (com.amplifyframework.storage.result.StorageUploadFileResult)1 StorageUploadInputStreamResult (com.amplifyframework.storage.result.StorageUploadInputStreamResult)1