public boolean doesObjectExist(String bucket, String objectName) { return amazonS3.doesObjectExist(bucket, objectName); }
@Override public boolean doesRemoteFileExist(Path remotePath) throws BackupRestoreException { boolean exists = false; try { exists = s3Client.doesObjectExist(getShard(), remotePath.toString()); } catch (AmazonServiceException ase) { // Amazon S3 rejected request throw new BackupRestoreException( "AmazonServiceException while checking existence of object: " + remotePath + ". Error: " + ase.getMessage()); } catch (AmazonClientException ace) { // No point throwing this exception up. logger.error( "AmazonClientException: client encountered a serious internal problem while trying to communicate with S3", ace.getMessage()); } return exists; }
public boolean doesObjectExist(String bucket, String objectName) { return amazonS3.doesObjectExist(bucket, objectName); }
@Override public boolean existFile(String id) { return s3.doesObjectExist(bucketName,id); }
/** * Checks if the given file exists on S3 Bucket * * @return True on existing file, false on not existing */ public static boolean doesFileExists(String bucket, String key) { return getS3Client().doesObjectExist(bucket, key); }
@Override public boolean checkFileExists(String filePath) throws IOException { if (filePath == null) { throw new IllegalArgumentException("Name of a file can not be null."); } try { return getS3Client().doesObjectExist(rootFolder, filePath); } catch (AmazonClientException e) { throw new IOException(e); } }
@Override public boolean exists() { String destinationKey = null; if (dvObject instanceof DataFile) { destinationKey = key; } else { logger.warning("Trying to check if a path exists is only supported for a data file."); } try { return s3.doesObjectExist(bucketName, destinationKey); } catch (AmazonClientException ase) { logger.warning("Caught an AmazonClientException in S3AccessIO.exists(): " + ase.getMessage()); return false; } }
@Override public boolean exists( FileDescriptor descriptor ) { try { return amazonS3Client.doesObjectExist( bucketName, buildAwsPath( descriptor ) ); } catch ( AmazonServiceException e ) { LOG.error( "Unable to check file existance {} on Amazon", descriptor, e ); throw new FileStorageException( e ); } }
@Override public boolean isAuxObjectCached(String auxItemTag) throws IOException { open(); logger.fine("Inside isAuxObjectCached"); String destinationKey = getDestinationKey(auxItemTag); try { return s3.doesObjectExist(bucketName, destinationKey); } catch (AmazonClientException ase) { logger.warning("Caught an AmazonClientException in S3AccessIO.isAuxObjectCached: " + ase.getMessage()); throw new IOException("S3AccessIO: Failed to cache auxilary object : " + auxItemTag); } }
private void deleteFile(AmazonS3 s3Client) throws IOException, InterruptedException { // See if the thing that we were given is a file. if (s3Client.doesObjectExist(bucket, path)) { Execution.this.getContext().get(TaskListener.class).getLogger().format("Deleting object at s3://%s/%s%n", bucket, path); s3Client.deleteObject(bucket, path); } } }.start();
@Override public Boolean isArtifactExist(String key) { return amazonS3.doesObjectExist(bucketName, key) || amazonS3.listObjectsV2(bucketName, key).getKeyCount() > 0; } }
@Override public BlobReader getFile(String id) { return s3.doesObjectExist(bucketName,id)? new S3BlobReader(getObject(bucketName,id),id , contentType):null; }
private boolean objectExistsInBucket(final String key) { return getS3Client().doesObjectExist(config.getDeploymentBucket(), key); }
@Override public boolean doesObjectExist(String bucketName, String objectName) throws AmazonServiceException, AmazonServiceException { return call(() -> getDelegate().doesObjectExist(bucketName, objectName)); }
@Override public boolean exists() { return s3.doesObjectExist(s3Object.getBucketName(), s3Object.getKey()); }
@Override public boolean exists() { return s3.doesObjectExist(s3Object.getBucketName(), s3Object.getKey()); }
public boolean fileExist(String fileName, FileType type) { AmazonS3 s3 = getAmazonS3(); return s3.doesObjectExist(getStorageName(), type.getValue() + "/" + fileName); }
@Override FileStream open(final String path) throws IOException { String resolveKey = resolveKey(path); if (!s3.doesObjectExist(bucketName, resolveKey)) { // Throwing a FileNotFoundException is the // default behaviour of other walking services throw new FileNotFoundException(resolveKey); } S3Object c = s3.getObject(bucket, resolveKey); S3ObjectInputStream raw = c.getObjectContent(); long len = c.getObjectMetadata().getContentLength(); return new FileStream(raw, len); }
@Override public InputStream getArtifactStream(String key) { try { if (!amazonS3.doesObjectExist(bucketName, key)) { throw new ResourceNotFoundException("File: " + key + " not found in the remote storage: " + bucketName); } S3Object s3Object = amazonS3.getObject(bucketName, key); return s3Object.getObjectContent(); } catch (AmazonServiceException e) { throw new TestGridRuntimeException("Error occurred in Amazon service", e); } catch (SdkClientException e) { throw new TestGridRuntimeException("Error occurred in SDK client", e); } }
@Override public boolean hasFile(String folder, String name) { testFilePath(folder, name); try { return amazonS3().doesObjectExist(getBucket(), getFullName(folder, name)); } catch (Exception e) { return false; } }