Search in sources :

Example 1 with PutAsyncFetchTaskResult

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());
    }
}
Also used : COSClient(com.qcloud.cos.COSClient) PutAsyncFetchTaskRequest(com.qcloud.cos.model.fetch.PutAsyncFetchTaskRequest) PutAsyncFetchTaskResult(com.qcloud.cos.model.fetch.PutAsyncFetchTaskResult) UserSpecifiedEndpointBuilder(com.qcloud.cos.endpoint.UserSpecifiedEndpointBuilder) UserSpecifiedEndpointBuilder(com.qcloud.cos.endpoint.UserSpecifiedEndpointBuilder) EndpointBuilder(com.qcloud.cos.endpoint.EndpointBuilder)

Aggregations

COSClient (com.qcloud.cos.COSClient)1 EndpointBuilder (com.qcloud.cos.endpoint.EndpointBuilder)1 UserSpecifiedEndpointBuilder (com.qcloud.cos.endpoint.UserSpecifiedEndpointBuilder)1 PutAsyncFetchTaskRequest (com.qcloud.cos.model.fetch.PutAsyncFetchTaskRequest)1 PutAsyncFetchTaskResult (com.qcloud.cos.model.fetch.PutAsyncFetchTaskResult)1