@Override protected void upload(String localFilePath, String remoteFilePath) throws Exception { S3Object file = new S3Object(new File(localFilePath)); file.setBucketName(bucket); file.setKey(remoteFilePath); file.setAcl(GSAccessControlList.REST_CANNED_BUCKET_OWNER_FULL_CONTROL); List objectsToUploadAsMultipart = new ArrayList(); objectsToUploadAsMultipart.add(file); mpUtils.uploadObjects(bucket, s3Service, objectsToUploadAsMultipart, null); if (!grantAcl.grantAcl(file)) { throw new RuntimeException("Failed to set Acl"); } } }
public void run() { try { if (signedAclUrl == null) { AccessControlList acl = s3Service.getObjectAcl(bucket, object.getKey()); object.setAcl(acl); result = object; } else { SignedUrlHandler handler = s3Service; AccessControlList acl = handler.getObjectAclWithSignedUrl(signedAclUrl); URL url = new URL(signedAclUrl); object = ServiceUtils.buildObjectFromUrl( url.getHost(), url.getPath(), s3Service.getEndpoint()); object.setAcl(acl); result = object; } } catch (RuntimeException e) { result = e; throw e; } catch (Exception e) { result = e; } }
/** * Event handler for this dialog. */ public void actionPerformed(ActionEvent e) { if ("OK".equals(e.getActionCommand())) { copyActionApproved = true; for (int i = 0; i < destinationObjects.length; i++) { destinationObjects[i].setKey( renameObjectKey(destinationObjects[i].getKey(), i)); if ("Publically Accessible".equals(destinationAclComboBox.getSelectedItem())) { destinationObjects[i].setAcl(AccessControlList.REST_CANNED_PUBLIC_READ); } else if ("Unchanged".equals(destinationAclComboBox.getSelectedItem())) { copyOriginalAccessControlLists = true; } // Apply storage class destinationObjects[i].setStorageClass( (String) destinationStorageClassComboBox.getSelectedItem()); } this.setVisible(false); } else if ("Cancel".equals(e.getActionCommand())) { copyActionApproved = false; this.setVisible(false); } }
public void run() { try { if (signedAclUrl == null) { AccessControlList acl = s3Service.getObjectAcl(bucket, object.getKey()); object.setAcl(acl); result = object; } else { SignedUrlHandler handler = s3Service; AccessControlList acl = handler.getObjectAclWithSignedUrl(signedAclUrl); URL url = new URL(signedAclUrl); object = ServiceUtils.buildObjectFromUrl( url.getHost(), url.getPath(), s3Service.getEndpoint()); object.setAcl(acl); result = object; } } catch (RuntimeException e) { result = e; throw e; } catch (Exception e) { result = e; } }
/** * Event handler for this dialog. */ public void actionPerformed(ActionEvent e) { if ("OK".equals(e.getActionCommand())) { copyActionApproved = true; for (int i = 0; i < destinationObjects.length; i++) { destinationObjects[i].setKey( renameObjectKey(destinationObjects[i].getKey(), i)); if ("Publically Accessible".equals(destinationAclComboBox.getSelectedItem())) { destinationObjects[i].setAcl(AccessControlList.REST_CANNED_PUBLIC_READ); } else if ("Unchanged".equals(destinationAclComboBox.getSelectedItem())) { copyOriginalAccessControlLists = true; } // Apply storage class destinationObjects[i].setStorageClass( (String) destinationStorageClassComboBox.getSelectedItem()); } this.setVisible(false); } else if ("Cancel".equals(e.getActionCommand())) { copyActionApproved = false; this.setVisible(false); } }
selectedObjects[i].setAcl(updatedObjectACL[0]);
public void run() { try { if (signedUrl == null) { if (s3Object == null) { s3Service.putBucketAcl(bucket); } else { s3Service.putObjectAcl(bucket, s3Object); } result = s3Object; } else { SignedUrlHandler handler = s3Service; handler.putObjectAclWithSignedUrl(signedUrl, signedUrlAcl); URL url = new URL(signedUrl); S3Object object = ServiceUtils.buildObjectFromUrl( url.getHost(), url.getPath(), s3Service.getEndpoint()); object.setAcl(signedUrlAcl); result = object; } } catch (RuntimeException e) { result = e; throw e; } catch (Exception e) { result = e; } }
selectedObjects[i].setAcl(updatedObjectACL[0]);
public void run() { try { if (signedUrl == null) { if (s3Object == null) { s3Service.putBucketAcl(bucket); } else { s3Service.putObjectAcl(bucket, s3Object); } result = s3Object; } else { SignedUrlHandler handler = s3Service; handler.putObjectAclWithSignedUrl(signedUrl, signedUrlAcl); URL url = new URL(signedUrl); S3Object object = ServiceUtils.buildObjectFromUrl( url.getHost(), url.getPath(), s3Service.getEndpoint()); object.setAcl(signedUrlAcl); result = object; } } catch (RuntimeException e) { result = e; throw e; } catch (Exception e) { result = e; } }
private void putObject(String bucketName, String path, S3Object object) throws ServiceException { object.setBucketName(bucketName); object.setKey(path); if (!config.getDisableAcl()) { object.setAcl(GSAccessControlList.REST_CANNED_BUCKET_OWNER_FULL_CONTROL); } log.info("Pushing %s.", object); s3Client.putObject(bucketName, object); } }
public void run() { if (retainAcls) { // Retain ACL settings from original objects. if (!s3ServiceMulti.getObjectACLs( currentSelectedBucket, sourceObjects)) { return; } for (int i = 0; i < sourceObjects.length; i++) { destinationObjects[i].setAcl( sourceObjects[i].getAcl()); } } // Copy objects. Metadata is retained, not replaced. s3ServiceMulti.copyObjects(currentBucketName, destinationBucketName, sourceObjectKeys, destinationObjects, false); if (isDeleteAfterCopy) { final S3Object[] sourceObjects = new S3Object[sourceObjectKeys.length]; for (int i = 0; i < sourceObjectKeys.length; i++) { sourceObjects[i] = new S3Object(sourceObjectKeys[i]); } s3ServiceMulti.deleteObjects(currentSelectedBucket, sourceObjects); } if (destinationBucketName.equals(currentBucketName) || isDeleteAfterCopy) { // Refesh object listing for current bucket if the bucket's contents // have changed. listObjects(); } } });
public void run() { if (retainAcls) { // Retain ACL settings from original objects. if (!s3ServiceMulti.getObjectACLs( currentSelectedBucket, sourceObjects)) { return; } for (int i = 0; i < sourceObjects.length; i++) { destinationObjects[i].setAcl( sourceObjects[i].getAcl()); } } // Copy objects. Metadata is retained, not replaced. s3ServiceMulti.copyObjects(currentBucketName, destinationBucketName, sourceObjectKeys, destinationObjects, false); if (isDeleteAfterCopy) { final S3Object[] sourceObjects = new S3Object[sourceObjectKeys.length]; for (int i = 0; i < sourceObjectKeys.length; i++) { sourceObjects[i] = new S3Object(sourceObjectKeys[i]); } s3ServiceMulti.deleteObjects(currentSelectedBucket, sourceObjects); } if (destinationBucketName.equals(currentBucketName) || isDeleteAfterCopy) { // Refesh object listing for current bucket if the bucket's contents // have changed. listObjects(); } } });
credsObject.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ); s3Service.putObject(bucket, credsObject);
credsObject.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ); s3Service.putObject(bucket, credsObject);
object.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ); service.putObject(getBucket(), object);
destinationObjects[i].setAcl( sourceObjects[i].getAcl());
final S3Object target = new S3Object(targetS3Path); if (!config.getDisableAcl()) { target.setAcl(GSAccessControlList.REST_CANNED_BUCKET_OWNER_FULL_CONTROL);
destinationObjects[i].setAcl( sourceObjects[i].getAcl());
@Override public Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { if(source.isFile() || source.isPlaceholder()) { if(null == status.getStorageClass()) { // Keep same storage class status.setStorageClass(new S3StorageClassFeature(session).getClass(source)); } if(Encryption.Algorithm.NONE == status.getEncryption()) { // Keep encryption setting status.setEncryption(new S3EncryptionFeature(session).getEncryption(source)); } if(Acl.EMPTY == status.getAcl()) { // Apply non standard ACL try { status.setAcl(accessControlListFeature.getPermission(source)); } catch(AccessDeniedException | InteroperabilityException e) { log.warn(String.format("Ignore failure %s", e.getDetail())); } } final S3Object destination = new S3WriteFeature(session).getDetails(target, status); destination.setAcl(accessControlListFeature.convert(status.getAcl())); destination.setBucketName(containerService.getContainer(target).getName()); destination.replaceAllMetadata(new HashMap<String, Object>(new S3MetadataFeature(session, accessControlListFeature).getMetadata(source))); final String version = this.copy(source, destination, status); target.attributes().setVersionId(version); } return target; }
log.warn(String.format("Ignore failure %s", e.getDetail())); destination.setAcl(accessControlListFeature.convert(acl)); session.getClient().copyVersionedObject(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file), containerService.getContainer(file).getName(), destination, false);