use of com.google.cloud.storage.BlobInfo.Builder in project pratilipi by Pratilipi.
the class BlobAccessorGcsImpl2 method createOrUpdateBlob.
@Override
public BlobEntry createOrUpdateBlob(BlobEntry blobEntry) {
BlobId blobId = BlobId.of(bucketName, blobEntry.getName());
Builder blobInfoBuilder = BlobInfo.newBuilder(blobId);
if (blobEntry.getMimeType() != null)
blobInfoBuilder.setContentType(blobEntry.getMimeType());
if (blobEntry.getCacheControl() != null)
blobInfoBuilder.setCacheControl(blobEntry.getCacheControl());
if (blobEntry.getMetaName() != null) {
Map<String, String> metadata = new HashMap<>();
metadata.put(BlobEntry.META_NAME, blobEntry.getMetaName());
blobInfoBuilder.setMetadata(metadata);
}
return new BlobEntryGcsImpl(gcsService.create(blobInfoBuilder.build(), blobEntry.getData()));
}
Aggregations