use of com.qcloud.cos.model.fetch.PutAsyncFetchTaskResult in project cos-java-sdk-v5 by tencentyun.
the class PutAsyncFetchTaskDemo method putAsyncFetchTask.
public static void putAsyncFetchTask() {
EndpointBuilder builder = new UserSpecifiedEndpointBuilder(String.format("%s.migration.myqcloud.com", region), "service.cos.myqcloud.com");
COSClient cosClient = createCosClient();
cosClient.getClientConfig().setEndpointBuilder(builder);
PutAsyncFetchTaskRequest request = new PutAsyncFetchTaskRequest();
request.setBucketName(bucketName);
request.setUrl("https://pic1.zhimg.com/v2-63fc555d77019ae08ac2281a2418dcc7_720w.jpg");
request.setIgnoreSameKey(false);
request.setKey("test_fetch");
request.setOnKeyExist("override");
// 可选
// reqeust.setSuccessCallbackUrl("");
// request.setFailureCallbackUrl("");
// request.setMd5("");
PutAsyncFetchTaskResult result = cosClient.putAsyncFetchTask(request);
System.out.println(result.getCosRequestId());
System.out.println(result.getCode());
System.out.println(result.getMessage());
System.out.println(result.getRequestId());
for (Entry<String, String> entry : result.getData().entrySet()) {
System.out.println(entry.getKey());
System.out.println(entry.getValue());
}
}
Aggregations