Skip to content

Commit

Permalink
Actually copy blob permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
unascribed committed Sep 6, 2019
1 parent 93b4c6c commit 9a4cc1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/jortage/s3migrate/S3Migrate.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobAccess;
import org.jclouds.blobstore.domain.PageSet;
import org.jclouds.blobstore.domain.StorageMetadata;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.blobstore.options.PutOptions;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
Expand Down Expand Up @@ -166,14 +169,15 @@ public static void main(String[] args) {
long seconds = 5;
while (true) {
try {
BlobAccess acc = from.getBlobAccess(fromBucketF, sm.getName());
Blob fromBlob = from.getBlob(fromBucketF, sm.getName());
Blob toBlob = to.blobBuilder(sm.getName())
.tier(sm.getTier())
.type(sm.getType())
.userMetadata(sm.getUserMetadata())
.payload(fromBlob.getPayload())
.build();
to.putBlob(toBucketF, toBlob);
to.putBlob(toBucketF, toBlob, new PutOptions().setBlobAccess(acc));
done.addAndGet(1);
addProgress();
break;
Expand Down

0 comments on commit 9a4cc1a

Please sign in to comment.