Cloud Storage SignedURLs allows for custom headers you can set to define metadata:
It doesn't look like you can add this in now during signURL construction:
note BlobInfo has metadata defined in it already so maybe use that:
the following shows how to manually construct the signed URL with canonical headers outside of this library
ServiceAccountCredentials creds = ServiceAccountCredentials.fromStream(new FileInputStream("YOUR_CERT.json"));
String BUCKET_NAME = "your_bucket";
String OBJECT_NAME = "a.txt";
String SERVICE_ACCOUNT_EMAIL = "svc-2-429@your_project.iam.gserviceaccount.com";
String verb = "PUT";
long expiration = System.currentTimeMillis()/1000 + 60;
String Canonicalized_Extension_Headers = "x-goog-meta-icecreamflavor:vanilla";
byte[] sr = creds.sign( (verb + "\n\n\n" + expiration + "\n" + Canonicalized_Extension_Headers +
"\n" + "/" + BUCKET_NAME + "/" + OBJECT_NAME ).getBytes() );
String url_signature = new String(Base64.encodeBase64( sr ));
String signed_url = "https://storage.googleapis.com/" + BUCKET_NAME + "/" + OBJECT_NAME +
"?GoogleAccessId=" + SERVICE_ACCOUNT_EMAIL +
"&Expires=" + expiration +
"&Signature=" + URLEncoder.encode(url_signature, "UTF-8");
System.out.println(signed_url);
Just to note, you'll need to post the headers too but thats outside of this FR:
curl -v -H "x-goog-meta-icecreamflavor:vanilla" -X PUT "https://storage.googleapis.com/.....&Signature=Ol1zLbXd0W%2B3q....3D%3D" --upload-file a.txt
Cloud Storage SignedURLs allows for custom headers you can set to define metadata:
It doesn't look like you can add this in now during signURL construction:
note BlobInfo has metadata defined in it already so maybe use that:
the following shows how to manually construct the signed URL with canonical headers outside of this library
Just to note, you'll need to post the headers too but thats outside of this FR: