I use Google Cloud Storage Apis. I create Signed Url like this;
var credential = new ServiceAccountCredential(new ServiceAccountCredential.Initializer("[email protected]").FromPrivateKey(PrivateKey));
var urlSigner = UrlSigner.FromServiceAccountCredential(credential);
string url = urlSigner.Sign(bucketName, "Sample.txt", TimeSpan.FromDays(7));
var httpClient = new System.Net.Http.HttpClient();
System.Net.Http.HttpResponseMessage response = await httpClient.GetAsync(url);
var content = await response.Content.ReadAsByteArrayAsync();
it's ok. But I can't use Generation No for versions.
This is normal download without signed url;
I looking for "IfGenerationMatch = " on Signed Url
await client.DownloadObjectAsync(
bucket: bucketName,
objectName: sourcePath,
destination: destinationPath,
progress: progress,
options: new DownloadObjectOptions()
{ ChunkSize = 1048576, Range = rangeHeaderValue, IfGenerationMatch = data.GenerationNo }
);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…