You need to enable JavaScript to run this app.
文档中心
对象存储

对象存储

复制全文
下载 pdf
工作流
删除工作流(Java SDK)
复制全文
下载 pdf
删除工作流(Java SDK)
本文介绍如何通过 TOS Java SDK 删除工作流。​
注意事项​
仅 Java SDK 2.9.8 及以上版本支持删除工作流功能。​
示例代码​
​
// 删除转码工作流​
package org.example.DeleteConvertWorkflow;​
​
import com.volcengine.tos.TOSV2;​
import com.volcengine.tos.TOSV2ClientBuilder;​
import com.volcengine.tos.TosClientException;​
import com.volcengine.tos.TosServerException;​
import com.volcengine.tos.comm.common.*;​
import com.volcengine.tos.model.bucket.*;​
import com.volcengine.tos.model.object.*;​
​
public class DeleteConvertWorkflowExample {​
public static void main(String[] args) {​
String endpoint = System.getenv("TOS_ENDPOINT");​
String region = System.getenv("TOS_REGION");​
String accessKey = System.getenv("TOS_ACCESS_KEY");​
String secretKey = System.getenv("TOS_SECRET_KEY");​
​
// 填写 BucketName​
String bucketName = System.getenv("TOS_BUCKET");​
​
// 初始化客户端​
TOSV2 tos = new TOSV2ClientBuilder().build(region, endpoint, accessKey, secretKey);​
​
try {​
// 构建删除转码工作流的输入参数,仅需要指定工作流所在的桶​
// 说明:如果桶上已经配置了转码工作流,调用该接口会删除当前桶下的转码工作流配置​
DeleteConvertWorkflowInput input = DeleteConvertWorkflowInput.builder()​
.bucket(bucketName)​
.build();​
​
// 调用删除转码工作流 API​
DeleteConvertWorkflowOutput output = tos.deleteConvertWorkflow(input);​
​
// 处理返回结果,打印请求 ID 和 HTTP 状态码,方便排查与确认​
System.out.println("删除转码工作流成功");​
System.out.println("RequestID: " + output.getRequestInfo().getRequestId());​
System.out.println("StatusCode: " + output.getRequestInfo().getStatusCode());​
​
} catch (TosClientException e) {​
// 操作失败,捕获客户端异常,一般情况是请求参数错误,此时请求并未发送​
System.out.println("操作失败");​
System.out.println("Message: " + e.getMessage());​
if (e.getCause() != null) {​
e.getCause().printStackTrace();​
}​
} catch (TosServerException e) {​
// 操作失败,捕获服务端异常,可以获取到从服务端返回的详细错误信息​
System.out.println("操作失败");​
System.out.println("StatusCode: " + e.getStatusCode());​
System.out.println("Code: " + e.getCode());​
System.out.println("Message: " + e.getMessage());​
System.out.println("RequestID: " + e.getRequestID());​
} catch (Throwable t) {​
// 作为兜底捕获其他异常,一般不会执行到这里​
System.out.println("操作失败");​
System.out.println("unexpected exception, message: " + t.getMessage());​
}​
}​
}​
​
相关文档​
关于查询工作流的相关API接口,请参见DeleteWorkflow。​
最近更新时间:2026.04.03 17:59:07
这个页面对您有帮助吗?
有用
有用
无用
无用