Would it be possible to add functionality to Blob and Bucket to provide signed URLs?
We were discussing this topic (spring-cloud/spring-cloud-gcp#251) and it looks like the existing instructions on the dev site has users construct that URL themselves.
Hi @ChengyuanZhao -
The client library does support signed URLs for Blobs, here is a sample code for your reference:
Storage storage = StorageOptions.getDefaultInstance().getService();
String bucketName = "[BUCKET_NAME]";
String blobName = "[BLOB_NAME]";
String keyPath = "[PATH_TO_KEY]";
URL signedUrl = storage.signUrl(BlobInfo.newBuilder(bucketName, blobName).build(),
14, TimeUnit.DAYS, SignUrlOption.signWith(ServiceAccountCredentials.fromStream(
new FileInputStream(keyPath))));
Signed Url for Blobs is in the works along with #2629. Please stand by.
Move this issue to feature backlog and close it here. This place can continue to be used for discussion.
client library does not support it for all platforms. For example, StorageClient class for .NET does not have method SignUrl.
Most helpful comment
Hi @ChengyuanZhao -
The client library does support signed URLs for Blobs, here is a sample code for your reference:
Signed Url for Blobs is in the works along with #2629. Please stand by.