
# 创建采集通道 - CreateCollectorChannel
#### 功能介绍
创建采集通道
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-secmaster/secmaster_03_0008.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-secmaster/secmaster_03_0023.html)。
#### URI
POST /v1/{project_id}/workspaces/{workspace_id}/collector/channels
表1路径参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|:---|
| project_id   | 是    | String | **参数解释：** 项目ID，用于明确项目归属，配置后可通过该ID查询项目下资产，可以通过调用API获取，也可以从控制台获取。[获取项目ID](https://support.huaweicloud.com/api-secmaster/secmaster_03_0014.html) **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及 |
| workspace_id | 是    | String | **参数解释：** 工作空间ID **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及                                                                                                                              |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | **参数解释：** 用户Token，通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。[获取用户Token](https://support.huaweicloud.com/api-secmaster/secmaster_03_0010.html) **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及 |
   
表3请求Body参数 
| 参数          | 是否必选 | 参数类型                                                                               | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|:---|:---|:---|:---|
| action      | 否    | String                                                                             | **参数解释**: 节点运行状态的监控 - START 开始   - STOP 停止   - REMOVE 移除   - RESTART 重启   - REFRESH 刷新   - INSTALL 安装    **约束限制** 不涉及 **取值范围**: - START   - STOP   - REMOVE   - RESTART   - REFRESH   - INSTALL    **默认值** 不涉及 |
| description | 否    | String                                                                             | 描述信息                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| group_id    | 是    | String                                                                             | UUID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| input       | 是    | Array of [CreateModuleVo] objects | 相关描述信息                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| nodes       | 是    | Array of [NodeVo] objects                 | 相关描述信息                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| output      | 是    | Array of [CreateModuleVo] objects | 相关描述信息                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| parser_id   | 是    | String                                                                             | UUID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| title       | 是    | String                                                                             | 相关标题                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
   
 表4NodeVo 
| 参数          | 是否必选 | 参数类型                                                               | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
|:---|:---|:---|:---|
| args        | 否    | Array of [ArgsVo] objects | 相关描述信息                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| node_id     | 否    | String                                                             | UUID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| node_status | 否    | String                                                             | **参数解释**: 节点状态 - RUN 运行   - STOP 停止    **约束限制** 不涉及 **取值范围**: - RUN   - STOP    **默认值** 不涉及 |
   
 表5ArgsVo 
| 参数    | 是否必选 | 参数类型   | 描述 |
|:---|:---|:---|:---|
| key   | 否    | String | 键  |
| value | 否    | String | 值  |
   
 表6CreateModuleVo 
| 参数                   | 是否必选 | 参数类型                                                                               | 描述     |
|:---|:---|:---|:---|
| children             | 否    | Array of [CreateModuleVo] objects | 相关描述信息 |
| connection_module_id | 否    | String                                                                             | UUID   |
| fields               | 否    | Array of [ModuleFieldVo] objects   | 相关描述信息 |
| name                 | 否    | String                                                                             | 名称     |
| template_id          | 否    | String                                                                             | UUID   |
   
 表7ModuleFieldVo 
| 参数                   | 是否必选 | 参数类型   | 描述   |
|:---|:---|:---|:---|
| connection_module_id | 否    | String | UUID |
| name                 | 否    | String | 名称   |
| other                | 否    | String | 其他信息 |
| template_field_id    | 否    | String | UUID |
| type                 | 否    | String | 类型   |
| value                | 否    | String | 值    |
   
#### 响应参数
**状态码：200**
表8响应Body参数 
| 参数      | 参数类型    | 描述   |
|:---|:---|:---|
| success | Boolean | 创建成功 |
   
#### 请求示例
```
https://{endpoint}/v1/{project_id}/workspaces/{workspace_id}/collector/channels
{
  "title" : "my channel",
  "group_id" : "72ce1e35-af50-4bfc-8761-7781b75431ae",
  "description" : "my channel",
  "input" : [ {
    "name" : "tcp",
    "template_id" : "d51164ad-40a4-4b26-9b9d-d454da34adec",
    "connection_module_id" : "c2ba9006-7c3e-4a9a-8645-8cb491f77145",
    "fields" : [ {
      "template_field_id" : "926867ed-e31f-4766-911b-bad57f0c436a",
      "name" : "mode",
      "type" : "string",
      "value" : "server"
    }, {
      "template_field_id" : "a784d1d7-e049-4602-a7a8-c8cc1bff8c65",
      "name" : "port",
      "type" : "number",
      "value" : "1025"
    }, {
      "template_field_id" : "4d839ce2-485c-4a93-b778-fd02b6ad308e",
      "name" : "codec",
      "type" : "string",
      "value" : "plain"
    } ]
  } ],
  "output" : [ {
    "name" : "pulsar",
    "template_id" : "c4618e27-5c9c-45fc-9a70-e5c5a7ce49d8",
    "connection_module_id" : "404ae2ec-b266-4638-9559-0b63e8a374e9",
    "fields" : [ {
      "template_field_id" : "8a767f76-9009-4197-8b34-341c81eaca44",
      "name" : "type",
      "type" : "string",
      "value" : "tenant"
    }, {
      "template_field_id" : "8a767f76-9009-4197-8b44-341c80eaca44",
      "name" : "pipeId",
      "type" : "string",
      "value" : "97bfc7e0-fb64-421c-85f0-5cec5bf96bcc"
    }, {
      "template_field_id" : "2d5dfaed-c9d5-4e9b-b7a6-244001c3b3ee",
      "name" : "domain_name",
      "type" : "string",
      "value" : "test"
    }, {
      "template_field_id" : "35c79e3b-595c-4328-927d-e181d9367393",
      "name" : "user_name",
      "type" : "string",
      "value" : "test"
    }, {
      "template_field_id" : "35c79e3b-595c-4328-927d-e181d9367394",
      "name" : "user_password",
      "type" : "string",
      "value" : "test"
    } ]
  } ],
  "parser_id" : "a009aa99-3521-4ec0-8827-811e277515b1",
  "nodes" : [ {
    "node_id" : "5b5667a2-be31-46f9-bf11-363d007bdb25",
    "args" : [ {
      "key" : "#service_url",
      "value" : "192.168.0.151"
    } ]
  } ],
  "action" : "INSTALL"
}
```
#### 响应示例
**状态码：200**
成功
```
{
  "success" : true
}
```
#### SDK代码示例
SDK代码示例如下。
- [Java]
  ```
  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.*;
  import java.util.List;
  import java.util.ArrayList;
  public class CreateCollectorChannelSolution {
      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();
          CreateCollectorChannelRequest request = new CreateCollectorChannelRequest();
          request.withWorkspaceId("{workspace_id}");
          CreateChannelDto body = new CreateChannelDto();
          List<ModuleFieldVo> listOutputFields = new ArrayList<>();
          listOutputFields.add(
              new ModuleFieldVo()
                  .withName("type")
                  .withTemplateFieldId("8a767f76-9009-4197-8b34-341c81eaca44")
                  .withType("string")
                  .withValue("tenant")
          );
          listOutputFields.add(
              new ModuleFieldVo()
                  .withName("pipeId")
                  .withTemplateFieldId("8a767f76-9009-4197-8b44-341c80eaca44")
                  .withType("string")
                  .withValue("97bfc7e0-fb64-421c-85f0-5cec5bf96bcc")
          );
          listOutputFields.add(
              new ModuleFieldVo()
                  .withName("domain_name")
                  .withTemplateFieldId("2d5dfaed-c9d5-4e9b-b7a6-244001c3b3ee")
                  .withType("string")
                  .withValue("test")
          );
          listOutputFields.add(
              new ModuleFieldVo()
                  .withName("user_name")
                  .withTemplateFieldId("35c79e3b-595c-4328-927d-e181d9367393")
                  .withType("string")
                  .withValue("test")
          );
          listOutputFields.add(
              new ModuleFieldVo()
                  .withName("user_password")
                  .withTemplateFieldId("35c79e3b-595c-4328-927d-e181d9367394")
                  .withType("string")
                  .withValue("test")
          );
          List<CreateModuleVo> listbodyOutput = new ArrayList<>();
          listbodyOutput.add(
              new CreateModuleVo()
                  .withConnectionModuleId("404ae2ec-b266-4638-9559-0b63e8a374e9")
                  .withFields(listOutputFields)
                  .withName("pulsar")
                  .withTemplateId("c4618e27-5c9c-45fc-9a70-e5c5a7ce49d8")
          );
          List<ArgsVo> listNodesArgs = new ArrayList<>();
          listNodesArgs.add(
              new ArgsVo()
                  .withKey("#service_url")
                  .withValue("192.168.0.151")
          );
          List<NodeVo> listbodyNodes = new ArrayList<>();
          listbodyNodes.add(
              new NodeVo()
                  .withArgs(listNodesArgs)
                  .withNodeId("5b5667a2-be31-46f9-bf11-363d007bdb25")
          );
          List<ModuleFieldVo> listInputFields = new ArrayList<>();
          listInputFields.add(
              new ModuleFieldVo()
                  .withName("mode")
                  .withTemplateFieldId("926867ed-e31f-4766-911b-bad57f0c436a")
                  .withType("string")
                  .withValue("server")
          );
          listInputFields.add(
              new ModuleFieldVo()
                  .withName("port")
                  .withTemplateFieldId("a784d1d7-e049-4602-a7a8-c8cc1bff8c65")
                  .withType("number")
                  .withValue("1025")
          );
          listInputFields.add(
              new ModuleFieldVo()
                  .withName("codec")
                  .withTemplateFieldId("4d839ce2-485c-4a93-b778-fd02b6ad308e")
                  .withType("string")
                  .withValue("plain")
          );
          List<CreateModuleVo> listbodyInput = new ArrayList<>();
          listbodyInput.add(
              new CreateModuleVo()
                  .withConnectionModuleId("c2ba9006-7c3e-4a9a-8645-8cb491f77145")
                  .withFields(listInputFields)
                  .withName("tcp")
                  .withTemplateId("d51164ad-40a4-4b26-9b9d-d454da34adec")
          );
          body.withTitle("my channel");
          body.withParserId("a009aa99-3521-4ec0-8827-811e277515b1");
          body.withOutput(listbodyOutput);
          body.withNodes(listbodyNodes);
          body.withInput(listbodyInput);
          body.withGroupId("72ce1e35-af50-4bfc-8761-7781b75431ae");
          body.withDescription("my channel");
          body.withAction(CreateChannelDto.ActionEnum.fromValue("INSTALL"));
          request.withBody(body);
          try {
              CreateCollectorChannelResponse response = client.createCollectorChannel(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());
          }
      }
  }
  ```
- [Python]
  ```
  # 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 = CreateCollectorChannelRequest()
          request.workspace_id = "{workspace_id}"
          listFieldsOutput = [
              ModuleFieldVo(
                  name="type",
                  template_field_id="8a767f76-9009-4197-8b34-341c81eaca44",
                  type="string",
                  value="tenant"
              ),
              ModuleFieldVo(
                  name="pipeId",
                  template_field_id="8a767f76-9009-4197-8b44-341c80eaca44",
                  type="string",
                  value="97bfc7e0-fb64-421c-85f0-5cec5bf96bcc"
              ),
              ModuleFieldVo(
                  name="domain_name",
                  template_field_id="2d5dfaed-c9d5-4e9b-b7a6-244001c3b3ee",
                  type="string",
                  value="test"
              ),
              ModuleFieldVo(
                  name="user_name",
                  template_field_id="35c79e3b-595c-4328-927d-e181d9367393",
                  type="string",
                  value="test"
              ),
              ModuleFieldVo(
                  name="user_password",
                  template_field_id="35c79e3b-595c-4328-927d-e181d9367394",
                  type="string",
                  value="test"
              )
          ]
          listOutputbody = [
              CreateModuleVo(
                  connection_module_id="404ae2ec-b266-4638-9559-0b63e8a374e9",
                  fields=listFieldsOutput,
                  name="pulsar",
                  template_id="c4618e27-5c9c-45fc-9a70-e5c5a7ce49d8"
              )
          ]
          listArgsNodes = [
              ArgsVo(
                  key="#service_url",
                  value="192.168.0.151"
              )
          ]
          listNodesbody = [
              NodeVo(
                  args=listArgsNodes,
                  node_id="5b5667a2-be31-46f9-bf11-363d007bdb25"
              )
          ]
          listFieldsInput = [
              ModuleFieldVo(
                  name="mode",
                  template_field_id="926867ed-e31f-4766-911b-bad57f0c436a",
                  type="string",
                  value="server"
              ),
              ModuleFieldVo(
                  name="port",
                  template_field_id="a784d1d7-e049-4602-a7a8-c8cc1bff8c65",
                  type="number",
                  value="1025"
              ),
              ModuleFieldVo(
                  name="codec",
                  template_field_id="4d839ce2-485c-4a93-b778-fd02b6ad308e",
                  type="string",
                  value="plain"
              )
          ]
          listInputbody = [
              CreateModuleVo(
                  connection_module_id="c2ba9006-7c3e-4a9a-8645-8cb491f77145",
                  fields=listFieldsInput,
                  name="tcp",
                  template_id="d51164ad-40a4-4b26-9b9d-d454da34adec"
              )
          ]
          request.body = CreateChannelDto(
              title="my channel",
              parser_id="a009aa99-3521-4ec0-8827-811e277515b1",
              output=listOutputbody,
              nodes=listNodesbody,
              input=listInputbody,
              group_id="72ce1e35-af50-4bfc-8761-7781b75431ae",
              description="my channel",
              action="INSTALL"
          )
          response = client.create_collector_channel(request)
          print(response)
      except exceptions.ClientRequestException as e:
          print(e.status_code)
          print(e.request_id)
          print(e.error_code)
          print(e.error_msg)
  ```
- [Go]
  ```
  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, err := basic.NewCredentialsBuilder().
          WithAk(ak).
          WithSk(sk).
          WithProjectId(projectId).
          SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      hcClient, err := secmaster.SecMasterClientBuilder().
           WithRegion(region.ValueOf("<YOUR REGION>")).
           WithCredential(auth).
           SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      client := secmaster.NewSecMasterClient(hcClient)
      request := &model.CreateCollectorChannelRequest{}
  request.WorkspaceId = "{workspace_id}"
  nameFields:= "type"
  templateFieldIdFields:= "8a767f76-9009-4197-8b34-341c81eaca44"
  typeFields:= "string"
  valueFields:= "tenant"
  nameFields1:= "pipeId"
  templateFieldIdFields1:= "8a767f76-9009-4197-8b44-341c80eaca44"
  typeFields1:= "string"
  valueFields1:= "97bfc7e0-fb64-421c-85f0-5cec5bf96bcc"
  nameFields2:= "domain_name"
  templateFieldIdFields2:= "2d5dfaed-c9d5-4e9b-b7a6-244001c3b3ee"
  typeFields2:= "string"
  valueFields2:= "test"
  nameFields3:= "user_name"
  templateFieldIdFields3:= "35c79e3b-595c-4328-927d-e181d9367393"
  typeFields3:= "string"
  valueFields3:= "test"
  nameFields4:= "user_password"
  templateFieldIdFields4:= "35c79e3b-595c-4328-927d-e181d9367394"
  typeFields4:= "string"
  valueFields4:= "test"
  var listFieldsOutput = []model.ModuleFieldVo{
          {
              Name: &nameFields,
              TemplateFieldId: &templateFieldIdFields,
              Type: &typeFields,
              Value: &valueFields,
          },
          {
              Name: &nameFields1,
              TemplateFieldId: &templateFieldIdFields1,
              Type: &typeFields1,
              Value: &valueFields1,
          },
          {
              Name: &nameFields2,
              TemplateFieldId: &templateFieldIdFields2,
              Type: &typeFields2,
              Value: &valueFields2,
          },
          {
              Name: &nameFields3,
              TemplateFieldId: &templateFieldIdFields3,
              Type: &typeFields3,
              Value: &valueFields3,
          },
          {
              Name: &nameFields4,
              TemplateFieldId: &templateFieldIdFields4,
              Type: &typeFields4,
              Value: &valueFields4,
          },
      }
  connectionModuleIdOutput:= "404ae2ec-b266-4638-9559-0b63e8a374e9"
  nameOutput:= "pulsar"
  templateIdOutput:= "c4618e27-5c9c-45fc-9a70-e5c5a7ce49d8"
  var listOutputbody = []model.CreateModuleVo{
          {
              ConnectionModuleId: &connectionModuleIdOutput,
              Fields: &listFieldsOutput,
              Name: &nameOutput,
              TemplateId: &templateIdOutput,
          },
      }
  keyArgs:= "#service_url"
  valueArgs:= "192.168.0.151"
  var listArgsNodes = []model.ArgsVo{
          {
              Key: &keyArgs,
              Value: &valueArgs,
          },
      }
  nodeIdNodes:= "5b5667a2-be31-46f9-bf11-363d007bdb25"
  var listNodesbody = []model.NodeVo{
          {
              Args: &listArgsNodes,
              NodeId: &nodeIdNodes,
          },
      }
  nameFields5:= "mode"
  templateFieldIdFields5:= "926867ed-e31f-4766-911b-bad57f0c436a"
  typeFields5:= "string"
  valueFields5:= "server"
  nameFields6:= "port"
  templateFieldIdFields6:= "a784d1d7-e049-4602-a7a8-c8cc1bff8c65"
  typeFields6:= "number"
  valueFields6:= "1025"
  nameFields7:= "codec"
  templateFieldIdFields7:= "4d839ce2-485c-4a93-b778-fd02b6ad308e"
  typeFields7:= "string"
  valueFields7:= "plain"
  var listFieldsInput = []model.ModuleFieldVo{
          {
              Name: &nameFields5,
              TemplateFieldId: &templateFieldIdFields5,
              Type: &typeFields5,
              Value: &valueFields5,
          },
          {
              Name: &nameFields6,
              TemplateFieldId: &templateFieldIdFields6,
              Type: &typeFields6,
              Value: &valueFields6,
          },
          {
              Name: &nameFields7,
              TemplateFieldId: &templateFieldIdFields7,
              Type: &typeFields7,
              Value: &valueFields7,
          },
      }
  connectionModuleIdInput:= "c2ba9006-7c3e-4a9a-8645-8cb491f77145"
  nameInput:= "tcp"
  templateIdInput:= "d51164ad-40a4-4b26-9b9d-d454da34adec"
  var listInputbody = []model.CreateModuleVo{
          {
              ConnectionModuleId: &connectionModuleIdInput,
              Fields: &listFieldsInput,
              Name: &nameInput,
              TemplateId: &templateIdInput,
          },
      }
  descriptionCreateChannelDto:= "my channel"
  actionAction:= model.GetChannelActionActionEnum().INSTALL
  request.Body = &model.CreateChannelDto{
  Title: "my channel",
  ParserId: "a009aa99-3521-4ec0-8827-811e277515b1",
  Output: listOutputbody,
  Nodes: listNodesbody,
  Input: listInputbody,
  GroupId: "72ce1e35-af50-4bfc-8761-7781b75431ae",
  Description: &descriptionCreateChannelDto,
  Action: &actionAction,
  }
  response, err := client.CreateCollectorChannel(request)
  if err == nil {
          fmt.Printf("%+v\n", response)
      } else {
          fmt.Println(err)
      }
  }
  ```
- [更多]
  更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/SecMaster/sdk?api=CreateCollectorChannel&version=v1)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述 |
|:---|:---|
| 200 | 成功 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-secmaster/ErrorCode.html)。
