更新时间:2026-02-05 GMT+08:00

更新待办的信息 - UpdateTask

功能介绍

更新待办的信息

调用方法

请参见如何调用API

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项

URI

PUT /v1/{project_id}/workspaces/{workspace_id}/soc/tasks/{task_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释:

项目ID,用于明确项目归属,配置后可通过该ID查询项目下资产,可以通过调用API获取,也可以从控制台获取。获取项目ID

约束限制:

不涉及

取值范围:

不涉及

默认取值:

不涉及

workspace_id

String

参数解释:

工作空间ID

取值范围:

不涉及

task_id

String

参数解释:

待办任务的ID

取值范围:

不涉及

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

租户的Token

约束限制:

不涉及

取值范围:

不涉及

默认值:

不涉及

Content-Type

String

参数解释:

内容类型

  • application/json;charset=UTF-8 普通API请求的类型

约束限制:

不涉及

取值范围:

  • application/json;charset=UTF-8

默认取值:

不涉及

表3 请求Body参数

参数

是否必选

参数类型

描述

action

String

参数解释:

更新的待办动作

  • TERMINATE 终止待办

  • CONTINUE 继续执行

  • ADD_COMMENT 添加评论

  • DELETE_COMMENT 删除评论

  • ADD_ATTACHMENT 添加附件

  • DELETE_ATTACHMENT 删除附件

约束限制:

  • TERMINATE 不涉及

  • CONTINUE 不涉及

  • ADD_COMMENT 需要和请求参数comment配合使用

  • DELETE_COMMENT 需要和请求参数comment_id配合使用

  • ADD_ATTACHMENT 需要和请求参数attachment_id配合使用

  • DELETE_ATTACHMENT 需要和请求参数attachment_id配合使用

取值范围:

  • TERMINATE

  • CONTINUE

  • ADD_COMMENT

  • DELETE_COMMENT

  • ADD_ATTACHMENT

  • DELETE_ATTACHMENT

默认值:

ADD_ATTACHMENT 添加评论

attachment_id

String

附件id

comment

String

待办评论内容

comment_id

String

待办评论id

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

code

String

参数解释:

错误码,当请求成功时值为 "00000000"

取值范围:

不涉及

message

String

参数解释:

错误信息的描述

取值范围:

不涉及

request_id

String

参数解释:

请求的ID

约束限制:

不涉及

success

Boolean

参数解释:

是否成功

取值范围:

  • true 成功

  • false 失败

data

TaskInfo object

Information of task

表5 TaskInfo

参数

参数类型

描述

id

String

参数解释:

待办任务的ID

取值范围:

不涉及

aopengine_task_id

String

参数解释:

待办任务的引擎任务Id

取值范围:

不涉及.

name

String

参数解释:

待办任务的名称

取值范围:

不涉及

project_id

String

参数解释:

待办任务的项目Id

取值范围:

不涉及

description

String

参数解释:

待办任务的描述

取值范围:

不涉及

create_time

String

参数解释:

待办的创建时间

取值范围:

不涉及

creator_id

String

参数解释:

待办的创建者ID

取值范围:

system

creator_name

String

参数解释:

待办的创建者名字

取值范围:

不涉及

update_time

String

参数解释:

待办的更新时间

取值范围:

不涉及

modifier_id

String

参数解释:

待办的修改者ID

取值范围:

system

modifier_name

String

参数解释:

待办的修改者名字

取值范围:

不涉及

approveuser_id

String

参数解释:

待办支持的审核人用户ID

取值范围:

不涉及

approveuser_name

String

参数解释:

待办支持的审核人用户名字

取值范围:

不涉及

approver

String

参数解释:

待办审核人用户名称

取值范围:

不涉及

notes

String

参数解释:

待办的备注

取值范围:

不涉及

definition_key

String

参数解释:

待办的节点流程拓扑图的KEY

取值范围:

不涉及

note

String

参数解释:

待办的备注

取值范围:

不涉及

due_date

String

参数解释:

待办的超期时间

取值范围:

默认为创建时间+15天

action_id

String

参数解释:

待办的节点的流程或剧本ID

当 business_type是WORKFLOWPUBLISH或者WORKFLOWNODEAPPROVE,此时为流程ID

当 business_type是PLAYBOOKPUBLISH或者PLAYBOOKNODEAPPROVE,此时为剧本ID

取值范围:

不涉及

action_version_id

String

参数解释:

待办的节点的流程或剧本版本ID

当 business_type是WORKFLOWPUBLISH或者WORKFLOWNODEAPPROVE,此时为流程版本ID

当 business_type是PLAYBOOKPUBLISH或者PLAYBOOKNODEAPPROVE,此时为剧本版本ID

取值范围:

不涉及

action_instance_id

String

参数解释:

待办的节点的流程或剧本的实例ID

当 business_type是WORKFLOWNODEAPPROVE,此时为流程实例ID

当 business_type是PLAYBOOKNODEAPPROVE,此时为剧本实例ID

取值范围:

不涉及

workspace_id

String

参数解释:

待办任务的空间ID

取值范围:

不涉及

review_comments

String

参数解释:

待办任务审核意见

取值范围:

不涉及

view_parameters

String

参数解释:

待办任务查看参数

取值范围:

不涉及

handle_parameters

String

参数解释:

待办任务的人工处理参数

取值范围:

不涉及

business_type

String

参数解释:

待办的业务类型

  • WORKFLOWPUBLISH 流程发布

  • WORKFLOWNODEAPPROVE 流程节点审核

  • PLAYBOOKPUBLISH 剧本发布

  • PLAYBOOKNODEAPPROVE 剧本节点审核

取值范围:

  • WORKFLOWPUBLISH

  • WORKFLOWNODEAPPROVE

  • PLAYBOOKPUBLISH

  • PLAYBOOKNODEAPPROVE

related_object

String

参数解释:

待办任务的关联的流程 or 剧本名称

取值范围:

不涉及

attachment_id_list

Array of strings

参数解释:

待办节点的附件ID列表

取值范围:

不涉及

comments

Array of TaskCommentInfo objects

参数解释:

待办节点的待办评论

取值范围:

不涉及

status

String

参数解释:

待办的业务类型

  • waiting 待处理

  • canceled 已取消

  • finished 已完成

取值范围:

  • waiting

  • canceled

  • finished

due_handle

String

参数解释:

待办的到期处理方式

  • CONTINUE 继续执行

  • INTERRUPT 终止

取值范围:

  • CONTINUE

  • INTERRUPT

表6 TaskCommentInfo

参数

参数类型

描述

id

String

参数解释:

待办评论ID

取值范围:

不涉及

message

String

参数解释:

待办评论信息

取值范围:

不涉及

user_id

String

参数解释:

创建待办评论的用户ID

取值范围:

不涉及

user_name

String

参数解释:

创建待办评论的用户名称

取值范围:

不涉及

time

Long

参数解释:

创建待办评论的时间

取值范围:

不涉及

状态码:400

表7 响应Body参数

参数

参数类型

描述

code

String

参数解释:

错误码

取值范围:

不涉及

message

String

参数解释:

错误描述

取值范围:

不涉及

请求示例

  • 终止待办

    {
      "action" : "TERMINATE"
    }
  • 待办继续执行

    {
      "action" : "CONTINUE"
    }
  • 添加待办评论

    {
      "action" : "ADD_COMMENT",
      "comment" : "comment content"
    }
  • 移除待办评论

    {
      "action" : "DELETE_COMMENT",
      "comment_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f"
    }
  • 添加待办节点的附件

    {
      "action" : "ADD_ATTACHMENT",
      "attachment_id" : "909494e3-558e-46b6-a9eb-07a8e1XXXX"
    }
  • 移除待办节点的附件

    {
      "action" : "DELETE_ATTACHMENT",
      "attachment_id" : "909494e3-558e-46b6-a9eb-07a8e1XXXX"
    }

响应示例

状态码:200

Response of update task

{
  "code" : "00000000",
  "data" : {
    "id" : "3e4c170e-7cc9-11f0-9216-fa163e209978",
    "aopengine_task_id" : "3e4c170e-7cc9-11f0-9216-fa163e209978",
    "name" : "test task",
    "project_id" : "15645222e8744afa985c93dab6341da6",
    "description" : "",
    "create_time" : "2025-08-19T14:53:42.424Z+0800",
    "creator_id" : "",
    "creator_name" : "XXXX",
    "modifier_id" : "",
    "modifier_name" : "",
    "update_time" : "2025-08-19T16:50:23.743Z+0800",
    "approveuser_id" : "",
    "approveuser_name" : "",
    "approver" : "",
    "definition_key" : "Activity_1xkg6ju",
    "notes" : "006",
    "due_date" : "2025-09-03T14:53:42.398Z+0800",
    "action_id" : "e1426fd5-bf48-3b71-8f8e-d5ca1047f68b",
    "action_version_id" : "0696648d-9d20-4e21-b1fd-24f9a6f4918c",
    "action_instance_id" : "xxxxx",
    "workspace_id" : "75645d0a-93b8-4a7f-a77c-e97009389445",
    "view_parameters" : "",
    "handle_parameters" : "",
    "review_comments" : "",
    "business_type" : "PLAYBOOKNODEAPPROVE",
    "related_object" : "test",
    "attachment_id_list" : [ ],
    "comments" : [ ],
    "due_handle" : "",
    "status" : "waiting"
  },
  "message" : "",
  "request_id" : "",
  "success" : true
}

SDK代码示例

SDK代码示例如下。

  • 终止待办

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.secmaster.v1.region.SecMasterRegion;
    import com.huaweicloud.sdk.secmaster.v1.*;
    import com.huaweicloud.sdk.secmaster.v1.model.*;
    
    
    public class UpdateTaskSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            SecMasterClient client = SecMasterClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(SecMasterRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateTaskRequest request = new UpdateTaskRequest();
            request.withWorkspaceId("{workspace_id}");
            request.withTaskId("{task_id}");
            ModifyTaskInfo body = new ModifyTaskInfo();
            body.withAction(ModifyTaskInfo.ActionEnum.fromValue("TERMINATE"));
            request.withBody(body);
            try {
                UpdateTaskResponse response = client.updateTask(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • 待办继续执行

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.secmaster.v1.region.SecMasterRegion;
    import com.huaweicloud.sdk.secmaster.v1.*;
    import com.huaweicloud.sdk.secmaster.v1.model.*;
    
    
    public class UpdateTaskSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            SecMasterClient client = SecMasterClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(SecMasterRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateTaskRequest request = new UpdateTaskRequest();
            request.withWorkspaceId("{workspace_id}");
            request.withTaskId("{task_id}");
            ModifyTaskInfo body = new ModifyTaskInfo();
            body.withAction(ModifyTaskInfo.ActionEnum.fromValue("CONTINUE"));
            request.withBody(body);
            try {
                UpdateTaskResponse response = client.updateTask(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • 添加待办评论

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.secmaster.v1.region.SecMasterRegion;
    import com.huaweicloud.sdk.secmaster.v1.*;
    import com.huaweicloud.sdk.secmaster.v1.model.*;
    
    
    public class UpdateTaskSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            SecMasterClient client = SecMasterClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(SecMasterRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateTaskRequest request = new UpdateTaskRequest();
            request.withWorkspaceId("{workspace_id}");
            request.withTaskId("{task_id}");
            ModifyTaskInfo body = new ModifyTaskInfo();
            body.withComment("comment content");
            body.withAction(ModifyTaskInfo.ActionEnum.fromValue("ADD_COMMENT"));
            request.withBody(body);
            try {
                UpdateTaskResponse response = client.updateTask(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • 移除待办评论

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.secmaster.v1.region.SecMasterRegion;
    import com.huaweicloud.sdk.secmaster.v1.*;
    import com.huaweicloud.sdk.secmaster.v1.model.*;
    
    
    public class UpdateTaskSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            SecMasterClient client = SecMasterClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(SecMasterRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateTaskRequest request = new UpdateTaskRequest();
            request.withWorkspaceId("{workspace_id}");
            request.withTaskId("{task_id}");
            ModifyTaskInfo body = new ModifyTaskInfo();
            body.withCommentId("909494e3-558e-46b6-a9eb-07a8e18ca62f");
            body.withAction(ModifyTaskInfo.ActionEnum.fromValue("DELETE_COMMENT"));
            request.withBody(body);
            try {
                UpdateTaskResponse response = client.updateTask(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • 添加待办节点的附件

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.secmaster.v1.region.SecMasterRegion;
    import com.huaweicloud.sdk.secmaster.v1.*;
    import com.huaweicloud.sdk.secmaster.v1.model.*;
    
    
    public class UpdateTaskSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            SecMasterClient client = SecMasterClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(SecMasterRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateTaskRequest request = new UpdateTaskRequest();
            request.withWorkspaceId("{workspace_id}");
            request.withTaskId("{task_id}");
            ModifyTaskInfo body = new ModifyTaskInfo();
            body.withAttachmentId("909494e3-558e-46b6-a9eb-07a8e1XXXX");
            body.withAction(ModifyTaskInfo.ActionEnum.fromValue("ADD_ATTACHMENT"));
            request.withBody(body);
            try {
                UpdateTaskResponse response = client.updateTask(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • 移除待办节点的附件

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.secmaster.v1.region.SecMasterRegion;
    import com.huaweicloud.sdk.secmaster.v1.*;
    import com.huaweicloud.sdk.secmaster.v1.model.*;
    
    
    public class UpdateTaskSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            SecMasterClient client = SecMasterClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(SecMasterRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateTaskRequest request = new UpdateTaskRequest();
            request.withWorkspaceId("{workspace_id}");
            request.withTaskId("{task_id}");
            ModifyTaskInfo body = new ModifyTaskInfo();
            body.withAttachmentId("909494e3-558e-46b6-a9eb-07a8e1XXXX");
            body.withAction(ModifyTaskInfo.ActionEnum.fromValue("DELETE_ATTACHMENT"));
            request.withBody(body);
            try {
                UpdateTaskResponse response = client.updateTask(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • 终止待办

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdksecmaster.v1 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = SecMasterClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = UpdateTaskRequest()
            request.workspace_id = "{workspace_id}"
            request.task_id = "{task_id}"
            request.body = ModifyTaskInfo(
                action="TERMINATE"
            )
            response = client.update_task(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • 待办继续执行

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdksecmaster.v1 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = SecMasterClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = UpdateTaskRequest()
            request.workspace_id = "{workspace_id}"
            request.task_id = "{task_id}"
            request.body = ModifyTaskInfo(
                action="CONTINUE"
            )
            response = client.update_task(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • 添加待办评论

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdksecmaster.v1 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = SecMasterClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = UpdateTaskRequest()
            request.workspace_id = "{workspace_id}"
            request.task_id = "{task_id}"
            request.body = ModifyTaskInfo(
                comment="comment content",
                action="ADD_COMMENT"
            )
            response = client.update_task(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • 移除待办评论

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdksecmaster.v1 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = SecMasterClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = UpdateTaskRequest()
            request.workspace_id = "{workspace_id}"
            request.task_id = "{task_id}"
            request.body = ModifyTaskInfo(
                comment_id="909494e3-558e-46b6-a9eb-07a8e18ca62f",
                action="DELETE_COMMENT"
            )
            response = client.update_task(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • 添加待办节点的附件

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdksecmaster.v1 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = SecMasterClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = UpdateTaskRequest()
            request.workspace_id = "{workspace_id}"
            request.task_id = "{task_id}"
            request.body = ModifyTaskInfo(
                attachment_id="909494e3-558e-46b6-a9eb-07a8e1XXXX",
                action="ADD_ATTACHMENT"
            )
            response = client.update_task(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • 移除待办节点的附件

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdksecmaster.v1 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = SecMasterClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = UpdateTaskRequest()
            request.workspace_id = "{workspace_id}"
            request.task_id = "{task_id}"
            request.body = ModifyTaskInfo(
                attachment_id="909494e3-558e-46b6-a9eb-07a8e1XXXX",
                action="DELETE_ATTACHMENT"
            )
            response = client.update_task(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • 终止待办

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := secmaster.NewSecMasterClient(
            secmaster.SecMasterClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.UpdateTaskRequest{}
    	request.WorkspaceId = "{workspace_id}"
    	request.TaskId = "{task_id}"
    	actionModifyTaskInfo:= model.GetModifyTaskInfoActionEnum().TERMINATE
    	request.Body = &model.ModifyTaskInfo{
    		Action: &actionModifyTaskInfo,
    	}
    	response, err := client.UpdateTask(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • 待办继续执行

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := secmaster.NewSecMasterClient(
            secmaster.SecMasterClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.UpdateTaskRequest{}
    	request.WorkspaceId = "{workspace_id}"
    	request.TaskId = "{task_id}"
    	actionModifyTaskInfo:= model.GetModifyTaskInfoActionEnum().CONTINUE
    	request.Body = &model.ModifyTaskInfo{
    		Action: &actionModifyTaskInfo,
    	}
    	response, err := client.UpdateTask(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • 添加待办评论

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := secmaster.NewSecMasterClient(
            secmaster.SecMasterClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.UpdateTaskRequest{}
    	request.WorkspaceId = "{workspace_id}"
    	request.TaskId = "{task_id}"
    	commentModifyTaskInfo:= "comment content"
    	actionModifyTaskInfo:= model.GetModifyTaskInfoActionEnum().ADD_COMMENT
    	request.Body = &model.ModifyTaskInfo{
    		Comment: &commentModifyTaskInfo,
    		Action: &actionModifyTaskInfo,
    	}
    	response, err := client.UpdateTask(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • 移除待办评论

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := secmaster.NewSecMasterClient(
            secmaster.SecMasterClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.UpdateTaskRequest{}
    	request.WorkspaceId = "{workspace_id}"
    	request.TaskId = "{task_id}"
    	commentIdModifyTaskInfo:= "909494e3-558e-46b6-a9eb-07a8e18ca62f"
    	actionModifyTaskInfo:= model.GetModifyTaskInfoActionEnum().DELETE_COMMENT
    	request.Body = &model.ModifyTaskInfo{
    		CommentId: &commentIdModifyTaskInfo,
    		Action: &actionModifyTaskInfo,
    	}
    	response, err := client.UpdateTask(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • 添加待办节点的附件

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := secmaster.NewSecMasterClient(
            secmaster.SecMasterClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.UpdateTaskRequest{}
    	request.WorkspaceId = "{workspace_id}"
    	request.TaskId = "{task_id}"
    	attachmentIdModifyTaskInfo:= "909494e3-558e-46b6-a9eb-07a8e1XXXX"
    	actionModifyTaskInfo:= model.GetModifyTaskInfoActionEnum().ADD_ATTACHMENT
    	request.Body = &model.ModifyTaskInfo{
    		AttachmentId: &attachmentIdModifyTaskInfo,
    		Action: &actionModifyTaskInfo,
    	}
    	response, err := client.UpdateTask(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • 移除待办节点的附件

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := secmaster.NewSecMasterClient(
            secmaster.SecMasterClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.UpdateTaskRequest{}
    	request.WorkspaceId = "{workspace_id}"
    	request.TaskId = "{task_id}"
    	attachmentIdModifyTaskInfo:= "909494e3-558e-46b6-a9eb-07a8e1XXXX"
    	actionModifyTaskInfo:= model.GetModifyTaskInfoActionEnum().DELETE_ATTACHMENT
    	request.Body = &model.ModifyTaskInfo{
    		AttachmentId: &attachmentIdModifyTaskInfo,
    		Action: &actionModifyTaskInfo,
    	}
    	response, err := client.UpdateTask(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

Response of update task

400

Error response

错误码

请参见错误码