Adding a Mapping
Function
This API is used to add a mapping.
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/workspaces/{workspace_id}/soc/mappings/mappers
|
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 |
Definition Workspace ID. Range N/A |
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 |
|
Content-Type |
Yes |
String |
Definition Content type. Constraints N/A Range Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
Yes |
String |
Mapping ID. |
|
name |
No |
String |
Name. |
|
project_id |
No |
String |
Mapping ID. |
|
workspace_id |
No |
String |
Mapping ID. |
|
dataclass_id |
Yes |
String |
Mapping ID. |
|
data_source |
No |
String |
Data source. |
|
status |
No |
String |
Status: enabled or disabled. |
|
description |
No |
String |
Description. |
|
create_time |
No |
String |
Creation time. |
|
creator_id |
No |
String |
Creator ID. |
|
creator_name |
No |
String |
Creator name. |
|
update_time |
No |
String |
Update time. |
|
modifier_id |
No |
String |
Modifier ID. |
|
modifier_name |
No |
String |
Modifier name. |
|
mapper |
Yes |
DpeMappingDetail object |
Mapping information. |
|
classifier |
No |
DpeClassifyCreate object |
Classification creation information. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Mapping ID. |
|
name |
No |
String |
Name. |
|
project_id |
No |
String |
Mapping ID. |
|
workspace_id |
No |
String |
Mapping ID. |
|
dataclass_id |
No |
String |
Mapping ID. |
|
dataclass_name |
No |
String |
Data class name. |
|
mapper_type_id |
No |
String |
Mapping ID. |
|
mapping_id |
No |
String |
Mapping ID. |
|
mapping_info |
No |
DpeInfo object |
Classification information. |
|
create_time |
No |
String |
Creation time. |
|
creator_id |
No |
String |
Creator ID. |
|
creator_name |
No |
String |
Creator name. |
|
update_time |
No |
String |
Update time. |
|
modifier_id |
No |
String |
Modifier ID. |
|
modifier_name |
No |
String |
Modifier name. |
|
mapper_field_list |
No |
Array of DpeMappingFieldDetail objects |
Mapping set. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Mapping ID. |
|
project_id |
No |
String |
Mapping ID. |
|
workspace_id |
No |
String |
Mapping ID. |
|
dataclass_id |
No |
String |
Mapping ID. |
|
mapping_id |
No |
String |
Mapping ID. |
|
mapper_id |
No |
String |
Mapping ID. |
|
default_value |
No |
String |
Default Value |
|
target_key |
No |
String |
Target field. |
|
expression |
No |
String |
Expression. |
|
create_time |
No |
String |
Creation time. |
|
update_time |
No |
String |
Update time. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Mapping ID. |
|
project_id |
No |
String |
Mapping ID. |
|
workspace_id |
No |
String |
Mapping ID. |
|
dataclass_id |
No |
String |
Mapping ID. |
|
dataclass_name |
No |
String |
Data class name. |
|
mapping_id |
No |
String |
Mapping ID. |
|
direct_classifier |
No |
String |
Direct classification. |
|
direct_classifier_type_id |
No |
String |
Mapping ID. |
|
create_time |
No |
String |
Creation time. |
|
creator_id |
No |
String |
Creator ID. |
|
creator_name |
No |
String |
Creator name. |
|
update_time |
No |
String |
Update time. |
|
modifier_id |
No |
String |
Modifier ID. |
|
modifier_name |
No |
String |
Modifier name. |
|
mapping_info |
No |
DpeInfo object |
Classification information. |
|
classifier_item_list |
No |
Array of DpeClassifyItemDetail objects |
Category set element. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Mapping ID. |
|
name |
No |
String |
Name. |
|
project_id |
No |
String |
Mapping ID. |
|
workspace_id |
No |
String |
Mapping ID. |
|
dataclass_id |
No |
String |
Mapping ID. |
|
dataclass_name |
No |
String |
Data class name. |
|
classifier_id |
No |
String |
Associated classification ID. |
|
status |
No |
String |
Status. |
|
complete_degree |
No |
String |
Progress. |
|
instance_num |
No |
String |
The number of associated instances. |
|
built_in |
No |
String |
Whether the data is built-in. |
|
data_source |
No |
String |
Data source. |
|
description |
No |
String |
Description. |
|
update_time |
No |
String |
Update time. |
|
create_time |
No |
String |
Creation time. |
|
creator_id |
No |
String |
Creator ID. |
|
creator_name |
No |
String |
Creator name. |
|
modifier_id |
No |
String |
Modifier ID. |
|
modifier_name |
No |
String |
Modifier name. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Mapping ID. |
|
classifier_id |
No |
String |
Mapping ID. |
|
classifier_type_id |
No |
String |
Mapping ID. |
|
mapping_id |
No |
String |
Mapping ID. |
|
classifier_order |
No |
Integer |
Classification priority. |
|
expression |
No |
String |
Expression. |
|
create_time |
No |
String |
Creation time. |
|
update_time |
No |
String |
Update time. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Definition Error code. Range N/A |
|
message |
String |
Definition Error description. Range N/A |
|
data |
CreateDpeMappingRequestBody object |
Request body for creating a categorical mapping. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
name |
String |
Name. |
|
project_id |
String |
Mapping ID. |
|
workspace_id |
String |
Mapping ID. |
|
dataclass_id |
String |
Mapping ID. |
|
data_source |
String |
Data source. |
|
status |
String |
Status: enabled or disabled. |
|
description |
String |
Description. |
|
create_time |
String |
Creation time. |
|
creator_id |
String |
Creator ID. |
|
creator_name |
String |
Creator name. |
|
update_time |
String |
Update time. |
|
modifier_id |
String |
Modifier ID. |
|
modifier_name |
String |
Modifier name. |
|
mapper |
DpeMappingDetail object |
Mapping information. |
|
classifier |
DpeClassifyCreate object |
Classification creation information. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
name |
String |
Name. |
|
project_id |
String |
Mapping ID. |
|
workspace_id |
String |
Mapping ID. |
|
dataclass_id |
String |
Mapping ID. |
|
dataclass_name |
String |
Data class name. |
|
mapper_type_id |
String |
Mapping ID. |
|
mapping_id |
String |
Mapping ID. |
|
mapping_info |
DpeInfo object |
Classification information. |
|
create_time |
String |
Creation time. |
|
creator_id |
String |
Creator ID. |
|
creator_name |
String |
Creator name. |
|
update_time |
String |
Update time. |
|
modifier_id |
String |
Modifier ID. |
|
modifier_name |
String |
Modifier name. |
|
mapper_field_list |
Array of DpeMappingFieldDetail objects |
Mapping set. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
project_id |
String |
Mapping ID. |
|
workspace_id |
String |
Mapping ID. |
|
dataclass_id |
String |
Mapping ID. |
|
mapping_id |
String |
Mapping ID. |
|
mapper_id |
String |
Mapping ID. |
|
default_value |
String |
Default Value |
|
target_key |
String |
Target field. |
|
expression |
String |
Expression. |
|
create_time |
String |
Creation time. |
|
update_time |
String |
Update time. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
project_id |
String |
Mapping ID. |
|
workspace_id |
String |
Mapping ID. |
|
dataclass_id |
String |
Mapping ID. |
|
dataclass_name |
String |
Data class name. |
|
mapping_id |
String |
Mapping ID. |
|
direct_classifier |
String |
Direct classification. |
|
direct_classifier_type_id |
String |
Mapping ID. |
|
create_time |
String |
Creation time. |
|
creator_id |
String |
Creator ID. |
|
creator_name |
String |
Creator name. |
|
update_time |
String |
Update time. |
|
modifier_id |
String |
Modifier ID. |
|
modifier_name |
String |
Modifier name. |
|
mapping_info |
DpeInfo object |
Classification information. |
|
classifier_item_list |
Array of DpeClassifyItemDetail objects |
Category set element. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
name |
String |
Name. |
|
project_id |
String |
Mapping ID. |
|
workspace_id |
String |
Mapping ID. |
|
dataclass_id |
String |
Mapping ID. |
|
dataclass_name |
String |
Data class name. |
|
classifier_id |
String |
Associated classification ID. |
|
status |
String |
Status. |
|
complete_degree |
String |
Progress. |
|
instance_num |
String |
The number of associated instances. |
|
built_in |
String |
Whether the data is built-in. |
|
data_source |
String |
Data source. |
|
description |
String |
Description. |
|
update_time |
String |
Update time. |
|
create_time |
String |
Creation time. |
|
creator_id |
String |
Creator ID. |
|
creator_name |
String |
Creator name. |
|
modifier_id |
String |
Modifier ID. |
|
modifier_name |
String |
Modifier name. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
classifier_id |
String |
Mapping ID. |
|
classifier_type_id |
String |
Mapping ID. |
|
mapping_id |
String |
Mapping ID. |
|
classifier_order |
Integer |
Classification priority. |
|
expression |
String |
Expression. |
|
create_time |
String |
Creation time. |
|
update_time |
String |
Update time. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Definition Error code. Range N/A |
|
message |
String |
Definition Error description. Range N/A |
Example Requests
Add a mapping.
{
"modifier_name" : "r00000001",
"create_time" : "2022-06-16T10:37:50Z+0800",
"description" : "CreateMapper",
"mapper" : {
"mapper_type_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"mapper_field_list" : [ {
"workspace_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"update_time" : "2022-06-16T10:37:50Z+0800",
"expression" : {
"filter" : {
"conditions" : [ {
"name" : "c1",
"data" : [ "title", "==", "xxxx" ],
"is_context" : false
} ],
"logics" : [ "title" ]
}
},
"create_time" : "2022-06-16T10:37:50Z+0800",
"project_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"mapping_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"target_key" : "alert",
"default_value" : "alert",
"id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"dataclass_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"mapper_id" : "38173e29-ba56-404e-84d7-71ca33d0e416"
} ],
"dataclass_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"workspace_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"project_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"name" : "CreateMapper",
"id" : "38173e29-ba56-404e-84d7-71ca33d0e416"
},
"dataclass_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"data_source" : "CFW",
"workspace_id" : "d7310f19-56d3-4556-b4ea-328a7899a6ba",
"project_id" : "81fee81ab75a48a7b38e6586868688e7",
"name" : "test_create",
"id" : "96cc63b3-3f8f-4798-be2c-9f3930c14e29",
"status" : "enabled"
}
Example Responses
Status code: 200
Response to the request for adding a mapping.
{
"code" : "00000000",
"data" : {
"classifier" : null,
"data_source" : "CFW",
"dataclass_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"description" : "description",
"id" : "96cc63b3-3f8f-4798-be2c-9f3930c14e29",
"mapper" : {
"dataclass_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"id" : "59adc124-4f31-4dd9-b8b7-740309d9cce7",
"mapper_field_list" : [ {
"default_value" : "alert",
"expression" : "{\"filter\":{\"conditions\":[{\"name\":\"c1\",\"data\":[\"title\",\"==\",\"xxxx\"],\"is_context\":false}],\"logics\":[\"title\"]}}javascript:void(0);",
"target_key" : "alert"
} ],
"mapper_type_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"name" : "CreateMapper",
"project_id" : "38173e29-ba56-404e-84d7-71ca33d0e416",
"workspace_id" : "38173e29-ba56-404e-84d7-71ca33d0e416"
},
"name" : "create",
"project_id" : "81fee81ab75a48a7b38e6586868688e7",
"workspace_id" : "70689d1c-e953-458e-8807-6f0b2a789ee9"
},
"message" : ""
}
SDK Sample Code
The SDK sample code is as follows.
Add a mapping.
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 |
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 CreateMapperSolution { 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(); CreateMapperRequest request = new CreateMapperRequest(); request.withWorkspaceId("{workspace_id}"); CreateDpeMappingRequestBody body = new CreateDpeMappingRequestBody(); List<DpeMappingFieldDetail> listMapperMapperFieldList = new ArrayList<>(); listMapperMapperFieldList.add( new DpeMappingFieldDetail() .withId("38173e29-ba56-404e-84d7-71ca33d0e416") .withProjectId("38173e29-ba56-404e-84d7-71ca33d0e416") .withWorkspaceId("38173e29-ba56-404e-84d7-71ca33d0e416") .withDataclassId("38173e29-ba56-404e-84d7-71ca33d0e416") .withMappingId("38173e29-ba56-404e-84d7-71ca33d0e416") .withMapperId("38173e29-ba56-404e-84d7-71ca33d0e416") .withDefaultValue("alert") .withTargetKey("alert") .withExpression("{filter={conditions=[{name=c1, data=[title, ==, xxxx], is_context=false}], logics=[title]}}") .withCreateTime("2022-06-16T10:37:50Z+0800") .withUpdateTime("2022-06-16T10:37:50Z+0800") ); DpeMappingDetail mapperbody = new DpeMappingDetail(); mapperbody.withId("38173e29-ba56-404e-84d7-71ca33d0e416") .withName("CreateMapper") .withProjectId("38173e29-ba56-404e-84d7-71ca33d0e416") .withWorkspaceId("38173e29-ba56-404e-84d7-71ca33d0e416") .withDataclassId("38173e29-ba56-404e-84d7-71ca33d0e416") .withMapperTypeId("38173e29-ba56-404e-84d7-71ca33d0e416") .withMapperFieldList(listMapperMapperFieldList); body.withMapper(mapperbody); body.withModifierName("r00000001"); body.withModifierId("r00000001"); body.withUpdateTime("2022-06-16T10:37:50Z+0800"); body.withCreatorName("r00000001"); body.withCreatorId("r00000001"); body.withCreateTime("2022-06-16T10:37:50Z+0800"); body.withDescription("CreateMapper"); body.withStatus("enabled"); body.withDataSource("CFW"); body.withDataclassId("38173e29-ba56-404e-84d7-71ca33d0e416"); body.withWorkspaceId("d7310f19-56d3-4556-b4ea-328a7899a6ba"); body.withProjectId("81fee81ab75a48a7b38e6586868688e7"); body.withName("test_create"); body.withId("96cc63b3-3f8f-4798-be2c-9f3930c14e29"); request.withBody(body); try { CreateMapperResponse response = client.createMapper(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()); } } } |
Add a mapping.
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 |
# 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 = CreateMapperRequest() request.workspace_id = "{workspace_id}" listMapperFieldListMapper = [ DpeMappingFieldDetail( id="38173e29-ba56-404e-84d7-71ca33d0e416", project_id="38173e29-ba56-404e-84d7-71ca33d0e416", workspace_id="38173e29-ba56-404e-84d7-71ca33d0e416", dataclass_id="38173e29-ba56-404e-84d7-71ca33d0e416", mapping_id="38173e29-ba56-404e-84d7-71ca33d0e416", mapper_id="38173e29-ba56-404e-84d7-71ca33d0e416", default_value="alert", target_key="alert", expression="{filter={conditions=[{name=c1, data=[title, ==, xxxx], is_context=false}], logics=[title]}}", create_time="2022-06-16T10:37:50Z+0800", update_time="2022-06-16T10:37:50Z+0800" ) ] mapperbody = DpeMappingDetail( id="38173e29-ba56-404e-84d7-71ca33d0e416", name="CreateMapper", project_id="38173e29-ba56-404e-84d7-71ca33d0e416", workspace_id="38173e29-ba56-404e-84d7-71ca33d0e416", dataclass_id="38173e29-ba56-404e-84d7-71ca33d0e416", mapper_type_id="38173e29-ba56-404e-84d7-71ca33d0e416", mapper_field_list=listMapperFieldListMapper ) request.body = CreateDpeMappingRequestBody( mapper=mapperbody, modifier_name="r00000001", modifier_id="r00000001", update_time="2022-06-16T10:37:50Z+0800", creator_name="r00000001", creator_id="r00000001", create_time="2022-06-16T10:37:50Z+0800", description="CreateMapper", status="enabled", data_source="CFW", dataclass_id="38173e29-ba56-404e-84d7-71ca33d0e416", workspace_id="d7310f19-56d3-4556-b4ea-328a7899a6ba", project_id="81fee81ab75a48a7b38e6586868688e7", name="test_create", id="96cc63b3-3f8f-4798-be2c-9f3930c14e29" ) response = client.create_mapper(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Add a mapping.
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 |
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.CreateMapperRequest{} request.WorkspaceId = "{workspace_id}" projectIdMapperFieldList:= "38173e29-ba56-404e-84d7-71ca33d0e416" workspaceIdMapperFieldList:= "38173e29-ba56-404e-84d7-71ca33d0e416" mappingIdMapperFieldList:= "38173e29-ba56-404e-84d7-71ca33d0e416" mapperIdMapperFieldList:= "38173e29-ba56-404e-84d7-71ca33d0e416" defaultValueMapperFieldList:= "alert" targetKeyMapperFieldList:= "alert" expressionMapperFieldList:= "{filter={conditions=[{name=c1, data=[title, ==, xxxx], is_context=false}], logics=[title]}}" createTimeMapperFieldList:= "2022-06-16T10:37:50Z+0800" updateTimeMapperFieldList:= "2022-06-16T10:37:50Z+0800" var listMapperFieldListMapper = []model.DpeMappingFieldDetail{ { Id: "38173e29-ba56-404e-84d7-71ca33d0e416", ProjectId: &projectIdMapperFieldList, WorkspaceId: &workspaceIdMapperFieldList, DataclassId: "38173e29-ba56-404e-84d7-71ca33d0e416", MappingId: &mappingIdMapperFieldList, MapperId: &mapperIdMapperFieldList, DefaultValue: &defaultValueMapperFieldList, TargetKey: &targetKeyMapperFieldList, Expression: &expressionMapperFieldList, CreateTime: &createTimeMapperFieldList, UpdateTime: &updateTimeMapperFieldList, }, } nameMapper:= "CreateMapper" projectIdMapper:= "38173e29-ba56-404e-84d7-71ca33d0e416" workspaceIdMapper:= "38173e29-ba56-404e-84d7-71ca33d0e416" mapperTypeIdMapper:= "38173e29-ba56-404e-84d7-71ca33d0e416" mapperbody := &model.DpeMappingDetail{ Id: "38173e29-ba56-404e-84d7-71ca33d0e416", Name: &nameMapper, ProjectId: &projectIdMapper, WorkspaceId: &workspaceIdMapper, DataclassId: "38173e29-ba56-404e-84d7-71ca33d0e416", MapperTypeId: &mapperTypeIdMapper, MapperFieldList: &listMapperFieldListMapper, } modifierNameCreateDpeMappingRequestBody:= "r00000001" modifierIdCreateDpeMappingRequestBody:= "r00000001" updateTimeCreateDpeMappingRequestBody:= "2022-06-16T10:37:50Z+0800" creatorNameCreateDpeMappingRequestBody:= "r00000001" creatorIdCreateDpeMappingRequestBody:= "r00000001" createTimeCreateDpeMappingRequestBody:= "2022-06-16T10:37:50Z+0800" descriptionCreateDpeMappingRequestBody:= "CreateMapper" statusCreateDpeMappingRequestBody:= "enabled" dataSourceCreateDpeMappingRequestBody:= "CFW" workspaceIdCreateDpeMappingRequestBody:= "d7310f19-56d3-4556-b4ea-328a7899a6ba" projectIdCreateDpeMappingRequestBody:= "81fee81ab75a48a7b38e6586868688e7" nameCreateDpeMappingRequestBody:= "test_create" request.Body = &model.CreateDpeMappingRequestBody{ Mapper: mapperbody, ModifierName: &modifierNameCreateDpeMappingRequestBody, ModifierId: &modifierIdCreateDpeMappingRequestBody, UpdateTime: &updateTimeCreateDpeMappingRequestBody, CreatorName: &creatorNameCreateDpeMappingRequestBody, CreatorId: &creatorIdCreateDpeMappingRequestBody, CreateTime: &createTimeCreateDpeMappingRequestBody, Description: &descriptionCreateDpeMappingRequestBody, Status: &statusCreateDpeMappingRequestBody, DataSource: &dataSourceCreateDpeMappingRequestBody, DataclassId: "38173e29-ba56-404e-84d7-71ca33d0e416", WorkspaceId: &workspaceIdCreateDpeMappingRequestBody, ProjectId: &projectIdCreateDpeMappingRequestBody, Name: &nameCreateDpeMappingRequestBody, Id: "96cc63b3-3f8f-4798-be2c-9f3930c14e29", } response, err := client.CreateMapper(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 |
Response to the request for adding a mapping. |
|
400 |
Returned packet for abnormal requests. |
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