Creating a Pipeline
Function
This API is used to create a pipeline.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/workspaces/{workspace_id}/siem/pipes
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition Project ID, which is used to specify the project that a resource belongs to. You can query the resources of a project by project ID. You can obtain the project ID from the API or console. Obtaining the Project ID Constraints N/A Range N/A Default Value N/A |
|
workspace_id |
Yes |
String |
Workspace ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition User token. You can obtain it by calling the IAM API for obtaining a user token. The user token is the value of X-Subject-Token in the response header. Obtaining a User Token Constraints N/A Range N/A Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
pipe_name |
Yes |
String |
Pipeline name. |
|
pipe_alias |
Yes |
String |
Pipeline alias. |
|
category |
Yes |
String |
Definition Pipeline directory. Constraints N/A Range Default Value N/A |
|
directory |
No |
String |
Directory group. |
|
description |
No |
String |
Pipeline description. |
|
schema |
Yes |
PipeSchema object |
Pipeline mode. |
|
storage_setting |
Yes |
PipeStorageSetting object |
Pipeline storage settings. |
|
display_setting |
No |
TableDisplaySetting object |
Table display settings. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
columns |
Yes |
Array of TableColumnForIsapPipe objects |
Pipeline column. |
|
watermark_column |
No |
String |
Pipeline watermark column. |
|
watermark_interval |
No |
Float |
Pipeline watermark interval. |
|
time_filter |
Yes |
String |
Pipeline filtering column. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
column_name |
Yes |
String |
Table column name. |
|
column_data_type |
Yes |
String |
Definition Column data type. Constraints N/A Range Default Value N/A |
|
column_data_type_setting |
No |
String |
Column data type settings. |
|
column_type |
No |
String |
Definition Column field type. Constraints N/A Range Default Value N/A |
|
column_type_setting |
No |
String |
Column type settings. |
|
default_value |
No |
String |
Default value of a column. |
|
nullable |
No |
Boolean |
Whether a column can be empty. |
|
array |
No |
Boolean |
Array or not. |
|
depth |
No |
Long |
Column depth. |
|
parent_name |
No |
String |
Column name. |
|
own_name |
No |
String |
Column name. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
streaming_bandwidth |
No |
Float |
Bandwidth in MB/s |
|
streaming_dataspace_id |
Yes |
String |
UUID |
|
index_storage_period |
No |
Long |
Index storage period. |
|
index_storage_size |
No |
Long |
Index storage capacity, in GB. |
|
index_shards |
No |
Long |
Number of index partitions. |
|
data_transformation_cu |
No |
Float |
Data conversion CU. |
|
lake_storage_period |
No |
Long |
Index shards |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
columns |
No |
Array of TableColumnDisplaySetting objects |
Table column display list. |
|
format |
No |
String |
Definition Table display settings. Constraints N/A Range Default Value N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
project_id |
String |
Project ID. |
|
workspace_id |
String |
UUID |
|
pipe_id |
String |
UUID |
|
pipe_name |
String |
Pipeline name. |
|
pipe_alias |
String |
Pipeline alias. |
|
category |
String |
Definition Pipeline directory. Constraints N/A Range Default Value N/A |
|
directory |
String |
Directory group. |
|
description |
String |
Pipeline description. |
|
process_status |
String |
Definition Job processing status. Constraints N/A Range Default Value N/A |
|
process_error |
String |
Definition Pipeline processing error. Constraints N/A Range Default Value N/A |
|
owner_type |
String |
Definition Pipeline owner type. Constraints N/A Range Default Value N/A |
|
resources |
Array of PipeResource objects |
Pipeline resource. |
|
schema |
PipeSchema object |
Pipeline mode. |
|
create_time |
Integer |
Timestamp, in ms. |
|
update_time |
Integer |
Timestamp, in ms. |
|
delete_time |
Integer |
Timestamp, in ms. |
|
Parameter |
Type |
Description |
|---|---|---|
|
columns |
Array of TableColumnForIsapPipe objects |
Pipeline column. |
|
watermark_column |
String |
Pipeline watermark column. |
|
watermark_interval |
Float |
Pipeline watermark interval. |
|
time_filter |
String |
Pipeline filtering column. |
|
Parameter |
Type |
Description |
|---|---|---|
|
column_name |
String |
Table column name. |
|
column_data_type |
String |
Definition Column data type. Constraints N/A Range Default Value N/A |
|
column_data_type_setting |
String |
Column data type settings. |
|
column_type |
String |
Definition Column field type. Constraints N/A Range Default Value N/A |
|
column_type_setting |
String |
Column type settings. |
|
default_value |
String |
Default value of a column. |
|
nullable |
Boolean |
Whether a column can be empty. |
|
array |
Boolean |
Array or not. |
|
depth |
Long |
Column depth. |
|
parent_name |
String |
Column name. |
|
own_name |
String |
Column name. |
Example Requests
https://{endpoint}//v2/{project_id}/workspaces/{workspace_id}/siem/analysis-scripts
{
"pipe_name" : "test_pipe",
"pipe_alias" : "test_alias",
"category" : "STREAMING_TO_INDEX_LAKE",
"directory" : "",
"description" : "",
"schema" : {
"columns" : [ {
"column_name" : "test_int",
"column_data_type" : "INT",
"column_data_type_setting" : "",
"column_type" : "PHYSICAL",
"column_type_setting" : "",
"nullable" : true,
"array" : false,
"depth" : 0,
"parent_name" : "",
"own_name" : "test_int"
}, {
"column_name" : "test_time",
"column_data_type" : "TIMESTAMP",
"column_data_type_setting" : 3,
"column_type" : "PHYSICAL",
"column_type_setting" : "",
"nullable" : true,
"array" : false,
"depth" : 0,
"own_name" : "test_time"
} ],
"watermark_column" : "test_time",
"watermark_interval" : 5,
"time_filter" : "test_time"
},
"storage_setting" : {
"streaming_bandwidth" : 0.5,
"streaming_dataspace_id" : "f5f1e499-005e-4ad6-8c64-d6bb4b3135f1",
"index_shards" : 1,
"index_storage_period" : 3,
"index_storage_size" : 100,
"data_transformation_cu" : 0.25,
"lake_storage_period" : 180
},
"display_setting" : {
"format" : "TABLE",
"columns" : [ {
"column_name" : "test_int",
"column_alias" : "",
"display_by_default" : true
}, {
"column_name" : "test_time",
"column_alias" : "",
"display_by_default" : true
} ]
}
}
Example Responses
Status code: 200
Request succeeded.
{
"category" : "STREAMING_TO_INDEX_LAKE",
"create_time" : 1768533826329,
"delete_time" : 0,
"description" : "",
"directory" : "",
"owner_type" : "USER",
"pipe_alias" : "test_alias",
"pipe_id" : "c46c803f-4f49-4b04-9ad5-2441543d4576",
"pipe_name" : "test_pipe",
"process_status" : "CREATING",
"project_id" : "c796dfc5f1644915ae072b7642a2cd93",
"resources" : [ ],
"update_time" : 1768533826329,
"workspace_id" : "5317af6c-aea0-4bd2-bd6b-08de5fd3b155"
}
SDK Sample Code
The SDK sample code is as follows.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
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.v2.region.SecMasterRegion; import com.huaweicloud.sdk.secmaster.v2.*; import com.huaweicloud.sdk.secmaster.v2.model.*; import java.util.List; import java.util.ArrayList; public class CreatePipeSolution { 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(); CreatePipeRequest request = new CreatePipeRequest(); request.withWorkspaceId("{workspace_id}"); CreatePipeRequestBody body = new CreatePipeRequestBody(); List<TableColumnDisplaySetting> listDisplaySettingColumns = new ArrayList<>(); listDisplaySettingColumns.add( new TableColumnDisplaySetting() .withColumnName("test_int") .withColumnAlias("") .withDisplayByDefault(true) ); listDisplaySettingColumns.add( new TableColumnDisplaySetting() .withColumnName("test_time") .withColumnAlias("") .withDisplayByDefault(true) ); TableDisplaySetting displaySettingbody = new TableDisplaySetting(); displaySettingbody.withColumns(listDisplaySettingColumns) .withFormat(TableDisplaySetting.FormatEnum.fromValue("TABLE")); PipeStorageSetting storageSettingbody = new PipeStorageSetting(); storageSettingbody.withStreamingBandwidth(0.5f) .withStreamingDataspaceId("f5f1e499-005e-4ad6-8c64-d6bb4b3135f1") .withIndexStoragePeriod(3L) .withIndexStorageSize(100L) .withIndexShards(1L) .withDataTransformationCu(0.25f) .withLakeStoragePeriod(180L); List<TableColumnForIsapPipe> listSchemaColumns = new ArrayList<>(); listSchemaColumns.add( new TableColumnForIsapPipe() .withColumnName("test_int") .withColumnDataType(TableColumnForIsapPipe.ColumnDataTypeEnum.fromValue("INT")) .withColumnDataTypeSetting("") .withColumnType(TableColumnForIsapPipe.ColumnTypeEnum.fromValue("PHYSICAL")) .withColumnTypeSetting("") .withNullable(true) .withArray(false) .withDepth(0L) .withParentName("") .withOwnName("test_int") ); listSchemaColumns.add( new TableColumnForIsapPipe() .withColumnName("test_time") .withColumnDataType(TableColumnForIsapPipe.ColumnDataTypeEnum.fromValue("TIMESTAMP")) .withColumnDataTypeSetting("3") .withColumnType(TableColumnForIsapPipe.ColumnTypeEnum.fromValue("PHYSICAL")) .withColumnTypeSetting("") .withNullable(true) .withArray(false) .withDepth(0L) .withOwnName("test_time") ); PipeSchema schemabody = new PipeSchema(); schemabody.withColumns(listSchemaColumns) .withWatermarkColumn("test_time") .withWatermarkInterval(5f) .withTimeFilter("test_time"); body.withDisplaySetting(displaySettingbody); body.withStorageSetting(storageSettingbody); body.withSchema(schemabody); body.withDescription(""); body.withDirectory(""); body.withCategory(CreatePipeRequestBody.CategoryEnum.fromValue("STREAMING_TO_INDEX_LAKE")); body.withPipeAlias("test_alias"); body.withPipeName("test_pipe"); request.withBody(body); try { CreatePipeResponse response = client.createPipe(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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdksecmaster.v2.region.secmaster_region import SecMasterRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksecmaster.v2 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 = CreatePipeRequest() request.workspace_id = "{workspace_id}" listColumnsDisplaySetting = [ TableColumnDisplaySetting( column_name="test_int", column_alias="", display_by_default=True ), TableColumnDisplaySetting( column_name="test_time", column_alias="", display_by_default=True ) ] displaySettingbody = TableDisplaySetting( columns=listColumnsDisplaySetting, format="TABLE" ) storageSettingbody = PipeStorageSetting( streaming_bandwidth=0.5, streaming_dataspace_id="f5f1e499-005e-4ad6-8c64-d6bb4b3135f1", index_storage_period=3, index_storage_size=100, index_shards=1, data_transformation_cu=0.25, lake_storage_period=180 ) listColumnsSchema = [ TableColumnForIsapPipe( column_name="test_int", column_data_type="INT", column_data_type_setting="", column_type="PHYSICAL", column_type_setting="", nullable=True, array=False, depth=0, parent_name="", own_name="test_int" ), TableColumnForIsapPipe( column_name="test_time", column_data_type="TIMESTAMP", column_data_type_setting="3", column_type="PHYSICAL", column_type_setting="", nullable=True, array=False, depth=0, own_name="test_time" ) ] schemabody = PipeSchema( columns=listColumnsSchema, watermark_column="test_time", watermark_interval=5, time_filter="test_time" ) request.body = CreatePipeRequestBody( display_setting=displaySettingbody, storage_setting=storageSettingbody, schema=schemabody, description="", directory="", category="STREAMING_TO_INDEX_LAKE", pipe_alias="test_alias", pipe_name="test_pipe" ) response = client.create_pipe(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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/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.CreatePipeRequest{} request.WorkspaceId = "{workspace_id}" columnNameColumns:= "test_int" columnAliasColumns:= "" displayByDefaultColumns:= true columnNameColumns1:= "test_time" columnAliasColumns1:= "" displayByDefaultColumns1:= true var listColumnsDisplaySetting = []model.TableColumnDisplaySetting{ { ColumnName: &columnNameColumns, ColumnAlias: &columnAliasColumns, DisplayByDefault: &displayByDefaultColumns, }, { ColumnName: &columnNameColumns1, ColumnAlias: &columnAliasColumns1, DisplayByDefault: &displayByDefaultColumns1, }, } formatDisplaySetting:= model.GetTableDisplaySettingFormatEnum().TABLE displaySettingbody := &model.TableDisplaySetting{ Columns: &listColumnsDisplaySetting, Format: &formatDisplaySetting, } streamingBandwidthStorageSetting:= float32(0.5) indexStoragePeriodStorageSetting:= int64(3) indexStorageSizeStorageSetting:= int64(100) indexShardsStorageSetting:= int64(1) dataTransformationCuStorageSetting:= float32(0.25) lakeStoragePeriodStorageSetting:= int64(180) storageSettingbody := &model.PipeStorageSetting{ StreamingBandwidth: &streamingBandwidthStorageSetting, StreamingDataspaceId: "f5f1e499-005e-4ad6-8c64-d6bb4b3135f1", IndexStoragePeriod: &indexStoragePeriodStorageSetting, IndexStorageSize: &indexStorageSizeStorageSetting, IndexShards: &indexShardsStorageSetting, DataTransformationCu: &dataTransformationCuStorageSetting, LakeStoragePeriod: &lakeStoragePeriodStorageSetting, } columnDataTypeSettingColumns:= "" columnTypeColumns:= model.GetTableColumnForIsapPipeColumnTypeEnum().PHYSICAL columnTypeSettingColumns:= "" nullableColumns:= true arrayColumns:= false depthColumns:= int64(0) parentNameColumns:= "" ownNameColumns:= "test_int" columnDataTypeSettingColumns1:= "3" columnTypeColumns1:= model.GetTableColumnForIsapPipeColumnTypeEnum().PHYSICAL columnTypeSettingColumns1:= "" nullableColumns1:= true arrayColumns1:= false depthColumns1:= int64(0) ownNameColumns1:= "test_time" var listColumnsSchema = []model.TableColumnForIsapPipe{ { ColumnName: "test_int", ColumnDataType: model.GetTableColumnForIsapPipeColumnDataTypeEnum().INT, ColumnDataTypeSetting: &columnDataTypeSettingColumns, ColumnType: &columnTypeColumns, ColumnTypeSetting: &columnTypeSettingColumns, Nullable: &nullableColumns, Array: &arrayColumns, Depth: &depthColumns, ParentName: &parentNameColumns, OwnName: &ownNameColumns, }, { ColumnName: "test_time", ColumnDataType: model.GetTableColumnForIsapPipeColumnDataTypeEnum().TIMESTAMP, ColumnDataTypeSetting: &columnDataTypeSettingColumns1, ColumnType: &columnTypeColumns1, ColumnTypeSetting: &columnTypeSettingColumns1, Nullable: &nullableColumns1, Array: &arrayColumns1, Depth: &depthColumns1, OwnName: &ownNameColumns1, }, } watermarkColumnSchema:= "test_time" watermarkIntervalSchema:= float32(5) schemabody := &model.PipeSchema{ Columns: listColumnsSchema, WatermarkColumn: &watermarkColumnSchema, WatermarkInterval: &watermarkIntervalSchema, TimeFilter: "test_time", } descriptionCreatePipeRequestBody:= "" directoryCreatePipeRequestBody:= "" categoryCategory:= model.GetPipeCategoryCategoryEnum().STREAMING_TO_INDEX_LAKE request.Body = &model.CreatePipeRequestBody{ DisplaySetting: displaySettingbody, StorageSetting: storageSettingbody, Schema: schemabody, Description: &descriptionCreatePipeRequestBody, Directory: &directoryCreatePipeRequestBody, Category: &categoryCategory, PipeAlias: "test_alias", PipeName: "test_pipe", } response, err := client.CreatePipe(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Request succeeded. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot