我试图通过JavaSDK版本12.10.2获取azure blob的versionID列表,但它只返回http错误400和以下错误消息
com.azure.storage.blob.models.BlobStorageException: Status code 400, "<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidQueryParameterValue</Code><Message>Value for one of the query parameters specified in the request URI is invalid.
RequestId:bd7e9a20-401e-003e-6d7b-37d0dd000000
Time:2021-04-22T13:29:12.0965760Z</Message><QueryParameterName>include</QueryParameterName><QueryParameterValue>versions</QueryParameterValue><Reason>Invalid query parameter value.</Reason></Error>"
这是我的java代码:
public static BlobContainerAsyncClient getAzureAsyncClient(String accountName, String accountKey, String endpoint) {
String connectionString = getConnectionString(accountName, accountKey, endpoint);
BlobContainerAsyncClient blobServiceClient = new BlobContainerClientBuilder()
.connectionString(connectionString)
.serviceVersion(version)
.buildAsyncClient();
RWLog.MAIN.info("Azure Storage Async Service Client created for " + accountName);
return blobServiceClient;
}
BlobContainerAsyncClient containerClient = AzureConnection.getAzureAsyncClient(folder.getBucket(), folder.getSecretKey(), folder.getEndpoint());
ListBlobsOptions ops = new ListBlobsOptions();
ops.getDetails().setRetrieveVersions(true);
ops.setPrefix(blobKey);
PagedFlux<BlobItem> list =
containerClient.listBlobsByHierarchy("/", ops);
azureblobs服务器似乎无法识别由javasdk构造的http请求。服务器端无法处理来自java客户端的包含版本的查询。有什么想法吗?
1条答案
按热度按时间eblbsuwk1#
使用12.10.2的
azure-storage-blob
要获取blob的所有版本,请执行以下操作:结果: